55
66def edit_target_app_in_sandbox (app_name , new_app_name , api , sb_id , target_deployment_attrs ):
77 """
8+ Function to replace specific deployment attributes on a specific app
89 the target deployment attrs ignores namespacing and case sensitivity.
910 This will work for the hdd and cpu attrs - [("hdd", "3"), ("cpu", "5")]
1011 :param str app_name:
@@ -14,7 +15,11 @@ def edit_target_app_in_sandbox(app_name, new_app_name, api, sb_id, target_deploy
1415 :param list target_deployment_attrs: example [("hdd", "3"), ("cpu", "5")]
1516 :return:
1617 """
17- target_deployment_attrs = target_deployment_attrs or []
18+
19+ # guard clause
20+ if not target_deployment_attrs :
21+ return
22+
1823 # find target app to modify
1924 apps = api .GetReservationDetails (sb_id , disableCache = True ).ReservationDescription .Apps
2025 if not apps :
@@ -45,7 +50,8 @@ def edit_target_app_in_sandbox(app_name, new_app_name, api, sb_id, target_deploy
4550 # build out app edit request
4651 new_deployment_attrs_list = [NameValuePair (x [0 ], x [1 ]) for x in new_deployment_attrs_map .items ()]
4752 new_deployment = Deployment (new_deployment_attrs_list )
48- app_details = AppDetails (ModelName = target_app .LogicalResource .Model , Attributes = new_resource_attrs ,
53+ app_details = AppDetails (ModelName = target_app .LogicalResource .Model ,
54+ Attributes = new_resource_attrs ,
4955 Driver = target_app .LogicalResource .Driver )
5056 new_default_deployment = DefaultDeployment (Name = default_deployment .Name , Deployment = new_deployment )
5157 app_edit_requests = [ApiEditAppRequest (Name = app_name ,
@@ -58,7 +64,6 @@ def edit_target_app_in_sandbox(app_name, new_app_name, api, sb_id, target_deploy
5864
5965def edit_apps_in_sandbox (sandbox , components ):
6066 """
61-
6267 :param Sandbox sandbox:
6368 :param components:
6469 :return:
0 commit comments