Skip to content

Commit

Permalink
feat(api/latest.py): Implement bulk set api call
Browse files Browse the repository at this point in the history
Reference PR: kernelci/kernelci-api#584

Signed-off-by: Denys Fedoryshchenko <[email protected]>
  • Loading branch information
nuclearcat committed Dec 5, 2024
1 parent 7144fa1 commit d11d77f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions kernelci/api/latest.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,18 @@ def update(self, node: dict, noevent=False) -> dict:
uri += '?noevent=true'
return self._put(uri, node).json()

def bulkset(self, nodes: list, field: str, value: str):
"""
Set a field to a value for a list of nodes(ids)
"""
param = {
'nodes': nodes,
'field': field,
'value': value
}
print(f"bulkset param: {param}")
return self._put(f'batch/nodeset', data=param)

Check warning on line 153 in kernelci/api/latest.py

View workflow job for this annotation

GitHub Actions / Lint

Using an f-string that does not have any interpolated variables

def subscribe(self, channel: str, promisc: Optional[bool] = None) -> int:
params = {'promisc': promisc} if promisc else None
resp = self._post(f'subscribe/{channel}', params=params)
Expand Down

0 comments on commit d11d77f

Please sign in to comment.