Skip to content

Commit 1e593be

Browse files
committed
saving sample edit apps
1 parent 0a1a426 commit 1e593be

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

generic-orchestration-samples/setup_edit_app_sample/edit_apps.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
def 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

5965
def edit_apps_in_sandbox(sandbox, components):
6066
"""
61-
6267
:param Sandbox sandbox:
6368
:param components:
6469
:return:

miscellaneous/installation.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"Installation": {
3+
"Attributes": [
4+
{
5+
"Name": "Generic Input",
6+
"Value": "blabla"
7+
}
8+
],
9+
"Script": {
10+
"Name": "test script",
11+
"Inputs": [
12+
{
13+
"Name": "myInput",
14+
"Value": "5"
15+
}
16+
]
17+
}
18+
}
19+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[
2+
{
3+
"Name": "vcenter test",
4+
"NewName": "new name test",
5+
"Description": "my description",
6+
"AppDetails": {
7+
"Attributes": [
8+
{
9+
"Name": "User",
10+
"Value": "Testshell Test User"
11+
},
12+
{
13+
"Name": "Password",
14+
"Value": "Test password"
15+
}
16+
],
17+
"Driver": null,
18+
"ModelName": "Generic App Model"
19+
},
20+
"DefaultDeployment": {
21+
"Name": "vcenter 110 - 2G - VMware vCenter Cloud Provider 2G.vCenter VM From Linked Clone 2G",
22+
"Deployment": {
23+
"Attributes": [
24+
{
25+
"Name": "VMware vCenter Cloud Provider 2G.vCenter VM From Linked Clone 2G.CPU",
26+
"Value": "6"
27+
}
28+
]
29+
}
30+
}
31+
}
32+
]

0 commit comments

Comments
 (0)