hcs-core 0.1.286__tar.gz → 0.1.288__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.
- {hcs_core-0.1.286 → hcs_core-0.1.288}/PKG-INFO +2 -1
- hcs_core-0.1.288/hcs_core/__init__.py +1 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/cli_options.py +1 -1
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/data_util.py +19 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/profile.py +0 -1
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/recent.py +2 -2
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/task_schd.py +0 -2
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/util.py +16 -3
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/auth.py +6 -1
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/ez_client.py +2 -1
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/login_support.py +1 -4
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/versions.py +2 -2
- {hcs_core-0.1.286 → hcs_core-0.1.288}/pyproject.toml +1 -0
- hcs_core-0.1.286/hcs_core/__init__.py +0 -1
- {hcs_core-0.1.286 → hcs_core-0.1.288}/.gitignore +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/README.md +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/_init.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/_ut.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/context.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/built_in_cmds/profile.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/cli_processor.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/cmd_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/config.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/context.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/dispatcher.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/duration.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/extension.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/fn_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/fstore.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/jsondot.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/logger.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/profile_store.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/state.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/template_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/timeutil.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/ctxp/var_template.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/actions.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/base_provider.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/context.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/core.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/dag.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/helper.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/kop.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/provider/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/_prepare.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/dummy.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/plan/provider/dev/fibonacci.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/cli_options.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/client_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/csp.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/hcs_client.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/init.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/payload_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/requtil.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/sglib/utils.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/__init__.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/check_license.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/duration.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/exit.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/hcs_constants.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/job_view.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/pki_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/query_util.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/scheduler.py +0 -0
- {hcs_core-0.1.286 → hcs_core-0.1.288}/hcs_core/util/ssl_util.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hcs-core
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.288
|
|
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
|
|
@@ -40,6 +40,7 @@ Provides-Extra: dev
|
|
|
40
40
|
Requires-Dist: bandit; extra == 'dev'
|
|
41
41
|
Requires-Dist: black; extra == 'dev'
|
|
42
42
|
Requires-Dist: build; extra == 'dev'
|
|
43
|
+
Requires-Dist: flake8; extra == 'dev'
|
|
43
44
|
Requires-Dist: mypy; extra == 'dev'
|
|
44
45
|
Requires-Dist: pylint; extra == 'dev'
|
|
45
46
|
Requires-Dist: pytest; extra == 'dev'
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.288"
|
|
@@ -27,7 +27,7 @@ verbose = click.option(
|
|
|
27
27
|
output = click.option(
|
|
28
28
|
"--output",
|
|
29
29
|
"-o",
|
|
30
|
-
type=click.Choice(["json", "json-compact", "yaml", "text", "table"]),
|
|
30
|
+
type=click.Choice(["json", "json-compact", "yaml", "text", "table"], case_sensitive=False),
|
|
31
31
|
default=None,
|
|
32
32
|
hidden=True,
|
|
33
33
|
help="Specify output format",
|
|
@@ -391,6 +391,25 @@ def get_common_items(iter1, iter2):
|
|
|
391
391
|
return common_items
|
|
392
392
|
|
|
393
393
|
|
|
394
|
+
def get_delta(dict_base, dict_update):
|
|
395
|
+
delta = {}
|
|
396
|
+
for k, v2 in dict_update.items():
|
|
397
|
+
v1 = dict_base.get(k)
|
|
398
|
+
if not deep_equals(v1, v2):
|
|
399
|
+
delta[k] = v2
|
|
400
|
+
return delta
|
|
401
|
+
|
|
402
|
+
|
|
403
|
+
def deep_equals(v1, v2):
|
|
404
|
+
if v1 is None and v2 is None:
|
|
405
|
+
return True
|
|
406
|
+
if v1 is None or v2 is None:
|
|
407
|
+
return False
|
|
408
|
+
if v1 == v2:
|
|
409
|
+
return True
|
|
410
|
+
return json.dumps(v1) == json.dumps(v2)
|
|
411
|
+
|
|
412
|
+
|
|
394
413
|
def _evaluate(value, smart_search):
|
|
395
414
|
# If we found an exact match, return 2 immediately
|
|
396
415
|
if value == smart_search:
|
|
@@ -79,9 +79,9 @@ def of(k: str):
|
|
|
79
79
|
|
|
80
80
|
class helper:
|
|
81
81
|
@staticmethod
|
|
82
|
-
def default_list(array: list, name: str):
|
|
82
|
+
def default_list(array: list, name: str, field_name: str = "id"):
|
|
83
83
|
with of(name) as r:
|
|
84
84
|
if len(array) == 1:
|
|
85
|
-
r.set(array[0][
|
|
85
|
+
r.set(array[0][field_name])
|
|
86
86
|
else:
|
|
87
87
|
r.unset()
|
|
@@ -111,7 +111,6 @@ def statistics(reset_cycle: bool = False):
|
|
|
111
111
|
|
|
112
112
|
def _daemon_worker():
|
|
113
113
|
log.info("task scheduler daemon thread start")
|
|
114
|
-
global _g_flag_stop_daemon
|
|
115
114
|
while not _g_flag_stop_daemon.is_set():
|
|
116
115
|
if _g_flag_running:
|
|
117
116
|
schedule.run_pending()
|
|
@@ -149,7 +148,6 @@ def resume():
|
|
|
149
148
|
|
|
150
149
|
|
|
151
150
|
def stop_daemon():
|
|
152
|
-
global _g_flag_stop_daemon
|
|
153
151
|
global _g_worker_thread
|
|
154
152
|
if _g_worker_thread:
|
|
155
153
|
_g_flag_stop_daemon.set()
|
|
@@ -89,7 +89,18 @@ def print_output(data: Any, args: dict, file=sys.stdout):
|
|
|
89
89
|
if isinstance(data, list):
|
|
90
90
|
text = ""
|
|
91
91
|
for i in data:
|
|
92
|
-
|
|
92
|
+
t = type(i)
|
|
93
|
+
if t is str:
|
|
94
|
+
line = i
|
|
95
|
+
elif isinstance(i, dict):
|
|
96
|
+
if len(i) == 0:
|
|
97
|
+
continue
|
|
98
|
+
if len(i) == 1:
|
|
99
|
+
line = str(next(iter(i.values())))
|
|
100
|
+
else:
|
|
101
|
+
line = json.dumps(i)
|
|
102
|
+
else:
|
|
103
|
+
line = json.dumps(i)
|
|
93
104
|
text += line + "\n"
|
|
94
105
|
elif isinstance(data, dict):
|
|
95
106
|
text = json.dumps(data, indent=4)
|
|
@@ -319,10 +330,12 @@ def format_table(data: list, fields_mapping: dict, columns_to_sum: list = None):
|
|
|
319
330
|
if isinstance(v, str):
|
|
320
331
|
v = strip_ansi(v)
|
|
321
332
|
v = int(v)
|
|
322
|
-
elif isinstance(v, int):
|
|
333
|
+
elif isinstance(v, int) or isinstance(v, float):
|
|
323
334
|
pass
|
|
335
|
+
elif v is None:
|
|
336
|
+
continue
|
|
324
337
|
else:
|
|
325
|
-
raise Exception(f"Unexpected cell value type. Type={type(v)}, value={v}")
|
|
338
|
+
raise Exception(f"Unexpected cell value type. Type={type(v)}, value={v}, col={col_name}")
|
|
326
339
|
total += v
|
|
327
340
|
footer[col_index] = total
|
|
328
341
|
separator = ["-" * len(header) for header in headers]
|
|
@@ -125,12 +125,17 @@ def _get_new_oauth_token(old_oauth_token, effective_profile):
|
|
|
125
125
|
def refresh_oauth_token(old_oauth_token: dict, csp_url: str):
|
|
126
126
|
with OAuth2Client(token=old_oauth_token) as client:
|
|
127
127
|
log.debug("Refresh auth token...")
|
|
128
|
-
|
|
128
|
+
token_url = csp_url + "/csp/gateway/am/api/auth/token"
|
|
129
|
+
from .login_support import identify_client_id
|
|
130
|
+
|
|
131
|
+
csp_specific_req_not_oauth_standard = (identify_client_id(csp_url), "")
|
|
132
|
+
new_token = client.refresh_token(token_url, auth=csp_specific_req_not_oauth_standard)
|
|
129
133
|
log.debug(f"New auth token: {new_token}")
|
|
130
134
|
if not new_token:
|
|
131
135
|
raise Exception("CSP auth refresh failed.")
|
|
132
136
|
if "cspErrorCode" in new_token:
|
|
133
137
|
raise Exception(f"CSP auth failed: {new_token.get('message')}")
|
|
138
|
+
|
|
134
139
|
return new_token
|
|
135
140
|
|
|
136
141
|
|
|
@@ -173,11 +173,12 @@ class EzClient:
|
|
|
173
173
|
files=None,
|
|
174
174
|
headers: dict = None,
|
|
175
175
|
type: Optional[Type[BaseModel]] = None,
|
|
176
|
+
timeout: float = 30.0,
|
|
176
177
|
):
|
|
177
178
|
# import json as jsonlib
|
|
178
179
|
# print(url, jsonlib.dumps(json, indent=4))
|
|
179
180
|
try:
|
|
180
|
-
resp = self._client().post(url, json=json, content=text, files=files, headers=headers)
|
|
181
|
+
resp = self._client().post(url, json=json, content=text, files=files, headers=headers, timeout=timeout)
|
|
181
182
|
except httpx.HTTPStatusError as e:
|
|
182
183
|
_raise_http_error(e)
|
|
183
184
|
data = _parse_resp(resp)
|
|
@@ -19,17 +19,13 @@ limitations under the License.
|
|
|
19
19
|
import logging
|
|
20
20
|
import secrets
|
|
21
21
|
import threading
|
|
22
|
-
import time
|
|
23
22
|
import webbrowser
|
|
24
23
|
from http.server import BaseHTTPRequestHandler, HTTPServer
|
|
25
|
-
from typing import Callable
|
|
26
24
|
from urllib.parse import parse_qs, urlparse
|
|
27
25
|
|
|
28
26
|
from authlib.integrations.httpx_client import OAuth2Client
|
|
29
27
|
from authlib.oauth2.rfc7636 import create_s256_code_challenge
|
|
30
28
|
|
|
31
|
-
from hcs_core.util.scheduler import ThreadPoolScheduler
|
|
32
|
-
|
|
33
29
|
log = logging.getLogger(__name__)
|
|
34
30
|
|
|
35
31
|
_server_address = ("127.0.0.1", 10762)
|
|
@@ -37,6 +33,7 @@ _callback_url = "/hcs-cli/oauth/callback"
|
|
|
37
33
|
|
|
38
34
|
_public_client_ids = {
|
|
39
35
|
"production": "ldjmWbBAUcSB1w3HSbzoYcdKoloYFqT2dWK",
|
|
36
|
+
# "production": "WbvEYXK4abljPJUuY2zODLpOaX5ddH2uhMX", #collie mobile
|
|
40
37
|
"staging": "BbwHlgWt0vFwPUZMJTb5IKltynXjDmb46IO",
|
|
41
38
|
}
|
|
42
39
|
|
|
@@ -15,9 +15,9 @@ limitations under the License.
|
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
17
|
import time
|
|
18
|
+
from importlib.metadata import version
|
|
18
19
|
|
|
19
20
|
import httpx
|
|
20
|
-
import pkg_resources
|
|
21
21
|
from packaging.version import Version
|
|
22
22
|
|
|
23
23
|
import hcs_core
|
|
@@ -43,7 +43,7 @@ def check_upgrade():
|
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
def get_version():
|
|
46
|
-
return
|
|
46
|
+
return version("hcs-cli")
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def get_latest_version() -> Version:
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.1.286"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|