fix: handle unexpected 'loop' in actions field

Updated the change_actions method in inspection rules to account for
unexpected 'loop' values being added to the actions field by the API.

Although the API is not expected to include 'loop', it's still
appearing in some responses, causing issues.
This update ensures such cases are handled gracefully.

Related-Bug: 2105478
Change-Id: I9e03cd8d7640037cb98bc2586ddc03ed264ce2ac
This commit is contained in:
abhibongale
2025-06-25 16:02:33 +01:00
committed by Abhishek Bongale
parent 8e6d68d207
commit 8446a75ea0

View File

@@ -41,11 +41,18 @@ DEFAULT_RETURN_FIELDS = ['uuid', 'priority', 'phase', 'description']
def convert_actions(rpc_actions):
return [{
'op': action['op'],
'args': action['args'],
'loop': action.get('loop', [])
} for action in rpc_actions]
converted_actions = []
for action in rpc_actions:
result = {
'op': action['op'],
'args': action['args']
}
if action.get('loop', []):
result['loop'] = action['loop']
converted_actions.append(result)
return converted_actions
def convert_conditions(rpc_conditions):