Skip to content

Commit f3e11b0

Browse files
authored
feat: allow to filter deeploy jobs by project id (#342)
1 parent 1635303 commit f3e11b0

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

extensions/business/deeploy/deeploy_manager_api.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,10 @@ def get_apps(
123123
sender, inputs = self.deeploy_verify_and_get_inputs(request)
124124
auth_result = self.deeploy_get_auth_result(inputs)
125125

126-
apps = self._get_online_apps(owner=auth_result[DEEPLOY_KEYS.ESCROW_OWNER])
126+
apps = self._get_online_apps(
127+
owner=auth_result[DEEPLOY_KEYS.ESCROW_OWNER],
128+
project_id=inputs.get(DEEPLOY_KEYS.PROJECT_ID, None)
129+
)
127130

128131
result = {
129132
DEEPLOY_KEYS.STATUS : DEEPLOY_STATUS.SUCCESS,

extensions/business/deeploy/deeploy_mixin.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2383,7 +2383,7 @@ def delete_pipeline_from_nodes(self, app_id=None, job_id=None, owner=None, allow
23832383
#endfor each target node
23842384
return discovered_instances
23852385

2386-
def _get_online_apps(self, owner=None, target_nodes=None, job_id=None):
2386+
def _get_online_apps(self, owner=None, target_nodes=None, job_id=None, project_id=None):
23872387
"""
23882388
if self.cfg_deeploy_verbose:
23892389
full_data = self.netmon.network_known_nodes()
@@ -2425,6 +2425,14 @@ def _get_online_apps(self, owner=None, target_nodes=None, job_id=None):
24252425
continue
24262426
filtered_result[node][app_name] = app_data
24272427
result = filtered_result
2428+
if project_id is not None:
2429+
filtered_result = self.defaultdict(dict)
2430+
for node, apps in result.items():
2431+
for app_name, app_data in apps.items():
2432+
if app_data.get(NetMonCt.DEEPLOY_SPECS, {}).get(DEEPLOY_KEYS.PROJECT_ID, None) != project_id:
2433+
continue
2434+
filtered_result[node][app_name] = app_data
2435+
result = filtered_result
24282436
return result
24292437

24302438
# TODO: REMOVE THIS, once instance_id is coming from ui for instances that have to be updated

ver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__VER__ = '2.9.992'
1+
__VER__ = '2.9.993'

0 commit comments

Comments
 (0)