Skip to content

Commit 22febf3

Browse files
committed
feat(main.py): Add noevent flag
While updating some data like kcidb flags we should not generate events, as they will be processed by kcidb bridge again. Signed-off-by: Denys Fedoryshchenko <denys.f@collabora.com>
1 parent 56aa638 commit 22febf3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

api/main.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,8 @@ async def post_node(node: Node,
714714

715715
@app.put('/node/{node_id}', response_model=Node, response_model_by_alias=False)
716716
async def put_node(node_id: str, node: Node,
717-
user: str = Depends(authorize_user)):
717+
user: str = Depends(authorize_user),
718+
noevent: Optional[bool] = Query(None)):
718719
"""Update an already added node"""
719720
metrics.add('http_requests_total', 1)
720721
node.id = ObjectId(node_id)
@@ -763,9 +764,10 @@ async def put_node(node_id: str, node: Node,
763764
attributes = {}
764765
if data.get('owner', None):
765766
attributes['owner'] = data['owner']
766-
await pubsub.publish_cloudevent('node', data, attributes)
767-
evhist = _get_eventhistory(data)
768-
await db.create(evhist)
767+
if not noevent:
768+
await pubsub.publish_cloudevent('node', data, attributes)
769+
evhist = _get_eventhistory(data)
770+
await db.create(evhist)
769771
return obj
770772

771773

0 commit comments

Comments
 (0)