atk-common 1.58.0__py3-none-any.whl → 1.60.0__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.
- atk_common/__init__.py +3 -2
- atk_common/docker_utils.py +3 -2
- atk_common/env_utils.py +15 -10
- {atk_common-1.58.0.dist-info → atk_common-1.60.0.dist-info}/METADATA +1 -1
- {atk_common-1.58.0.dist-info → atk_common-1.60.0.dist-info}/RECORD +8 -8
- {atk_common-1.58.0.dist-info → atk_common-1.60.0.dist-info}/WHEEL +0 -0
- {atk_common-1.58.0.dist-info → atk_common-1.60.0.dist-info}/licenses/license.txt +0 -0
- {atk_common-1.58.0.dist-info → atk_common-1.60.0.dist-info}/top_level.txt +0 -0
atk_common/__init__.py
CHANGED
@@ -9,7 +9,7 @@ from atk_common.datetime_utils import \
|
|
9
9
|
convert_to_utc, \
|
10
10
|
convert_to_utc_image_dt
|
11
11
|
from atk_common.db_utils import sql, sql_with_record, convert_none_to_null, date_time_utc_column
|
12
|
-
from atk_common.docker_utils import get_current_container_info
|
12
|
+
from atk_common.docker_utils import get_current_container_info, set_container_metadata
|
13
13
|
from atk_common.env_utils import get_env_value
|
14
14
|
from atk_common.error_utils import get_message, create_error_log, get_error_entity, resend_error_entity, handle_error, get_response_error, get_error_type
|
15
15
|
from atk_common.http_response_utils import http_response
|
@@ -34,6 +34,8 @@ __all__ = [
|
|
34
34
|
'sql_with_record',
|
35
35
|
'convert_none_to_null',
|
36
36
|
'date_time_utc_column',
|
37
|
+
'get_current_container_info',
|
38
|
+
'set_container_metadata',
|
37
39
|
'get_env_value',
|
38
40
|
'get_message',
|
39
41
|
'create_error_log',
|
@@ -56,5 +58,4 @@ __all__ = [
|
|
56
58
|
'add_log_item_http',
|
57
59
|
'decode_message',
|
58
60
|
'RabbitMQConsumer',
|
59
|
-
'get_current_container_info',
|
60
61
|
]
|
atk_common/docker_utils.py
CHANGED
@@ -60,10 +60,11 @@ def get_current_container_info():
|
|
60
60
|
add_log_item("Error getting container data:" + str(e))
|
61
61
|
return None
|
62
62
|
|
63
|
-
def set_container_metadata(
|
63
|
+
def set_container_metadata(image_name_env_key, image_version_env_key):
|
64
64
|
data = {}
|
65
|
+
image_name = get_env_value(image_name_env_key)
|
65
66
|
data['imageName'] = image_name
|
66
|
-
data['imageVersion'] = get_env_value(image_version_env_key
|
67
|
+
data['imageVersion'] = get_env_value(image_version_env_key)
|
67
68
|
data['containerName'] = image_name
|
68
69
|
create_container_log(data)
|
69
70
|
return data
|
atk_common/env_utils.py
CHANGED
@@ -1,13 +1,18 @@
|
|
1
1
|
import os
|
2
2
|
from atk_common.log_utils import add_log_item
|
3
3
|
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
def val_str(value):
|
5
|
+
if value is None:
|
6
|
+
return 'Empty'
|
7
|
+
if isinstance(value, str):
|
8
|
+
return value
|
9
|
+
return str(value)
|
10
|
+
|
11
|
+
def get_env_value(key, abort_on_error=True):
|
12
|
+
val = os.environ.get(key)
|
13
|
+
if val is None and abort_on_error:
|
14
|
+
err_msg = f"Environment variable '{key}' is not set."
|
15
|
+
add_log_item(err_msg)
|
16
|
+
raise ValueError(err_msg)
|
17
|
+
add_log_item(key + ':' + val_str(val))
|
18
|
+
return val
|
@@ -1,8 +1,8 @@
|
|
1
|
-
atk_common/__init__.py,sha256=
|
1
|
+
atk_common/__init__.py,sha256=mKQGfrr7s2-P4qSkk3NAGZ-nlmogn0JJtGIWEyA7MaI,2213
|
2
2
|
atk_common/datetime_utils.py,sha256=0SC5-Nai4RJH9B0VzvGKUQts_QeRXGb7tJLlsh73LJw,3556
|
3
3
|
atk_common/db_utils.py,sha256=odUtXcS7Mumw5eGyVyVimL_U_lP7TqMX9v8nWO5nMvg,902
|
4
|
-
atk_common/docker_utils.py,sha256=
|
5
|
-
atk_common/env_utils.py,sha256=
|
4
|
+
atk_common/docker_utils.py,sha256=Z7BGCV5IX-O38jLSTDBN8k617zMsYDHL3VWdhoBXVfs,2504
|
5
|
+
atk_common/env_utils.py,sha256=YDeIhKMNLuw_zsBGjMrlQGl6IT3QKf_GIRA8uPeZIT4,513
|
6
6
|
atk_common/error_utils.py,sha256=kO-VQlajD8SO9MBxj8MHZRTK_uBXgPa09hy6pfjqZBY,2622
|
7
7
|
atk_common/file_utils.py,sha256=UDwcRquO9IrqRrlUM0t-_g4R1-FKt8ZqQinSEqXOAk8,112
|
8
8
|
atk_common/hash_utils.py,sha256=S_9o89CdI4lUQbVaqc85TDcqyDNuo30_E3VBaOrZKko,1047
|
@@ -52,7 +52,7 @@ atk_common/enums/speed_control_status_type_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe
|
|
52
52
|
atk_common/enums/speed_control_stop_reason.py,sha256=pvLS6fpDhsCiIDAmiQBsHctxZnq-Dl2BOgJOxQnT5Hc,200
|
53
53
|
atk_common/enums/test_image_type_enum.py,sha256=HUjxJorehnzRXMNF2uHk2DrAJ3Y_ajQvp0jW-mtlOhU,140
|
54
54
|
atk_common/enums/violation_type_enum.py,sha256=01qTHOj-O8bOc-nwIHVnxLosm4cusD_YuqXM3ZsiRRk,86
|
55
|
-
atk_common-1.
|
55
|
+
atk_common-1.60.0.dist-info/licenses/license.txt,sha256=_0O6fWM00-wTurDjnZhUP_N5QiwGhItaQZqHq5eqadA,1063
|
56
56
|
atk_package/__init__.py,sha256=NcsmwFadivgIeWV0-5ACZxqmfo4EzTkJX0r4N6DFAdg,820
|
57
57
|
atk_package/datetime_utils.py,sha256=qsVF7l90P1-xukG2tV_jLqG9J_Yfl5wTpyfrdPBlyMo,239
|
58
58
|
atk_package/env_utils.py,sha256=bXOrxM3fZUslqfmZt75iphbEJHbG4riJa8XOVzPwIII,313
|
@@ -65,7 +65,7 @@ atk_package/enums/__init__.py,sha256=EtUr_--MQj1Rc_R0sF_ELXIThmhpfmhDWq3YaK9oQMk
|
|
65
65
|
atk_package/enums/command_status_enum.py,sha256=M2Nln27a_DbzI07-gfytWQk2X087JhkU6Fmard5qVHs,127
|
66
66
|
atk_package/enums/speed_control_status_enum.py,sha256=qpURh0K1L1tSpbrzVnckoe4hUn1illIkbo7k4mLfzIM,182
|
67
67
|
shared_python_atk_enforcement/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
68
|
-
atk_common-1.
|
69
|
-
atk_common-1.
|
70
|
-
atk_common-1.
|
71
|
-
atk_common-1.
|
68
|
+
atk_common-1.60.0.dist-info/METADATA,sha256=jzQN40D-3XiZxU8FekkTujTW_40YgLtRSXrKeiW5kQ4,1761
|
69
|
+
atk_common-1.60.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
70
|
+
atk_common-1.60.0.dist-info/top_level.txt,sha256=4CwRjkLnheIdI4jQwc4tK3dbRc58WqUmoqjkdDTWlME,41
|
71
|
+
atk_common-1.60.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|