Skip to content

Commit d11d77f

Browse files
committed
feat(api/latest.py): Implement bulk set api call
Reference PR: kernelci/kernelci-api#584 Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 7144fa1 commit d11d77f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

kernelci/api/latest.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,18 @@ def update(self, node: dict, noevent=False) -> dict:
140140
uri += '?noevent=true'
141141
return self._put(uri, node).json()
142142

143+
def bulkset(self, nodes: list, field: str, value: str):
144+
"""
145+
Set a field to a value for a list of nodes(ids)
146+
"""
147+
param = {
148+
'nodes': nodes,
149+
'field': field,
150+
'value': value
151+
}
152+
print(f"bulkset param: {param}")
153+
return self._put(f'batch/nodeset', data=param)
154+
143155
def subscribe(self, channel: str, promisc: Optional[bool] = None) -> int:
144156
params = {'promisc': promisc} if promisc else None
145157
resp = self._post(f'subscribe/{channel}', params=params)

0 commit comments

Comments
 (0)