hcs-core 0.1.298__py3-none-any.whl → 0.1.299__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.
hcs_core/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.298"
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"),
hcs_core/ctxp/jsondot.py CHANGED
@@ -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):
hcs_core/ctxp/profile.py CHANGED
@@ -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),
hcs_core/ctxp/util.py CHANGED
@@ -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():
hcs_core/plan/dag.py CHANGED
@@ -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
hcs_core/sglib/auth.py CHANGED
@@ -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
hcs_core/sglib/utils.py CHANGED
@@ -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,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
@@ -1,8 +1,8 @@
1
- hcs_core/__init__.py,sha256=iCAiJetE04YjkRvTLJlNnalMA2Qh13pOV7pEpnXQOBk,24
1
+ hcs_core/__init__.py,sha256=GpdjEeALGMW6qJfqyqcdC69cW0JEVBcd54HdLO6cyNQ,24
2
2
  hcs_core/ctxp/__init__.py,sha256=bHVHhJP10Luz1a3Kk3zFx14dAO4SY6Q20Lrv8rNWWGc,1075
3
3
  hcs_core/ctxp/_init.py,sha256=fMcRMPfJx-N0c-u0Zj2sFVKQL1-lWQd28gooAZETGUA,2933
4
4
  hcs_core/ctxp/cli_options.py,sha256=cwlUgYXzIie9eRcu8fkBo_iFvC8LhflKGblWYtM2Hto,2739
5
- hcs_core/ctxp/cli_processor.py,sha256=uxWqDecENdO8xd7ghR0wz10qwsroCZ93OtZAqtIFuJ8,7655
5
+ hcs_core/ctxp/cli_processor.py,sha256=X4Qg5fXsg1HuDcdFCDZg7bdnxszGMJGdT3MhnP8LmUY,7656
6
6
  hcs_core/ctxp/cmd_util.py,sha256=_-VwQSmkfi52qWC3uHQI06mSiIPfsZroDruTDYHXiMA,3119
7
7
  hcs_core/ctxp/config.py,sha256=vRdzPxi3Yrt04cnR6b5mJwEOtYBh21qvmlSSsgyGoI4,931
8
8
  hcs_core/ctxp/context.py,sha256=LafhucyGRGYLmnXoZLZOKRWXUwJ1KzP-6vjDTTrC8j4,3451
@@ -12,17 +12,17 @@ hcs_core/ctxp/duration.py,sha256=_0mt8Ng5mzNzEdSXkOqExPOzQcw8HkQDUH_hwt5CMLM,210
12
12
  hcs_core/ctxp/extension.py,sha256=UqlDCXJMRKXcoceVak8hVGI_7HggjUWYSgKOFbGVetU,1636
13
13
  hcs_core/ctxp/fn_util.py,sha256=bEYmj5WgUkRE5S4oQjT_zutuViXWYU9q5MR-MlTA_bY,1573
14
14
  hcs_core/ctxp/fstore.py,sha256=lU6et0-w_QPYpQNjdA0QGEdnn7lsmBVuw9XbDvLjwso,8977
15
- hcs_core/ctxp/jsondot.py,sha256=U2_ToR8j3-hex75X3OSqTgADiw5cqjRDVO38-IbvapM,11369
15
+ hcs_core/ctxp/jsondot.py,sha256=LuAejJTW2IJixNl4lLEc47yWX9MMKHgMcZmRugW4ftQ,11363
16
16
  hcs_core/ctxp/logger.py,sha256=xujPlxw7JGimI_u_sMXnqTOhOTCtrXzpc7501k3Dgm4,6323
17
- hcs_core/ctxp/profile.py,sha256=X9ZT3mV-0PwRaieQp58dfmL6-KTj0exthppnhipp6uk,7744
17
+ hcs_core/ctxp/profile.py,sha256=scPibaqPzCD-wnSQ6nDq55nd4QppvzvVQ431n8kvRUg,7729
18
18
  hcs_core/ctxp/profile_store.py,sha256=v4RvKSaKSJhAt5rEGbC6v-NfaI3N67YffPm-qlrQWdg,1566
19
19
  hcs_core/ctxp/recent.py,sha256=ER1HASPRm1k_3MIO-WVbj2vGipY565ZpBlmo-_V3vjo,1797
20
20
  hcs_core/ctxp/state.py,sha256=gjcMRVONKBq7WiFQo-xca1726ngZe90mnPrF3vbXDrU,1634
21
21
  hcs_core/ctxp/task_schd.py,sha256=mvZMeKDSSo2p7VidSoZY1XZj433TQn_YF9SGJEzl9lg,4586
22
- hcs_core/ctxp/telemetry.py,sha256=iZv9x2n2aovpjYxNhnih_LS1fEJZjH_rbTsRKngv_Q0,3477
22
+ hcs_core/ctxp/telemetry.py,sha256=tSjI_8OE2Ix3n--YHAO9sPmzi8ETbFHEPxzS52-usmM,3476
23
23
  hcs_core/ctxp/template_util.py,sha256=XslvIuRBlTVsUW0Y9M_D8gUPc1jWq6X2p4At2VAe1KU,731
24
24
  hcs_core/ctxp/timeutil.py,sha256=RyRrIRdFHbIghdB8wbC8VdABvc7hki2v51b1x2JvHgo,445
25
- hcs_core/ctxp/util.py,sha256=ckPyheoS08-bP4aixtBhYwi-C6syjFA6UHyIL6cUsPs,12350
25
+ hcs_core/ctxp/util.py,sha256=NZrsFS5wi10_rIIC45go-nZOimB04_Npbwo7O7LIaoY,12699
26
26
  hcs_core/ctxp/var_template.py,sha256=cTjj1UJ58ac6s5z4Oh5hSDQwKixq-rdbCF1D8akjAo0,3219
27
27
  hcs_core/ctxp/built_in_cmds/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
28
  hcs_core/ctxp/built_in_cmds/_ut.py,sha256=e50XBmPim2qRe0RYk_XAuRz1HWYyLJuMu-6dVxWR_fQ,3356
@@ -33,7 +33,7 @@ hcs_core/plan/actions.py,sha256=UvCynzApJUxi39HUoPIQ_uownlbvFbJ4aAs6pmulrLY,125
33
33
  hcs_core/plan/base_provider.py,sha256=CSJFN8lopWTUblw8CW78Epnef9BbJVLhPLk9bPfZceM,1299
34
34
  hcs_core/plan/context.py,sha256=5NI5Otk0jGKtBGvO8Sc1xdOHUCu_lXQYNrSctT3Hyq8,116
35
35
  hcs_core/plan/core.py,sha256=HI9uhZBzxngMTvum2GwzgLpx8bEe6M3JgAxl5CiJywU,21622
36
- hcs_core/plan/dag.py,sha256=pyyoMSmbhCsS8BMZI6hW6YDkHqBgjmJOwys9CUDrIts,12926
36
+ hcs_core/plan/dag.py,sha256=McvJnOIJOQzfa1TMdG3Nvw2tV12JBhNKaeJ_Fk8iEXA,12909
37
37
  hcs_core/plan/helper.py,sha256=__b8tlzLBT1Rm3vgiS-pWnZImaoZbsmKSRJtt_1gj8E,7763
38
38
  hcs_core/plan/kop.py,sha256=iDnRbYHFCtS3Rs95UVvRgZdSzs-NMwdyr8SztIQQqyg,5774
39
39
  hcs_core/plan/provider/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -42,19 +42,19 @@ hcs_core/plan/provider/dev/_prepare.py,sha256=PvVnheEQwpj8sWYz2lDONQVTs4pHPYuo2c
42
42
  hcs_core/plan/provider/dev/dummy.py,sha256=zKEr9J4WHhlN5gFdmrFyEfCF0xlQlCJg0CC1dG9VaLA,1958
43
43
  hcs_core/plan/provider/dev/fibonacci.py,sha256=8WhDr5c9harNAlVPZomQJEqbWe0hUqbppO6ZkwEUcJ0,1104
44
44
  hcs_core/sglib/__init__.py,sha256=oT0etW7vsEbHlXiGL5x23ZXyyFqeLi81RxQQ5lfKSV0,654
45
- hcs_core/sglib/auth.py,sha256=x2LjNCOTf_OJYsNggTG2rVagnVartyDCOlK4lSpXfso,6773
46
- hcs_core/sglib/cli_options.py,sha256=NvdiHpX_o6IYPEM8cQYLb_R7T4aiXVvYLqn6Vk4Q2-Y,1761
47
- hcs_core/sglib/client_util.py,sha256=t7zCldRRWt5f0l4TTRhmX-ZIaEm6MzNs_3B2RlwtXfk,14119
45
+ hcs_core/sglib/auth.py,sha256=r9zgLdnybuHsf3_j6nTP4SGoS2dD3keYZ-c25o2Mx64,6766
46
+ hcs_core/sglib/cli_options.py,sha256=dEoUllUs_N97jGtc3mccNgbkVJILfuJR4FHSuVGmSf0,2438
47
+ hcs_core/sglib/client_util.py,sha256=ia4krU7xrMH4G_enOu5xFXIHY8I2besKn6ubayPxi58,14157
48
48
  hcs_core/sglib/csp.py,sha256=UcO68YtLOPDQWiTjPVIPwQ2Z-Mywc-154aoIkLdyzwE,10991
49
- hcs_core/sglib/ez_client.py,sha256=AgpWvB79NLWr_lyrZXbaY1iOyHg7hEgeM6Ll0SVCBmY,8411
49
+ hcs_core/sglib/ez_client.py,sha256=dWQx-EMTrySz1EVzsSu4ZezORR3_iEOAcZigtbuvIQ8,8404
50
50
  hcs_core/sglib/hcs_client.py,sha256=pjrAVQDEy2tiQMypMpOzODFntT6aNHXjje8or_mkL2U,804
51
51
  hcs_core/sglib/init.py,sha256=w_0ZU70Q1TGbSZsqSi7ewKQqpExFlepOT7mIqH0wnho,310
52
52
  hcs_core/sglib/login_support.py,sha256=rHKZDAZXlo62IsjETyXxCSPxg1L4nV6ffZM_tulfe0A,7574
53
53
  hcs_core/sglib/payload_util.py,sha256=Hnj7rjzrQ1j5gpbrwZX34biN8MIZjy6dOJZ63ulmzdw,685
54
54
  hcs_core/sglib/requtil.py,sha256=O37DrD4VVBmmRkkHJLbDtPfFq8l6fLZwYZggt2FTEFc,920
55
- hcs_core/sglib/utils.py,sha256=FLgB8M5EiS3WhCzX5xUA9aFzB5jKQI8pqxtrmE4SsjQ,3164
55
+ hcs_core/sglib/utils.py,sha256=8a-e-nUhAbulZtV05CB5loov6Kgq8_Q0TxYwfvu7Bj8,3178
56
56
  hcs_core/util/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
57
- hcs_core/util/check_license.py,sha256=-ZBMVoVcEUwICZ0QRK-e2uMMla7gFbjP9upun93lPEc,2534
57
+ hcs_core/util/check_license.py,sha256=KUPaphuntMhwqcBJ6V2L85ZJZulaz1Yq5Ysurx2Ren8,2498
58
58
  hcs_core/util/duration.py,sha256=e7Nw22aYXJK-pLM59QDel5atLZxShKBiVILFgrtLJks,4194
59
59
  hcs_core/util/exit.py,sha256=UStMZKlfCFN7GBouc1y3pPFGPFQ66qfcRZ_fYQXFD0E,838
60
60
  hcs_core/util/hcs_constants.py,sha256=Ic1Tx_UNJiQchfsdnRDzgiOaCjKHnsWXx997nElppm4,1755
@@ -64,6 +64,6 @@ hcs_core/util/query_util.py,sha256=5bh3bUVIQuY9qerndfuyfyzkTExYJ8zD0_e3PSN7y-4,3
64
64
  hcs_core/util/scheduler.py,sha256=bPpCmGUL1UctJMfLPAg-h4Hl2YZr96FiI78-G_Usn08,2958
65
65
  hcs_core/util/ssl_util.py,sha256=MvU102fGwWWh9hhSmLnn1qQIWuD6TjZnN0iH0MXUtW0,1239
66
66
  hcs_core/util/versions.py,sha256=6nyyZzi3P69WQfioPc2_YWZQcUc13mC1eKoK58b3WUQ,1709
67
- hcs_core-0.1.298.dist-info/METADATA,sha256=id4wfYatf5BOeT96YpnWpGnoXpSt_cB3eTn56JDZVws,1951
68
- hcs_core-0.1.298.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
69
- hcs_core-0.1.298.dist-info/RECORD,,
67
+ hcs_core-0.1.299.dist-info/METADATA,sha256=e_XvO_Hb4AtU35-ZRwoPDcgWHpEdzszA_L5ebn9qXTg,1951
68
+ hcs_core-0.1.299.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
69
+ hcs_core-0.1.299.dist-info/RECORD,,