mantis-cli 9.0.0__tar.gz → 9.0.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: mantis-cli
3
- Version: 9.0.0
3
+ Version: 9.0.2
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -0,0 +1 @@
1
+ VERSION = '9.0.2'
@@ -32,7 +32,7 @@ class Postgres():
32
32
  def psql(self):
33
33
  CLI.info('Starting psql...')
34
34
  env = self.load_environment()
35
- self.docker(f'exec -it {self.CONTAINER_DB} psql -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} -W')
35
+ self.docker(f'exec -it {self.postgres_container} psql -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} -W')
36
36
  # https://blog.sleeplessbeastie.eu/2014/03/23/how-to-non-interactively-provide-password-for-the-postgresql-interactive-terminal/
37
37
  # TODO: https://www.postgresql.org/docs/9.1/libpq-pgpass.html
38
38
 
@@ -55,7 +55,7 @@ class Postgres():
55
55
  filename = now.strftime(f"{self.PROJECT_NAME}_%Y%m%d_%H%M{data_only_suffix}.{extension}")
56
56
  CLI.info(f'Backuping database into file {filename}')
57
57
  env = self.load_environment()
58
- self.docker(f'exec -it {self.CONTAINER_DB} bash -c \'pg_dump {compressed_params} {data_only_param} -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} {table_params} {env["POSTGRES_DBNAME"]} -W > /backups/{filename}\'')
58
+ self.docker(f'exec -it {self.postgres_container} bash -c \'pg_dump {compressed_params} {data_only_param} -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} {table_params} {env["POSTGRES_DBNAME"]} -W > /backups/{filename}\'')
59
59
  # https://blog.sleeplessbeastie.eu/2014/03/23/how-to-non-interactively-provide-password-for-the-postgresql-interactive-terminal/
60
60
  # TODO: https://www.postgresql.org/docs/9.1/libpq-pgpass.html
61
61
 
@@ -72,8 +72,8 @@ class Postgres():
72
72
 
73
73
  CLI.underline("Don't forget to drop database at first to prevent constraints collisions!")
74
74
  env = self.load_environment()
75
- self.docker(f'exec -it {self.CONTAINER_DB} bash -c \'pg_restore -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} {table_params} -W < /backups/{filename}\'')
76
- # print(f'exec -it {self.CONTAINER_DB} bash -c \'pg_restore -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} {table_params} -W < /backups/{filename}\'')
75
+ self.docker(f'exec -it {self.postgres_container} bash -c \'pg_restore -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} {table_params} -W < /backups/{filename}\'')
76
+ # print(f'exec -it {self.postgres_container} bash -c \'pg_restore -h {env["POSTGRES_HOST"]} -U {env["POSTGRES_USER"]} -d {env["POSTGRES_DBNAME"]} {table_params} -W < /backups/{filename}\'')
77
77
  # https://blog.sleeplessbeastie.eu/2014/03/23/how-to-non-interactively-provide-password-for-the-postgresql-interactive-terminal/
78
78
  # TODO: https://www.postgresql.org/docs/9.1/libpq-pgpass.html
79
79
 
@@ -158,74 +158,38 @@ def main():
158
158
 
159
159
 
160
160
  def execute(manager, command, params=None):
161
- manager_methods = {
162
- '--contexts': 'contexts',
163
- '--create-context': 'create_context',
164
- '--generate-key': 'generate_key',
165
- '--encrypt-env': 'encrypt_env',
166
- '--decrypt-env': 'decrypt_env',
167
- '--check-env': 'check_env',
168
- '--healthcheck': 'healthcheck',
161
+ shortcuts = {
169
162
  '-hc': 'healthcheck',
170
- '--bash': 'bash',
171
- '--build': 'build',
172
- '--build-image': 'build_image',
173
163
  '-b': 'build',
174
- '--push': 'push',
175
- '--pull': 'pull',
176
164
  '-p': 'pull',
177
- '--upload': 'upload',
178
- '--upload-docker-configs': 'upload_docker_configs',
179
165
  '-u': 'upload',
180
- '--reload': 'reload',
181
- '--restart': 'restart',
182
- '--run': 'run',
183
- '--up': 'up',
184
- '--deploy': 'deploy',
185
166
  '-d': 'deploy',
186
- '--stop': 'stop',
187
- '--start': 'start',
188
- '--clean': 'clean',
189
167
  '-c': 'clean',
190
- '--remove': 'remove',
191
- '--reload-webserver': 'reload_webserver',
192
- '--restart-proxy': 'restart_proxy',
193
- '--status': 'status',
194
168
  '-s': 'status',
195
- '--networks': 'networks',
196
169
  '-n': 'networks',
197
- '--logs': 'logs',
198
170
  '-l': 'logs',
199
- '--shell': 'shell',
200
- '--sh': 'sh',
201
- '--bash': 'bash',
202
- '--manage': 'manage',
203
- '--exec': 'exec',
204
- '--psql': 'psql',
205
- '--pg-dump': 'pg_dump',
206
- '--pg-dump-data': 'pg_dump_data',
207
- '--pg-restore': 'pg_restore',
208
- '--pg-restore-data': 'pg_restore_data',
209
- '--send-test-email': 'send_test_email',
210
171
  }
211
172
 
212
- manager_method = manager_methods.get(command)
173
+ manager_method = shortcuts.get(command, None)
174
+
175
+ if manager_method is None:
176
+ manager_method = command.lstrip('-').replace('-', '_')
213
177
 
214
178
  if manager_method is None or not hasattr(manager, manager_method):
215
- commands = '\n'.join(manager_methods.keys())
216
-
217
- CLI.error(f'Invalid command "{command}" \n\nUsage: mantis <ENVIRONMENT> \n{commands}')
179
+ CLI.error(f'Invalid command "{command}"')
180
+
181
+ # TODO: more sophisticated way to print usage/help
182
+ # commands = '\n'.join(manager_methods.keys())
183
+ # CLI.error(f'\n\nUsage: mantis <ENVIRONMENT> \n{commands}')
218
184
  else:
219
185
  methods_without_environment = ['contexts', 'create_context', 'generate_key', 'build', 'build_image', 'push']
220
- methods_with_params = ['healthcheck', 'sh', 'bash', 'build_image', 'exec', 'bash', 'manage', 'pg_restore', 'pg_restore_data', 'pg_dump_data',
221
- 'start', 'stop', 'logs', 'remove', 'upload', 'run', 'up', 'encrypt_env', 'decrypt_env']
222
186
 
223
187
  if manager.environment_id is None and manager_method not in methods_without_environment:
224
188
  CLI.error('Missing environment')
225
189
  elif manager.environment_id is not None and manager_method in methods_without_environment:
226
190
  CLI.error('Redundant environment')
227
191
 
228
- if manager_method in methods_with_params and params:
192
+ if params:
229
193
  getattr(manager, manager_method)(*params)
230
194
  else:
231
195
  getattr(manager, manager_method)()
@@ -138,13 +138,10 @@ class DefaultManager(object):
138
138
  # TODO: refactor
139
139
  self.CONTAINER_WEBSERVER = f"{self.CONTAINER_PREFIX}{self.get_container_suffix('webserver')}"
140
140
 
141
- self.SWARM = self.config.get('swarm', False)
142
- self.SWARM_STACK = self.config.get(f'swarm_stack', self.CONTAINER_PREFIX) # project name?
143
141
  self.compose_name = self.config['compose']['name']
144
142
  self.COMPOSE_PREFIX = 'docker-compose' if self.compose_name == '' else f'docker-compose.{self.compose_name}'
145
143
  self.compose_configs = [
146
- f'{self.configs_path}/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.yml',
147
- f'{self.configs_path}/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.proxy.yml',
144
+ f'{self.configs_path}/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.yml', # TODO: deprecated
148
145
  f'{self.configs_path}/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.{self.environment_id}.yml',
149
146
  ]
150
147
 
@@ -363,11 +360,7 @@ class DefaultManager(object):
363
360
  # check encryption values
364
361
  self.check_environment_encryption(env_file)
365
362
 
366
- def read_environment(self, path=None):
367
- # if not path:
368
- # # TODO
369
- # path = self.environment_path
370
-
363
+ def read_environment(self, path):
371
364
  if not os.path.exists(path):
372
365
  CLI.error(f'Environment file {path} does not exist')
373
366
  return None
@@ -376,6 +369,19 @@ class DefaultManager(object):
376
369
  return f.read().splitlines()
377
370
 
378
371
  def load_environment(self, path=None):
372
+ # if not path is specified, load variables from all environment files
373
+ if not path:
374
+ CLI.info(f'Environment file path not specified. Walking all environment files...')
375
+
376
+ values = {}
377
+
378
+ for env_file in self.environment_files:
379
+ env_values = self.load_environment(path=env_file)
380
+ values.update(env_values)
381
+
382
+ return values
383
+
384
+ # read environment file
379
385
  lines = self.read_environment(path)
380
386
 
381
387
  # TODO: refactor
@@ -394,12 +400,11 @@ class DefaultManager(object):
394
400
  if not self.is_valid_line(line):
395
401
  return None
396
402
 
397
- key = line.split('=', maxsplit=1)[0]
398
- value = line.split('=', maxsplit=1)[1]
399
-
400
- return key, value
403
+ return line.split('=', maxsplit=1)
401
404
 
402
405
  def cmd(self, command):
406
+ command = command.strip()
407
+
403
408
  error_message = "Error during running command '%s'" % command
404
409
 
405
410
  try:
@@ -527,7 +532,6 @@ class DefaultManager(object):
527
532
  image = service_build.get('image', self.get_image_name(service))
528
533
  dockerfile = f"{self.config['build'].get('context', '.')}{service_build['dockerfile']}"
529
534
  CLI.info(f'Building image {image} from {dockerfile}...')
530
- steps = 1
531
535
 
532
536
  if not os.path.exists(dockerfile):
533
537
  CLI.error(f'Dockerfile {dockerfile} not found')
@@ -536,7 +540,7 @@ class DefaultManager(object):
536
540
  DOCKER_TAG = self.config['build']['tag']
537
541
  DOCKER_REPOSITORY_AND_TAG = f'{DOCKER_REPOSITORY}:{DOCKER_TAG}'
538
542
 
539
- CLI.step(1, steps, f'Building Docker image [{DOCKER_REPOSITORY_AND_TAG}]...')
543
+ CLI.warning(f'Building Docker image [{DOCKER_REPOSITORY_AND_TAG}]...')
540
544
 
541
545
  build_args = self.config['build']['args']
542
546
  build_args = ','.join(map('='.join, build_args.items()))
@@ -552,8 +556,7 @@ class DefaultManager(object):
552
556
  CLI.info(f'Kit = {build_kit}')
553
557
  CLI.info(f'Args = {build_args}')
554
558
 
555
- # TODO: platform as mantis config parameter
556
- self.cmd(f'{time}{build_kit} docker build . {build_args} --platform linux/amd64 -t {image} -f {dockerfile} {params}')
559
+ self.cmd(f'{time}{build_kit} docker build . {build_args} -t {image} -f {dockerfile} {params}')
557
560
 
558
561
  def push(self, params=''):
559
562
  CLI.info(f'Pushing...')
@@ -586,7 +589,8 @@ class DefaultManager(object):
586
589
  self.docker_compose('pull')
587
590
 
588
591
  def upload(self, context='services'):
589
- steps = 1
592
+ if not self.connection:
593
+ return CLI.warning('Connection not defined. Skipping uploading files')
590
594
 
591
595
  mapping = {
592
596
  'services': {
@@ -607,11 +611,11 @@ class DefaultManager(object):
607
611
  self.upload('compose')
608
612
  self.upload('mantis')
609
613
  elif context == 'services':
610
- CLI.step(1, steps, 'Uploading configs for context "services" [webserver, database, cache, htpasswd]')
614
+ CLI.warning('Uploading configs for context "services" [webserver, database, cache, htpasswd]')
611
615
  elif context == 'compose':
612
- CLI.step(1, steps, 'Uploading configs for context "compose" [docker compose configs and environment]')
616
+ CLI.warning('Uploading configs for context "compose" [docker compose configs and environment]')
613
617
  elif context == 'mantis':
614
- CLI.step(1, steps, 'Uploading configs for mantis [mantis.json]')
618
+ CLI.warning('Uploading configs for mantis [mantis.json]')
615
619
  else:
616
620
  CLI.error(f'Unknown context "{context}". Available: services, compose, mantis or all')
617
621
 
@@ -650,40 +654,28 @@ class DefaultManager(object):
650
654
 
651
655
  def restart(self):
652
656
  CLI.info('Restarting...')
653
- steps = 3
654
-
655
- if self.SWARM:
656
- CLI.step(1, steps, 'Stopping and removing Docker app service...')
657
-
658
- for service in self.get_services():
659
- if service == self.CONTAINER_APP:
660
- self.cmd(f'docker service rm {service}')
657
+ steps = 4
661
658
 
662
- CLI.step(2, steps, 'Recreating Docker swarm stack...')
663
- self.cmd(f'docker stack deploy -c configs/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.yml -c configs/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.{self.environment_id}.yml {self.PROJECT_NAME}')
659
+ # run down project containers
660
+ CLI.step(1, steps, 'Running down project containers...')
661
+ self.down()
664
662
 
665
- CLI.step(3, steps, 'Prune Docker images and volumes') # todo prune on every node
666
- self.docker(f'system prune --volumes --force')
667
- else:
668
- CLI.step(1, steps, 'Stopping and removing Docker containers...')
663
+ # stop and remove all other containers
664
+ CLI.step(2, steps, 'Stopping and removing remaining containers...')
669
665
 
670
- # stop and remove all containers with project prefix
671
- containers = self.get_containers_starting_with(self.CONTAINER_PREFIX)
672
-
673
- for container in containers:
674
- self.docker(f'container stop {container}', return_output=True)
675
- self.docker(f'container rm {container}')
666
+ containers = self.get_containers()
676
667
 
677
- # for service in self.config['containers']['deploy']['zero_downtime'] + self.config['containers']['deploy']['restart']:
678
- # container = self.get_container_name(service)
679
- # self.docker(f'container stop {container}', return_output=True)
680
- # self.docker(f'container rm {container}')
668
+ for container in containers:
669
+ self.docker(f'container stop {container}', return_output=True)
670
+ self.docker(f'container rm {container}')
681
671
 
682
- CLI.step(2, steps, 'Recreating Docker containers...')
683
- self.docker_compose(f'--project-name={self.PROJECT_NAME} up -d')
672
+ # recreate project
673
+ CLI.step(3, steps, 'Recreating project containers...')
674
+ self.up()
684
675
 
685
- CLI.step(3, steps, 'Prune Docker images and volumes')
686
- self.docker(f'system prune --volumes --force')
676
+ # clean
677
+ CLI.step(4, steps, 'Prune Docker images and volumes')
678
+ self.clean()
687
679
 
688
680
  def deploy(self):
689
681
  CLI.info('Deploying...')
@@ -692,7 +684,7 @@ class DefaultManager(object):
692
684
  self.pull()
693
685
  self.reload()
694
686
 
695
- def reload(self): # todo deploy swarm
687
+ def reload(self):
696
688
  CLI.info('Reloading containers...')
697
689
  zero_downtime_services = self.config['containers']['deploy']['zero_downtime']
698
690
  restart_services = self.config['containers']['deploy']['restart']
@@ -713,8 +705,6 @@ class DefaultManager(object):
713
705
  num_retries = 30
714
706
  # num_retries = 20
715
707
 
716
- print(self.get_containers())
717
-
718
708
  self.healthcheck(retries=num_retries, service=f'{service}-new', break_if_successful=True)
719
709
 
720
710
  # rename old container
@@ -770,72 +760,52 @@ class DefaultManager(object):
770
760
  self.docker_compose(f'--project-name={self.PROJECT_NAME} run -d --service-ports --name={container} {service}')
771
761
 
772
762
  def stop(self, params=None):
773
- if self.SWARM: # todo can stop service ?
774
- CLI.info('Removing services...')
775
- self.cmd(f'docker stack rm {self.PROJECT_NAME}')
776
-
777
- else:
778
- CLI.info('Stopping containers...')
763
+ CLI.info('Stopping containers...')
779
764
 
780
- containers = self.get_containers() if not params else params.split(' ')
765
+ containers = self.get_containers() if not params else params.split(' ')
781
766
 
782
- steps = len(containers)
767
+ steps = len(containers)
783
768
 
784
- for index, container in enumerate(containers):
785
- CLI.step(index + 1, steps, f'Stopping {container}')
786
- self.docker(f'container stop {container}')
769
+ for index, container in enumerate(containers):
770
+ CLI.step(index + 1, steps, f'Stopping {container}')
771
+ self.docker(f'container stop {container}')
787
772
 
788
773
  def start(self, params=''):
789
- if self.SWARM:
790
- CLI.info('Starting services...')
791
- self.cmd(f'docker stack deploy -c configs/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.yml -c configs/{self.configs_compose_folder}/{self.COMPOSE_PREFIX}.{self.environment_id}.yml {self.PROJECT_NAME}')
792
-
793
- else:
794
- CLI.info('Starting containers...')
774
+ CLI.info('Starting containers...')
795
775
 
796
- containers = self.get_containers() if not params else params.split(' ')
776
+ containers = self.get_containers() if not params else params.split(' ')
797
777
 
798
- steps = len(containers)
778
+ steps = len(containers)
799
779
 
800
- for index, container in enumerate(containers):
801
- CLI.step(index + 1, steps, f'Starting {container}')
802
- self.docker(f'container start {container}')
780
+ for index, container in enumerate(containers):
781
+ CLI.step(index + 1, steps, f'Starting {container}')
782
+ self.docker(f'container start {container}')
803
783
 
804
784
  def run(self, params):
805
- CLI.info('Run...')
806
- steps = 1
807
-
808
- CLI.step(1, steps, f'Running {params}...')
785
+ CLI.info(f'Running {params}...')
809
786
  self.docker_compose(f'--project-name={self.PROJECT_NAME} run {params}')
810
787
 
811
- def up(self, params):
812
- CLI.info('Up...')
813
- steps = 1
788
+ def up(self, params=''):
789
+ CLI.info(f'Starting up {params}...')
790
+ self.docker_compose(f'--project-name={self.PROJECT_NAME} up {params} -d')
814
791
 
815
- CLI.step(1, steps, f'Upping {params}...')
816
- self.docker_compose(f'--project-name={self.PROJECT_NAME} up {params}')
792
+ def down(self, params=''):
793
+ CLI.info(f'Running down {params}...')
794
+ self.docker_compose(f'--project-name={self.PROJECT_NAME} down {params}')
817
795
 
818
796
  def remove(self, params=''):
819
- if self.SWARM: # todo remove containers as well ?
820
- CLI.info('Removing services...')
821
- self.cmd(f'docker stack rm {self.PROJECT_NAME}')
822
-
823
- else:
824
- CLI.info('Removing containers...')
797
+ CLI.info('Removing containers...')
825
798
 
826
- containers = self.get_containers() if params == '' else params.split(' ')
799
+ containers = self.get_containers() if params == '' else params.split(' ')
827
800
 
828
- steps = len(containers)
801
+ steps = len(containers)
829
802
 
830
- for index, container in enumerate(containers):
831
- CLI.step(index + 1, steps, f'Removing {container}')
832
- self.docker(f'container rm {container}')
803
+ for index, container in enumerate(containers):
804
+ CLI.step(index + 1, steps, f'Removing {container}')
805
+ self.docker(f'container rm {container}')
833
806
 
834
807
  def clean(self): # todo clean on all nodes
835
808
  CLI.info('Cleaning...')
836
- steps = 1
837
-
838
- CLI.step(1, steps, 'Prune Docker images and volumes')
839
809
  # self.docker(f'builder prune')
840
810
  self.docker(f'system prune --volumes --force')
841
811
  # self.docker(f'container prune')
@@ -845,35 +815,19 @@ class DefaultManager(object):
845
815
  CLI.info('Reloading webserver...')
846
816
  self.docker(f'exec -it {self.CONTAINER_WEBSERVER} {self.WEBSERVER} -s reload')
847
817
 
848
- # TODO: Extension
849
- def restart_proxy(self):
850
- CLI.info('Restarting proxy...')
851
- steps = 1
852
-
853
- CLI.step(1, steps, 'Reloading proxy container...')
854
- self.cmd(f'{self.docker_connection} docker compose -f configs/{self.configs_compose_folder}/docker-compose.proxy.yml --project-name=reverse up -d')
855
-
856
818
  def status(self):
857
- if self.SWARM: # todo remove containers as well ?
858
- CLI.info('Getting status...')
859
- self.cmd(f'docker stack services {self.PROJECT_NAME}')
860
-
861
- else:
862
- CLI.info('Getting status...')
863
- steps = 2
819
+ CLI.info('Getting status...')
820
+ steps = 2
864
821
 
865
- CLI.step(1, steps, 'List of Docker images')
866
- self.docker(f'image ls')
822
+ CLI.step(1, steps, 'List of Docker images')
823
+ self.docker(f'image ls')
867
824
 
868
- CLI.step(2, steps, 'Docker containers')
869
- self.docker(f'container ls -a --size')
825
+ CLI.step(2, steps, 'Docker containers')
826
+ self.docker(f'container ls -a --size')
870
827
 
871
828
  def networks(self):
872
- # todo for swarm
873
829
  CLI.info('Getting networks...')
874
- steps = 1
875
-
876
- CLI.step(1, steps, 'List of Docker networks')
830
+ CLI.warning('List of Docker networks')
877
831
 
878
832
  networks = self.docker('network ls', return_output=True)
879
833
  networks = networks.strip().split('\n')
@@ -890,27 +844,15 @@ class DefaultManager(object):
890
844
  print(f'{network}\t{containers}'.strip())
891
845
 
892
846
  def logs(self, params=None):
893
- if self.SWARM:
894
- CLI.info('Reading logs...')
847
+ CLI.info('Reading logs...')
895
848
 
896
- services = params.split(' ') if params else self.get_services()
897
- lines = '--tail 100 -f' if params else '--tail 10'
898
- steps = len(services)
849
+ containers = params.split(' ') if params else self.get_containers()
850
+ lines = '--tail 1000 -f' if params else '--tail 10'
851
+ steps = len(containers)
899
852
 
900
- for index, service in enumerate(services):
901
- CLI.step(index + 1, steps, f'{service} logs')
902
- self.cmd(f'docker service logs {service} {lines}')
903
-
904
- else:
905
- CLI.info('Reading logs...')
906
-
907
- containers = params.split(' ') if params else self.get_containers()
908
- lines = '--tail 1000 -f' if params else '--tail 10'
909
- steps = len(containers)
910
-
911
- for index, container in enumerate(containers):
912
- CLI.step(index + 1, steps, f'{container} logs')
913
- self.docker(f'logs {container} {lines}')
853
+ for index, container in enumerate(containers):
854
+ CLI.step(index + 1, steps, f'{container} logs')
855
+ self.docker(f'logs {container} {lines}')
914
856
 
915
857
  def bash(self, params):
916
858
  CLI.info('Running bash...')
@@ -930,15 +872,9 @@ class DefaultManager(object):
930
872
  containers = self.docker(f'container ls -a --format \'{{{{.Names}}}}\'', return_output=True)
931
873
  print(containers)
932
874
  containers = containers.strip().split('\n')
933
- containers = list(filter(lambda x: x.startswith(self.CONTAINER_PREFIX), containers))
875
+ # containers = list(filter(lambda x: x.startswith(self.CONTAINER_PREFIX), containers))
934
876
  return containers
935
877
 
936
- def get_services(self):
937
- services = os.popen(f'docker stack services {self.SWARM_STACK} --format \'{{{{.Name}}}}\'').read()
938
- services = services.strip().split('\n')
939
- services = list(filter(lambda x: x.startswith(self.CONTAINER_PREFIX), services))
940
- return services
941
-
942
878
  def get_containers_starting_with(self, start_with):
943
879
  return [i for i in self.get_containers() if i.startswith(start_with)]
944
880
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 1.2
2
2
  Name: mantis-cli
3
- Version: 9.0.0
3
+ Version: 9.0.2
4
4
  Summary: Management command to build and deploy webapps, especially based on Django
5
5
  Home-page: https://github.com/PragmaticMates/mantis-cli
6
6
  Author: Erik Telepovský
@@ -1 +0,0 @@
1
- VERSION = '9.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