mantis-cli 14.0.0__tar.gz → 14.1.0__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-14.0.0/mantis_cli.egg-info → mantis-cli-14.1.0}/PKG-INFO +1 -1
- mantis-cli-14.1.0/mantis/__init__.py +1 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/crypto.py +3 -8
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/managers.py +12 -5
- {mantis-cli-14.0.0 → mantis-cli-14.1.0/mantis_cli.egg-info}/PKG-INFO +1 -1
- mantis-cli-14.0.0/mantis/__init__.py +0 -1
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/.gitignore +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/LICENSE +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/MANIFEST.in +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/README.md +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/TODO +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/__main__.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/command_line.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/environment.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/extensions/__init__.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/extensions/django.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/extensions/nginx.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/extensions/postgres.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/helpers.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis/logic.py +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis_cli.egg-info/SOURCES.txt +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis_cli.egg-info/dependency_links.txt +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis_cli.egg-info/entry_points.txt +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis_cli.egg-info/requires.txt +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/mantis_cli.egg-info/top_level.txt +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/setup.cfg +0 -0
- {mantis-cli-14.0.0 → mantis-cli-14.1.0}/setup.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = '14.1.0'
|
|
@@ -2,15 +2,12 @@ from base64 import b64encode, b64decode
|
|
|
2
2
|
|
|
3
3
|
try:
|
|
4
4
|
from Crypto.Cipher import AES
|
|
5
|
-
from Crypto.Random import get_random_bytes
|
|
6
5
|
from cryptography.fernet import Fernet
|
|
7
6
|
except ImportError:
|
|
8
7
|
# not using cryptography
|
|
9
|
-
# pip install pycryptodome>=3.11.0
|
|
10
|
-
# TODO: only if using environment encryption!
|
|
11
8
|
raise ImportError('Install pycryptodome and cryptography!')
|
|
12
9
|
|
|
13
|
-
from mantis.helpers import CLI
|
|
10
|
+
from mantis.helpers import CLI, random_string
|
|
14
11
|
|
|
15
12
|
|
|
16
13
|
class Crypto(object):
|
|
@@ -18,10 +15,8 @@ class Crypto(object):
|
|
|
18
15
|
def generate_key(deterministically=False):
|
|
19
16
|
if deterministically:
|
|
20
17
|
# deterministically: length has to be 32, 48 or 64
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return x
|
|
24
|
-
|
|
18
|
+
return random_string(64)
|
|
19
|
+
|
|
25
20
|
return Fernet.generate_key()
|
|
26
21
|
|
|
27
22
|
@staticmethod
|
|
@@ -529,6 +529,12 @@ class BaseManager(object):
|
|
|
529
529
|
else:
|
|
530
530
|
CLI.error(f'Unknown build tool: {build_tool}. Available tools: {", ".join(available_tools)}')
|
|
531
531
|
|
|
532
|
+
def services(self):
|
|
533
|
+
with open(self.compose_file, 'r') as file:
|
|
534
|
+
compose_data = yaml.safe_load(file)
|
|
535
|
+
|
|
536
|
+
return compose_data.get('services', {}).keys()
|
|
537
|
+
|
|
532
538
|
def services_to_build(self):
|
|
533
539
|
with open(self.compose_file, 'r') as file:
|
|
534
540
|
compose_data = yaml.safe_load(file)
|
|
@@ -671,9 +677,10 @@ class BaseManager(object):
|
|
|
671
677
|
def remove_suffixes(self, prefix=''):
|
|
672
678
|
for container in self.get_containers(prefix=prefix):
|
|
673
679
|
if container.split('-')[-1].isdigit():
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
680
|
+
if container not in self.services():
|
|
681
|
+
CLI.info(f'Removing suffix of container {container}')
|
|
682
|
+
new_container = container.rsplit('-', maxsplit=1)[0]
|
|
683
|
+
self.docker(f'container rename {container} {new_container}')
|
|
677
684
|
|
|
678
685
|
def restart_service(self, service):
|
|
679
686
|
container = self.get_container_name(service)
|
|
@@ -757,10 +764,10 @@ class BaseManager(object):
|
|
|
757
764
|
CLI.step(index + 1, steps, f'Removing {container}')
|
|
758
765
|
self.docker(f'container rm {container}')
|
|
759
766
|
|
|
760
|
-
def clean(self): # todo clean on all nodes
|
|
767
|
+
def clean(self, params=''): # todo clean on all nodes
|
|
761
768
|
CLI.info('Cleaning...')
|
|
762
769
|
# self.docker(f'builder prune')
|
|
763
|
-
self.docker(f'system prune
|
|
770
|
+
self.docker(f'system prune {params} --force')
|
|
764
771
|
# self.docker(f'container prune')
|
|
765
772
|
# self.docker(f'container prune --force')
|
|
766
773
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = '14.0.0'
|
|
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
|