mantis-cli 19.1.5__tar.gz → 19.1.7__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.
- {mantis-cli-19.1.5/mantis_cli.egg-info → mantis_cli-19.1.7}/PKG-INFO +1 -1
- mantis_cli-19.1.7/mantis/__init__.py +1 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/helpers.py +21 -2
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/managers.py +38 -9
- {mantis-cli-19.1.5 → mantis_cli-19.1.7/mantis_cli.egg-info}/PKG-INFO +1 -1
- mantis-cli-19.1.5/mantis/__init__.py +0 -1
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/LICENSE +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/MANIFEST.in +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/README.md +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/__main__.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/command_line.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/crypto.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/environment.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/extensions/__init__.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/extensions/django.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/extensions/nginx.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/extensions/postgres.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/logic.py +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis/mantis.tpl +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis_cli.egg-info/SOURCES.txt +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis_cli.egg-info/dependency_links.txt +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis_cli.egg-info/entry_points.txt +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis_cli.egg-info/requires.txt +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/mantis_cli.egg-info/top_level.txt +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/setup.cfg +0 -0
- {mantis-cli-19.1.5 → mantis_cli-19.1.7}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = '19.1.7'
|
|
@@ -108,5 +108,24 @@ def random_string(n=10):
|
|
|
108
108
|
chars = string.ascii_lowercase + string.ascii_uppercase + string.digits
|
|
109
109
|
return ''.join(random.choice(chars) for _ in range(n))
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
def merge_json(obj1, obj2):
|
|
112
|
+
# Base case: if both values are dictionaries, merge recursively
|
|
113
|
+
if isinstance(obj1, dict) and isinstance(obj2, dict):
|
|
114
|
+
merged = {}
|
|
115
|
+
for key in obj1.keys() | obj2.keys(): # Union of both sets of keys
|
|
116
|
+
if key in obj1 and key in obj2:
|
|
117
|
+
merged[key] = merge_json(obj1[key], obj2[key])
|
|
118
|
+
elif key in obj1:
|
|
119
|
+
merged[key] = obj1[key]
|
|
120
|
+
else:
|
|
121
|
+
merged[key] = obj2[key]
|
|
122
|
+
return merged
|
|
123
|
+
# If both are lists, combine them
|
|
124
|
+
elif isinstance(obj1, list) and isinstance(obj2, list):
|
|
125
|
+
return obj1 + obj2
|
|
126
|
+
# If both values are not dicts or lists, return value from obj2
|
|
127
|
+
else:
|
|
128
|
+
if obj1 == obj2:
|
|
129
|
+
return obj1
|
|
130
|
+
else:
|
|
131
|
+
raise ValueError(f'Trying to merge objects: {obj1} and {obj2}')
|
|
@@ -5,12 +5,12 @@ import yaml
|
|
|
5
5
|
from collections import defaultdict
|
|
6
6
|
from datetime import datetime
|
|
7
7
|
from os import path
|
|
8
|
-
from os.path import
|
|
8
|
+
from os.path import normpath
|
|
9
9
|
from time import sleep
|
|
10
10
|
|
|
11
11
|
from mantis.crypto import Crypto
|
|
12
12
|
from mantis.environment import Environment
|
|
13
|
-
from mantis.helpers import CLI, Colors
|
|
13
|
+
from mantis.helpers import CLI, Colors, merge_json
|
|
14
14
|
from mantis.logic import find_config, load_config, check_config, load_template_config
|
|
15
15
|
|
|
16
16
|
|
|
@@ -158,6 +158,9 @@ class AbstractManager(object):
|
|
|
158
158
|
# Remove empty strings
|
|
159
159
|
self.compose_files = list(filter(None, compose_file_paths))
|
|
160
160
|
|
|
161
|
+
# Read compose files
|
|
162
|
+
self.compose_config = self.read_compose_configs()
|
|
163
|
+
|
|
161
164
|
def check_environment_encryption(self, env_file):
|
|
162
165
|
decrypted_environment = self.decrypt_env(env_file=env_file, return_value=True) # .env.encrypted
|
|
163
166
|
loaded_environment = self.env.load(env_file) # .env
|
|
@@ -570,7 +573,8 @@ class BaseManager(AbstractManager):
|
|
|
570
573
|
Checks if given container has defined healthcheck
|
|
571
574
|
"""
|
|
572
575
|
healthcheck_config = self.get_healthcheck_config(container)
|
|
573
|
-
|
|
576
|
+
|
|
577
|
+
return healthcheck_config and healthcheck_config.get('Test') != ['NONE']
|
|
574
578
|
|
|
575
579
|
def get_healthcheck_start_period(self, container):
|
|
576
580
|
"""
|
|
@@ -916,6 +920,8 @@ class BaseManager(AbstractManager):
|
|
|
916
920
|
CLI.info(f'Renaming new container [{new_container}]...')
|
|
917
921
|
self.docker(f'container rename {new_container} {container_prefix}-{index + 1}')
|
|
918
922
|
|
|
923
|
+
self.remove_suffixes(prefix=container_prefix)
|
|
924
|
+
|
|
919
925
|
# reload webserver
|
|
920
926
|
self.try_to_reload_webserver()
|
|
921
927
|
|
|
@@ -925,18 +931,28 @@ class BaseManager(AbstractManager):
|
|
|
925
931
|
"""
|
|
926
932
|
for service in self.services():
|
|
927
933
|
containers = self.get_service_containers(service)
|
|
934
|
+
|
|
928
935
|
num_containers = len(containers)
|
|
929
936
|
|
|
930
937
|
if num_containers != 1:
|
|
931
|
-
|
|
938
|
+
CLI.info(f'Service {service} has {num_containers} containers. Skipping removing suffix.')
|
|
939
|
+
continue
|
|
932
940
|
|
|
933
941
|
container = containers[0]
|
|
934
942
|
|
|
935
|
-
if container.split('-')[-1].isdigit():
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
943
|
+
if not container.split('-')[-1].isdigit():
|
|
944
|
+
continue
|
|
945
|
+
|
|
946
|
+
new_container = container.rsplit('-', maxsplit=1)[0]
|
|
947
|
+
defined_container_name = self.compose_config.get('services', {}).get(service, {}).get('container_name', None)
|
|
948
|
+
|
|
949
|
+
if container == defined_container_name:
|
|
950
|
+
CLI.info(f'Service {service} has defined the same container name ({defined_container_name}). Skipping removing suffix.')
|
|
951
|
+
continue
|
|
952
|
+
|
|
953
|
+
if container not in self.services():
|
|
954
|
+
CLI.info(f'Removing suffix of container {container}')
|
|
955
|
+
self.docker(f'container rename {container} {new_container}')
|
|
940
956
|
|
|
941
957
|
def restart_service(self, service):
|
|
942
958
|
"""
|
|
@@ -1159,6 +1175,19 @@ class BaseManager(AbstractManager):
|
|
|
1159
1175
|
|
|
1160
1176
|
return None
|
|
1161
1177
|
|
|
1178
|
+
def read_compose_configs(self):
|
|
1179
|
+
"""
|
|
1180
|
+
Returns merged compose configs
|
|
1181
|
+
"""
|
|
1182
|
+
config = {}
|
|
1183
|
+
|
|
1184
|
+
for compose_file in self.compose_files:
|
|
1185
|
+
with open(compose_file, 'r') as file:
|
|
1186
|
+
compose_data = yaml.safe_load(file)
|
|
1187
|
+
config = merge_json(config, compose_data)
|
|
1188
|
+
|
|
1189
|
+
return config
|
|
1190
|
+
|
|
1162
1191
|
def get_deploy_replicas(self, service):
|
|
1163
1192
|
"""
|
|
1164
1193
|
Returns default number of deploy replicas of given services
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '19.1.5'
|
|
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
|