hcs-core 0.1.298__tar.gz → 0.1.299__tar.gz

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 (71) hide show
  1. {hcs_core-0.1.298 → hcs_core-0.1.299}/PKG-INFO +1 -1
  2. hcs_core-0.1.299/hcs_core/__init__.py +1 -0
  3. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/cli_processor.py +1 -1
  4. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/jsondot.py +1 -1
  5. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/profile.py +1 -1
  6. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/telemetry.py +1 -1
  7. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/util.py +34 -17
  8. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/dag.py +0 -1
  9. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/auth.py +1 -1
  10. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/cli_options.py +13 -1
  11. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/client_util.py +5 -1
  12. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/ez_client.py +1 -1
  13. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/utils.py +4 -1
  14. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/check_license.py +0 -2
  15. hcs_core-0.1.298/hcs_core/__init__.py +0 -1
  16. {hcs_core-0.1.298 → hcs_core-0.1.299}/.gitignore +0 -0
  17. {hcs_core-0.1.298 → hcs_core-0.1.299}/README.md +0 -0
  18. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/__init__.py +0 -0
  19. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/_init.py +0 -0
  20. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/built_in_cmds/__init__.py +0 -0
  21. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/built_in_cmds/_ut.py +0 -0
  22. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/built_in_cmds/context.py +0 -0
  23. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/built_in_cmds/profile.py +0 -0
  24. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/cli_options.py +0 -0
  25. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/cmd_util.py +0 -0
  26. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/config.py +0 -0
  27. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/context.py +0 -0
  28. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/data_util.py +0 -0
  29. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/dispatcher.py +0 -0
  30. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/duration.py +0 -0
  31. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/extension.py +0 -0
  32. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/fn_util.py +0 -0
  33. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/fstore.py +0 -0
  34. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/logger.py +0 -0
  35. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/profile_store.py +0 -0
  36. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/recent.py +0 -0
  37. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/state.py +0 -0
  38. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/task_schd.py +0 -0
  39. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/template_util.py +0 -0
  40. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/timeutil.py +0 -0
  41. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/ctxp/var_template.py +0 -0
  42. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/__init__.py +0 -0
  43. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/actions.py +0 -0
  44. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/base_provider.py +0 -0
  45. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/context.py +0 -0
  46. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/core.py +0 -0
  47. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/helper.py +0 -0
  48. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/kop.py +0 -0
  49. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/provider/__init__.py +0 -0
  50. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/provider/dev/__init__.py +0 -0
  51. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/provider/dev/_prepare.py +0 -0
  52. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/provider/dev/dummy.py +0 -0
  53. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/plan/provider/dev/fibonacci.py +0 -0
  54. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/__init__.py +0 -0
  55. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/csp.py +0 -0
  56. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/hcs_client.py +0 -0
  57. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/init.py +0 -0
  58. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/login_support.py +0 -0
  59. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/payload_util.py +0 -0
  60. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/sglib/requtil.py +0 -0
  61. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/__init__.py +0 -0
  62. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/duration.py +0 -0
  63. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/exit.py +0 -0
  64. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/hcs_constants.py +0 -0
  65. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/job_view.py +0 -0
  66. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/pki_util.py +0 -0
  67. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/query_util.py +0 -0
  68. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/scheduler.py +0 -0
  69. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/ssl_util.py +0 -0
  70. {hcs_core-0.1.298 → hcs_core-0.1.299}/hcs_core/util/versions.py +0 -0
  71. {hcs_core-0.1.298 → hcs_core-0.1.299}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hcs-core
3
- Version: 0.1.298
3
+ Version: 0.1.299
4
4
  Summary: Horizon Cloud Service CLI module.
5
5
  Project-URL: Homepage, https://github.com/euc-eng/hcs-cli
6
6
  Project-URL: Bug Tracker, https://github.com/euc-eng/hcs-cli/issues
@@ -0,0 +1 @@
1
+ __version__ = "0.1.299"
@@ -181,7 +181,7 @@ def _default_io(cmd: click.Command):
181
181
  def inner(*args, **kwargs):
182
182
  io_args = {
183
183
  "output": kwargs.pop("output"),
184
- #'verbose': kwargs.pop('verbose'),
184
+ # 'verbose': kwargs.pop('verbose'),
185
185
  "field": kwargs.pop("field"),
186
186
  "ids": kwargs.pop("ids"),
187
187
  "first": kwargs.pop("first"),
@@ -40,7 +40,7 @@ import json
40
40
  import os.path
41
41
  import random
42
42
  import time
43
- from typing import Any, Dict, List, Optional, Union
43
+ from typing import Any, Dict, Optional, Union
44
44
 
45
45
 
46
46
  class dotdict(dict):
@@ -20,7 +20,7 @@ from copy import deepcopy
20
20
  from typing import Any
21
21
 
22
22
  from . import state
23
- from .data_util import deep_get_attr, deep_set_attr, load_data_file, save_data_file
23
+ from .data_util import deep_set_attr, load_data_file, save_data_file
24
24
  from .jsondot import dotdict, dotify
25
25
  from .util import CtxpException, panic
26
26
 
@@ -132,7 +132,7 @@ def _injest(doc):
132
132
 
133
133
  try:
134
134
  response = httpx.post(
135
- f"https://collie.omnissa.com/es/hcs-cli/_doc",
135
+ "https://collie.omnissa.com/es/hcs-cli/_doc",
136
136
  auth=("append_user", "public"),
137
137
  headers={"Content-Type": "application/json"},
138
138
  content=json.dumps(doc),
@@ -125,7 +125,7 @@ def print_output(data: Any, args: dict, file=sys.stdout):
125
125
 
126
126
 
127
127
  def print_error(error):
128
- critical_errors = [KeyError, TypeError, AttributeError, ValueError]
128
+ critical_errors = [KeyError, TypeError, AttributeError, ValueError, IndentationError]
129
129
  for ex in critical_errors:
130
130
  if isinstance(error, ex):
131
131
  traceback.print_exception(type(error), error, error.__traceback__, file=sys.stderr)
@@ -219,7 +219,11 @@ def choose(prompt: str, items: list, fn_get_text: Callable = None, selected=None
219
219
  panic(prompt + " ERROR: no item available.")
220
220
 
221
221
  if fn_get_text is None:
222
- fn_get_text = lambda t: str(t)
222
+
223
+ def _default_fn_get_text(t):
224
+ return str(t)
225
+
226
+ fn_get_text = _default_fn_get_text
223
227
 
224
228
  if select_by_default and len(items) == 1:
225
229
  ret = items[0]
@@ -258,24 +262,37 @@ def input_array(prompt: str, default: list[str] = None):
258
262
  return ret
259
263
 
260
264
 
261
- def error_details(e):
262
- if isinstance(e, Exception):
263
- if isinstance(e, CtxpException):
264
- details = str(e)
265
- else:
266
- details = e.__class__.__name__
267
- msg = str(e)
268
- if msg:
269
- details += ": " + msg
270
- cause = e.__cause__
271
- if cause and cause != e:
272
- details += " | Caused by: " + error_details(cause)
265
+ def error_details(ex):
266
+ if not isinstance(ex, Exception):
267
+ return str(ex)
268
+
269
+ collector = []
270
+
271
+ def _collect_details(e):
272
+ if isinstance(e, click.ClickException):
273
+ collector.append(str(e))
274
+ return
273
275
 
276
+ details = e.__class__.__name__
277
+ msg = str(e)
278
+ if msg:
279
+ details += ": " + msg
274
280
  if isinstance(e, httpx.HTTPStatusError):
275
281
  details += "\n" + e.response.text
276
- return details
277
- else:
278
- return str(e)
282
+ collector.append(details)
283
+
284
+ cause = e.__cause__
285
+ if cause and cause != e:
286
+ _collect_details(cause)
287
+
288
+ _collect_details(ex)
289
+
290
+ # remove_consecutive_duplicates
291
+ result = [collector[0]]
292
+ for item in collector[1:]:
293
+ if item != result[-1]:
294
+ result.append(item)
295
+ return " | Caused by: ".join(result)
279
296
 
280
297
 
281
298
  def avoid_trace_for_ctrl_c():
@@ -15,7 +15,6 @@ limitations under the License.
15
15
 
16
16
  import threading
17
17
  import time
18
- import traceback
19
18
  from concurrent.futures import ThreadPoolExecutor
20
19
  from copy import deepcopy
21
20
  from graphlib import TopologicalSorter
@@ -22,7 +22,7 @@ import time
22
22
  import jwt
23
23
  from authlib.integrations.httpx_client import OAuth2Client
24
24
 
25
- from hcs_core.ctxp import CtxpException, panic, profile
25
+ from hcs_core.ctxp import CtxpException, profile
26
26
  from hcs_core.ctxp.jsondot import dotdict, dotify
27
27
 
28
28
  from .csp import CspClient
@@ -18,7 +18,19 @@ import os
18
18
  import click
19
19
 
20
20
  from hcs_core.ctxp import CtxpException, recent
21
- from hcs_core.ctxp.cli_options import *
21
+ from hcs_core.ctxp.cli_options import confirm as confirm
22
+ from hcs_core.ctxp.cli_options import exclude_field as exclude_field
23
+ from hcs_core.ctxp.cli_options import field as field
24
+ from hcs_core.ctxp.cli_options import first as first
25
+ from hcs_core.ctxp.cli_options import force as force
26
+ from hcs_core.ctxp.cli_options import formatter as formatter
27
+ from hcs_core.ctxp.cli_options import ids as ids
28
+ from hcs_core.ctxp.cli_options import limit as limit
29
+ from hcs_core.ctxp.cli_options import output as output
30
+ from hcs_core.ctxp.cli_options import search as search
31
+ from hcs_core.ctxp.cli_options import sort as sort
32
+ from hcs_core.ctxp.cli_options import verbose as verbose
33
+ from hcs_core.ctxp.cli_options import wait as wait
22
34
 
23
35
  org_id = click.option(
24
36
  "--org",
@@ -261,7 +261,10 @@ class default_crud:
261
261
 
262
262
  def wait_for_deleted(self, id: str, org_id: str, timeout: str, fn_is_error: Callable = None):
263
263
  name = self._resource_type_name + "/" + id
264
- fn_get = lambda: self.get(id, org_id)
264
+
265
+ def fn_get():
266
+ return self.get(id, org_id)
267
+
265
268
  return wait_for_res_deleted(name, fn_get, timeout=timeout, fn_is_error=fn_is_error)
266
269
 
267
270
  def update(self, id: str, org_id: str, data: dict, **kwargs):
@@ -310,6 +313,7 @@ def wait_for_res_deleted(
310
313
  exit.sleep(sleep_seconds)
311
314
 
312
315
 
316
+ # flake8: noqa=E731
313
317
  def wait_for_res_status(
314
318
  resource_name: str,
315
319
  fn_get: Callable,
@@ -19,7 +19,7 @@ import os
19
19
  import sys
20
20
  import threading
21
21
  from http.client import HTTPResponse
22
- from typing import Callable, Optional, Type, Union
22
+ from typing import Callable, Optional, Type
23
23
 
24
24
  import httpx
25
25
  from authlib.integrations.httpx_client import OAuth2Client
@@ -65,7 +65,10 @@ def run_govc_guest_script(script, args):
65
65
 
66
66
 
67
67
  def waitForVmPowerOff(iPath):
68
- current_millis = lambda: int(round(time.time() * 1000))
68
+
69
+ def current_millis():
70
+ return int(round(time.time() * 1000))
71
+
69
72
  start_time = current_millis()
70
73
  while current_millis() - start_time < 5 * 60 * 1000:
71
74
  p = subprocess.run(
@@ -13,8 +13,6 @@ See the License for the specific language governing permissions and
13
13
  limitations under the License.
14
14
  """
15
15
 
16
- #!/usr/bin/env -S python -W ignore
17
-
18
16
  import os
19
17
  import sys
20
18
 
@@ -1 +0,0 @@
1
- __version__ = "0.1.298"
File without changes
File without changes
File without changes