hcs-cli 0.1.318__py3-none-any.whl → 0.1.320__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. hcs_cli/__init__.py +2 -2
  2. hcs_cli/cmds/advisor/html_utils.py +30 -26
  3. hcs_cli/cmds/advisor/recommendation_engine.py +7 -10
  4. hcs_cli/cmds/daas/tenant/plan.py +1 -1
  5. hcs_cli/cmds/debug/start.py +0 -1
  6. hcs_cli/cmds/dev/fs/clear.py +8 -0
  7. hcs_cli/cmds/dev/fs/helper/credential_helper.py +2 -0
  8. hcs_cli/cmds/dev/fs/helper/k8s_util.py +0 -1
  9. hcs_cli/cmds/dev/fs/init.py +38 -5
  10. hcs_cli/cmds/dev/fs/profiler.py +0 -1
  11. hcs_cli/cmds/dev/fs/provided_files/akka.plan.yml +94 -250
  12. hcs_cli/cmds/dev/fs/provided_files/azsim.plan.yml +27 -34
  13. hcs_cli/cmds/dev/fs/provided_files/azure.plan.yml +294 -322
  14. hcs_cli/cmds/dev/fs/provided_files/mqtt-secret.yaml +188 -93
  15. hcs_cli/cmds/dev/fs/provided_files/mqtt-server-external.yaml +4 -5
  16. hcs_cli/cmds/dev/fs/provided_files/patch-mqtt-hostname.yml +3 -3
  17. hcs_cli/cmds/dev/fs/provided_files/patch-vernemq-ssl-depth.json +1 -1
  18. hcs_cli/cmds/dev/fs/tailor.py +7 -12
  19. hcs_cli/cmds/dev/mqtt.py +1 -2
  20. hcs_cli/cmds/dev/util/mqtt_helper.py +0 -1
  21. hcs_cli/cmds/hoc/search.py +39 -9
  22. hcs_cli/cmds/hoc/stats.py +46 -0
  23. hcs_cli/cmds/hst/clean.py +2 -1
  24. hcs_cli/cmds/inventory/assign.py +1 -3
  25. hcs_cli/cmds/inventory/deassign.py +1 -1
  26. hcs_cli/cmds/inventory/delete.py +48 -0
  27. hcs_cli/cmds/lcm/provider/create.py +11 -2
  28. hcs_cli/cmds/lcm/template/expand.py +46 -0
  29. hcs_cli/cmds/lcm/vm/delete.py +3 -2
  30. hcs_cli/cmds/scm/plan.py +131 -3
  31. hcs_cli/cmds/task.py +2 -4
  32. hcs_cli/cmds/template/expand.py +64 -19
  33. hcs_cli/cmds/template/list_usage.py +2 -2
  34. hcs_cli/cmds/template/update.py +2 -2
  35. hcs_cli/cmds/template/usage.py +20 -7
  36. hcs_cli/cmds/vm/delete.py +3 -2
  37. hcs_cli/cmds/vm/list.py +51 -40
  38. hcs_cli/cmds/vmm/rootca_migrate.py +1 -1
  39. hcs_cli/config/hcs-deployments.yaml +52 -52
  40. hcs_cli/main.py +0 -2
  41. hcs_cli/payload/akka.blueprint.yml +95 -243
  42. hcs_cli/payload/app/manual.json +19 -19
  43. hcs_cli/payload/edge/akka.json +6 -6
  44. hcs_cli/payload/edge/vsphere.json +6 -6
  45. hcs_cli/payload/hoc/lcm-capcalc.json.template +43 -0
  46. hcs_cli/payload/hoc/no-spare.json.template +1 -1
  47. hcs_cli/payload/inventory/assign.json +14 -16
  48. hcs_cli/payload/inventory/deassign.json +11 -11
  49. hcs_cli/payload/lcm/akka.json +31 -33
  50. hcs_cli/payload/lcm/azure-dummy.json +64 -66
  51. hcs_cli/payload/lcm/azure-real.json +13 -11
  52. hcs_cli/payload/lcm/edge-proxy.json +34 -36
  53. hcs_cli/payload/lcm/zero-dedicated.json +34 -36
  54. hcs_cli/payload/lcm/zero-delay-1m-per-vm.json +53 -69
  55. hcs_cli/payload/lcm/zero-fail-delete-template.json +43 -0
  56. hcs_cli/payload/lcm/zero-fail-destroy-onthread.json +38 -40
  57. hcs_cli/payload/lcm/zero-fail-destroy.json +38 -40
  58. hcs_cli/payload/lcm/zero-fail-prepare-onthread.json +38 -40
  59. hcs_cli/payload/lcm/zero-fail-prepare.json +38 -40
  60. hcs_cli/payload/lcm/zero-fail-vm-onthread.json +58 -74
  61. hcs_cli/payload/lcm/zero-fail-vm.json +58 -74
  62. hcs_cli/payload/lcm/zero-floating.json +34 -36
  63. hcs_cli/payload/lcm/zero-manual.json +33 -35
  64. hcs_cli/payload/lcm/zero-multisession.json +34 -36
  65. hcs_cli/payload/lcm/zero-nanw.json +31 -33
  66. hcs_cli/payload/lcm/zero-new-5k-delay.json +69 -78
  67. hcs_cli/payload/lcm/zero-new-5k.json +36 -38
  68. hcs_cli/payload/lcm/zero-new-snapshot.json +37 -39
  69. hcs_cli/payload/lcm/zero-new.json +37 -39
  70. hcs_cli/payload/lcm/zero-reuse-vm-id.json +33 -35
  71. hcs_cli/payload/lcm/zero-with-max-id-offset.json +32 -34
  72. hcs_cli/payload/lcm/zero.json +59 -73
  73. hcs_cli/payload/provider/ad-stes-vsphere.json +26 -26
  74. hcs_cli/payload/provider/akka.json +12 -12
  75. hcs_cli/payload/provider/azure.json +14 -14
  76. hcs_cli/payload/provider/edgeproxy.json +12 -12
  77. hcs_cli/payload/provider/vsphere.json +14 -14
  78. hcs_cli/payload/scm/starter.json +22 -23
  79. hcs_cli/payload/synt/core/p01-dummy-success.json +11 -15
  80. hcs_cli/payload/synt/core/p02-dummy-fail.json +12 -15
  81. hcs_cli/payload/synt/core/p03-dummy-exception.json +12 -15
  82. hcs_cli/payload/synt/core/p04-dummy-success-repeat.json +12 -15
  83. hcs_cli/payload/synt/core/p05-dummy-fail-repeat.json +13 -16
  84. hcs_cli/payload/synt/core/p06-dummy-exception-repeat.json +13 -16
  85. hcs_cli/payload/synt/core/p07-dummy-delay.json +12 -15
  86. hcs_cli/payload/synt/core/p08-dummy-property.json +12 -15
  87. hcs_cli/payload/synt/ext/p20-connect-success.json +12 -15
  88. hcs_cli/payload/synt/ext/p21-connect-fail.json +12 -15
  89. hcs_cli/payload/synt/ext/p30-ssl-success.json +12 -15
  90. hcs_cli/payload/synt/ext/p31-ssl-fail.json +13 -16
  91. hcs_cli/payload/synt/ext/p40-http-success.json +12 -15
  92. hcs_cli/payload/synt/ext/p41-http-fail.json +12 -15
  93. hcs_cli/payload/synt/ext/p42-http-status-code.json +14 -20
  94. hcs_cli/payload/synt/ext1/p10-ping-success.json +13 -16
  95. hcs_cli/payload/synt/ext1/p11-ping-fail.json +12 -15
  96. hcs_cli/payload/synt/ext1/p12-ping-success-repeat.json +14 -17
  97. hcs_cli/provider/hcs/cert.py +0 -1
  98. hcs_cli/provider/hcs/edge.py +1 -1
  99. hcs_cli/provider/hcs/uag.py +1 -1
  100. hcs_cli/service/admin/template.py +10 -1
  101. hcs_cli/service/hoc/diagnostic.py +11 -3
  102. hcs_cli/service/inventory/__init__.py +15 -2
  103. hcs_cli/service/inventory/vm.py +12 -0
  104. hcs_cli/service/lcm/template.py +9 -6
  105. hcs_cli/service/lcm/vm.py +0 -1
  106. hcs_cli/service/task.py +0 -1
  107. hcs_cli/service/template.py +1 -1
  108. hcs_cli/support/debug_util.py +0 -1
  109. hcs_cli/support/plan_util.py +0 -1
  110. hcs_cli/support/predefined_payload.py +4 -1
  111. hcs_cli/support/template_util.py +0 -1
  112. hcs_cli/support/test_utils.py +2 -2
  113. hcs_cli/support/test_utils2.py +536 -0
  114. hcs_cli/support/vm_table.py +2 -2
  115. {hcs_cli-0.1.318.dist-info → hcs_cli-0.1.320.dist-info}/METADATA +24 -17
  116. {hcs_cli-0.1.318.dist-info → hcs_cli-0.1.320.dist-info}/RECORD +118 -113
  117. hcs_cli/payload/lcm/azure-dummy-nt.json +0 -69
  118. {hcs_cli-0.1.318.dist-info → hcs_cli-0.1.320.dist-info}/WHEEL +0 -0
  119. {hcs_cli-0.1.318.dist-info → hcs_cli-0.1.320.dist-info}/entry_points.txt +0 -0
@@ -1,17 +1,14 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "my-message": "hello"
3
8
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "my-message": "hello"
10
- },
11
- "enabled": true,
12
- "labels": {
13
- },
14
- "name": "probe08-dummy-property",
15
- "type": "TEST_DUMMY"
16
- }
17
- }
9
+ "enabled": true,
10
+ "labels": {},
11
+ "name": "probe08-dummy-property",
12
+ "type": "TEST_DUMMY"
13
+ }
14
+ }
@@ -1,17 +1,14 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "www.omnissa.com:443"
3
8
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "www.omnissa.com:443"
10
- },
11
- "enabled": true,
12
- "labels": {
13
- },
14
- "name": "probe20-connect-success",
15
- "type": "TEST_CONNECT"
16
- }
17
- }
9
+ "enabled": true,
10
+ "labels": {},
11
+ "name": "probe20-connect-success",
12
+ "type": "TEST_CONNECT"
13
+ }
14
+ }
@@ -1,17 +1,14 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "www.vmware123456.com:12345"
3
8
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "www.vmware123456.com:12345"
10
- },
11
- "enabled": true,
12
- "labels": {
13
- },
14
- "name": "probe21-connect-fail",
15
- "type": "TEST_CONNECT"
16
- }
17
- }
9
+ "enabled": true,
10
+ "labels": {},
11
+ "name": "probe21-connect-fail",
12
+ "type": "TEST_CONNECT"
13
+ }
14
+ }
@@ -1,18 +1,15 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "https://www.omnissa.com/",
8
+ "verify_ssl": true
3
9
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "https://www.omnissa.com/",
10
- "verify_ssl": true
11
- },
12
- "enabled": true,
13
- "labels": {
14
- },
15
- "name": "probe30-ssl-success",
16
- "type": "TEST_SSL"
17
- }
10
+ "enabled": true,
11
+ "labels": {},
12
+ "name": "probe30-ssl-success",
13
+ "type": "TEST_SSL"
14
+ }
18
15
  }
@@ -1,18 +1,15 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "https://self-signed.badssl.com/",
8
+ "verify_ssl": true
3
9
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "https://self-signed.badssl.com/",
10
- "verify_ssl": true
11
- },
12
- "enabled": true,
13
- "labels": {
14
- },
15
- "name": "probe31-ssl-fail",
16
- "type": "TEST_SSL"
17
- }
18
- }
10
+ "enabled": true,
11
+ "labels": {},
12
+ "name": "probe31-ssl-fail",
13
+ "type": "TEST_SSL"
14
+ }
15
+ }
@@ -1,17 +1,14 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "https://www.omnissa.com/"
3
8
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "https://www.omnissa.com/"
10
- },
11
- "enabled": true,
12
- "labels": {
13
- },
14
- "name": "probe40-http-success",
15
- "type": "TEST_HTTP"
16
- }
17
- }
9
+ "enabled": true,
10
+ "labels": {},
11
+ "name": "probe40-http-success",
12
+ "type": "TEST_HTTP"
13
+ }
14
+ }
@@ -1,17 +1,14 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "https://www.omnissa.com/some-inexist-url"
3
8
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "https://www.omnissa.com/some-inexist-url"
10
- },
11
- "enabled": true,
12
- "labels": {
13
- },
14
- "name": "probe41-http-fail",
15
- "type": "TEST_HTTP"
16
- }
17
- }
9
+ "enabled": true,
10
+ "labels": {},
11
+ "name": "probe41-http-fail",
12
+ "type": "TEST_HTTP"
13
+ }
14
+ }
@@ -1,21 +1,15 @@
1
1
  {
2
- "alertPolicy": {},
3
- "notificationConfig": {},
4
- "outpostIds": [],
5
- "testConfig": {
6
- "data": {
7
- "target": "https://www.omnissa.com/some-inexist-url",
8
- "expected_status_codes": [
9
- 404,
10
- 403,
11
- 202,
12
- 200,
13
- 301
14
- ]
15
- },
16
- "enabled": true,
17
- "labels": {},
18
- "name": "probe42-http-status-code",
19
- "type": "TEST_HTTP"
20
- }
21
- }
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "https://www.omnissa.com/some-inexist-url",
8
+ "expected_status_codes": [404, 403, 202, 200, 301]
9
+ },
10
+ "enabled": true,
11
+ "labels": {},
12
+ "name": "probe42-http-status-code",
13
+ "type": "TEST_HTTP"
14
+ }
15
+ }
@@ -1,18 +1,15 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "localhost",
8
+ "count": 1
3
9
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "localhost",
10
- "count": 1
11
- },
12
- "enabled": true,
13
- "labels": {
14
- },
15
- "name": "probe10-ping-success",
16
- "type": "TEST_PING"
17
- }
18
- }
10
+ "enabled": true,
11
+ "labels": {},
12
+ "name": "probe10-ping-success",
13
+ "type": "TEST_PING"
14
+ }
15
+ }
@@ -1,18 +1,15 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "127.0.0.333",
8
+ "count": 1
3
9
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "127.0.0.333",
10
- "count": 1
11
- },
12
- "enabled": true,
13
- "labels": {
14
- },
15
- "name": "probe11-ping-fail",
16
- "type": "TEST_PING"
17
- }
10
+ "enabled": true,
11
+ "labels": {},
12
+ "name": "probe11-ping-fail",
13
+ "type": "TEST_PING"
14
+ }
18
15
  }
@@ -1,19 +1,16 @@
1
1
  {
2
- "alertPolicy": {
2
+ "alertPolicy": {},
3
+ "notificationConfig": {},
4
+ "outpostIds": [],
5
+ "testConfig": {
6
+ "data": {
7
+ "target": "localhost",
8
+ "count": 1,
9
+ "repeat": "PT2S"
3
10
  },
4
- "notificationConfig": {
5
- },
6
- "outpostIds": [],
7
- "testConfig": {
8
- "data": {
9
- "target": "localhost",
10
- "count": 1,
11
- "repeat": "PT2S"
12
- },
13
- "enabled": true,
14
- "labels": {
15
- },
16
- "name": "probe12-ping-success-repeat",
17
- "type": "TEST_PING"
18
- }
19
- }
11
+ "enabled": true,
12
+ "labels": {},
13
+ "name": "probe12-ping-success-repeat",
14
+ "type": "TEST_PING"
15
+ }
16
+ }
@@ -22,7 +22,6 @@ from hcs_core.util import pki_util
22
22
 
23
23
 
24
24
  def deploy(data: dict, state: dict, save_state) -> dict:
25
-
26
25
  cn = data["cn"]
27
26
 
28
27
  temp_dir = tempfile.gettempdir()
@@ -150,7 +150,7 @@ def refresh(data: dict, state: dict) -> dict:
150
150
  if id:
151
151
  edge = admin.edge.get(id, org_id)
152
152
  if not edge:
153
- edges = admin.edge.list(org_id, search=f'name $eq {data["name"]}')
153
+ edges = admin.edge.list(org_id, search=f"name $eq {data['name']}")
154
154
  if edges:
155
155
  edge = edges[0]
156
156
 
@@ -48,7 +48,7 @@ def refresh(data: dict, state: dict) -> dict:
48
48
  ret = admin.uag.get(id, org_id)
49
49
  if ret:
50
50
  return ret
51
- search = f'name $eq {data["name"]}'
51
+ search = f"name $eq {data['name']}"
52
52
  uags = admin.uag.list(org_id, search=search)
53
53
  if uags:
54
54
  return uags[0]
@@ -16,4 +16,13 @@ limitations under the License.
16
16
  # Deprecated.
17
17
  # To be removed in the future.
18
18
 
19
- from ..template import action, create, delete, get, items, list, update, wait_for, wait_for_deleted, wait_for_ready
19
+ from ..template import action as action
20
+ from ..template import create as create
21
+ from ..template import delete as delete
22
+ from ..template import get as get
23
+ from ..template import items as items
24
+ from ..template import list as list
25
+ from ..template import patch as patch
26
+ from ..template import wait_for as wait_for
27
+ from ..template import wait_for_deleted as wait_for_deleted
28
+ from ..template import wait_for_ready as wait_for_ready
@@ -11,13 +11,11 @@ _client = hdc_service_client("hoc-diagnostic")
11
11
 
12
12
 
13
13
  def search(payload: dict, size: int = 100):
14
-
15
14
  pointer_timestamp = timeutil.iso_date_to_timestamp(payload["from"])
16
15
  end_timestamp = timeutil.iso_date_to_timestamp(payload["to"])
17
16
 
18
17
  count = 0
19
18
  while pointer_timestamp < end_timestamp and count < size:
20
-
21
19
  payload["from"] = timeutil.timestamp_to_iso_date(pointer_timestamp)
22
20
  # log.info(f"range: from={payload['from']}, to={payload['to']}")
23
21
 
@@ -33,7 +31,6 @@ def search(payload: dict, size: int = 100):
33
31
 
34
32
  # _old = count
35
33
  for item in page:
36
-
37
34
  data = item["data"]
38
35
 
39
36
  count += 1
@@ -45,3 +42,14 @@ def search(payload: dict, size: int = 100):
45
42
  pointer_timestamp = max(data["d"]["utcTime"] + 1, pointer_timestamp + 1000)
46
43
 
47
44
  # log.info(f"events={count - _old}")
45
+
46
+
47
+ def aggregateConnects(payload: dict, verbose: bool = False):
48
+ url = "/v1/stats/connect/aggregateConnects"
49
+ if verbose:
50
+ print(f"POST: {url}")
51
+ print(payload)
52
+ response = _client.post(url, json=payload)
53
+ if isinstance(response, str):
54
+ response = json.loads(response)
55
+ return response
@@ -1,2 +1,15 @@
1
- from .session import assign, assignV2, create_manual_session, deassign, logoff, logoffV2, sessions, update_session
2
- from .vm import count, get, list, raw_list, update
1
+ from .session import assign as assign
2
+ from .session import assignV2 as assignV2
3
+ from .session import create_manual_session as create_manual_session
4
+ from .session import deassign as deassign
5
+ from .session import logoff as logoff
6
+ from .session import logoffV2 as logoffV2
7
+ from .session import sessions as sessions
8
+ from .session import update_session as update_session
9
+ from .vm import count as count
10
+ from .vm import get as get
11
+ from .vm import list as list
12
+ from .vm import raw_list as raw_list
13
+ from .vm import update as update
14
+ from .vm import begin_deleting_vms_by_id as begin_deleting_vms_by_id
15
+ from .vm import finish_deleting_vms as finish_deleting_vms
@@ -65,6 +65,18 @@ def finish_adding_vms(template_id: str, org_id: str, num_sessions: int, template
65
65
  return _client.post(url, vms)
66
66
 
67
67
 
68
+ def begin_deleting_vms_by_id(template_id: str, org_id: str, vm_ids: list, **kwargs):
69
+ url = f"/v1/{template_id}/beginDeletingVMsById?org_id={org_id}"
70
+ url = with_query(url, **kwargs)
71
+ return _client.post(url, json=vm_ids)
72
+
73
+
74
+ def finish_deleting_vms(template_id: str, org_id: str, vm_ids: list, **kwargs):
75
+ url = f"/v1/{template_id}/finishDeletingVMs?org_id={org_id}"
76
+ url = with_query(url, **kwargs)
77
+ return _client.post(url, json=vm_ids)
78
+
79
+
68
80
  def count(template_id: str, org_id: str = None, **kwargs):
69
81
  url = f"/v1/{template_id}/count"
70
82
  kwargs["countVM"] = True
@@ -53,13 +53,16 @@ def create(template: dict):
53
53
  return _client.post(url=url, json=template)
54
54
 
55
55
 
56
+ def patch(id: str, org_id: str, patch_to: dict, **kwargs):
57
+ url = f"/v1/templates/{id}?org_id={org_id}"
58
+ # print(url)
59
+ # import json
60
+ # print(json.dumps(patch_to))
61
+ return _client.patch(url, json=patch_to)
62
+
63
+
56
64
  def update(template: dict):
57
- url = "/v1/templates"
58
- # workaround for AKKA
59
- if template["providerType"] == "AKKA":
60
- pass
61
- else:
62
- url += "/" + template["providerType"].lower()
65
+ url = "/v1/templates/" + template["providerType"].lower()
63
66
  return _client.post(url=url, json=template)
64
67
 
65
68
 
hcs_cli/service/lcm/vm.py CHANGED
@@ -102,7 +102,6 @@ def wait_for(
102
102
 
103
103
 
104
104
  def wait_for_deleted(template_id: str, vm_id: str, org_id: str, timeout: str):
105
-
106
105
  name = f"{template_id}/{vm_id}"
107
106
 
108
107
  def fn_get():
hcs_cli/service/task.py CHANGED
@@ -114,7 +114,6 @@ _scm_client = hdc_service_client("scm")
114
114
 
115
115
 
116
116
  def query(namespace: str, fn_filter: Callable = None, **kwargs) -> List[TaskModel]:
117
-
118
117
  kwargs["size"] = kwargs.get("size", 50)
119
118
 
120
119
  def _get_page(query_string):
@@ -32,7 +32,7 @@ def delete(id: str, org_id: str, force: bool = True):
32
32
  return _crud.delete(id, org_id, force=force)
33
33
 
34
34
 
35
- def update(id: str, org_id: str, patch_to: dict, **kwargs):
35
+ def patch(id: str, org_id: str, patch_to: dict):
36
36
  url = f"/v2/templates/{id}?org_id={org_id}"
37
37
  # print(url)
38
38
  # import json
@@ -44,7 +44,6 @@ def restart_service(service_name: str, old_pod_id: str):
44
44
 
45
45
 
46
46
  def kubectl_patch(service_name: str, patch_params: list):
47
-
48
47
  service_full_name = get_service_full_name(service_name)
49
48
  # Formulate the Kubernetes patch command
50
49
  patch_command = ["kubectl", "patch", service_full_name] + patch_params
@@ -22,7 +22,6 @@ from hcs_core.plan import PlanException
22
22
 
23
23
 
24
24
  def load_plan(file):
25
-
26
25
  if not file:
27
26
  file = _try_locating_plan_file()
28
27
  else:
@@ -2,6 +2,7 @@ import json
2
2
  import os
3
3
  import os.path as path
4
4
  import sys
5
+ from typing import cast
5
6
 
6
7
 
7
8
  def load(name: str, as_json: bool = False) -> str:
@@ -11,7 +12,7 @@ def load(name: str, as_json: bool = False) -> str:
11
12
  if path.exists(file_name):
12
13
  with open(file_name, "rt") as f:
13
14
  if as_json:
14
- return json.load(f)
15
+ return cast(str, json.load(f))
15
16
  return f.read()
16
17
 
17
18
  # payload file not found.
@@ -24,6 +25,8 @@ def load(name: str, as_json: bool = False) -> str:
24
25
  continue
25
26
  if file.endswith(".json"):
26
27
  file = file[:-5]
28
+ elif file.endswith(".json.template"):
29
+ file = file[:-14]
27
30
  items.append(file)
28
31
  items.sort()
29
32
  for file in items:
@@ -7,7 +7,6 @@ from typing import Callable
7
7
  def with_template_file(
8
8
  name: str, substitutions: dict, fn: Callable, base_path: str = None, use_temp_file: bool = False, delete_after: bool = False
9
9
  ):
10
-
11
10
  if base_path:
12
11
  if os.path.isfile(base_path):
13
12
  base_path = os.path.dirname(os.path.realpath(base_path))
@@ -16,7 +16,7 @@ limitations under the License.
16
16
  import json
17
17
  import os
18
18
  import subprocess
19
- from typing import Callable
19
+ from typing import Any, Callable
20
20
  from unittest import TestCase
21
21
 
22
22
 
@@ -68,7 +68,7 @@ class CliTest(TestCase):
68
68
  def verify(
69
69
  self,
70
70
  cmd: str,
71
- expected_stdout: any,
71
+ expected_stdout: Any,
72
72
  expected_return_code: int = 0,
73
73
  expect_stderr_empty: bool = True,
74
74
  verify_stderr: Callable = None,