Fix cleanup with multiple arguments
Also improve the printing of docker commands being run when calling --verbose
This commit is contained in:
parent
02126d065c
commit
21459cfd33
|
@ -58,7 +58,7 @@ class ComposeV1Builder(object):
|
||||||
LOG.error("Error running %s. [%s]\n" % (cmd, returncode))
|
LOG.error("Error running %s. [%s]\n" % (cmd, returncode))
|
||||||
deploy_status_code = returncode
|
deploy_status_code = returncode
|
||||||
else:
|
else:
|
||||||
LOG.debug('Completed %s' % cmd)
|
LOG.debug('Completed $ %s' % ' '.join(cmd))
|
||||||
return stdout, stderr, deploy_status_code
|
return stdout, stderr, deploy_status_code
|
||||||
|
|
||||||
def label_arguments(self, cmd, container):
|
def label_arguments(self, cmd, container):
|
||||||
|
|
|
@ -83,7 +83,7 @@ class Cleanup(Command):
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'config_id',
|
'config_id',
|
||||||
metavar='<config_id>',
|
metavar='<config_id>',
|
||||||
nargs='?',
|
nargs='*',
|
||||||
help=('Identifiers for the configs which still apply, all others '
|
help=('Identifiers for the configs which still apply, all others '
|
||||||
'will be deleted.'),
|
'will be deleted.'),
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DockerRunner(object):
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def execute(cmd):
|
def execute(cmd):
|
||||||
LOG.debug(' '.join(cmd))
|
LOG.debug('$ %s' % ' '.join(cmd))
|
||||||
subproc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
subproc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE)
|
stderr=subprocess.PIPE)
|
||||||
cmd_stdout, cmd_stderr = subproc.communicate()
|
cmd_stdout, cmd_stderr = subproc.communicate()
|
||||||
|
@ -157,6 +157,9 @@ class DockerRunner(object):
|
||||||
return container
|
return container
|
||||||
|
|
||||||
def delete_missing_configs(self, config_ids):
|
def delete_missing_configs(self, config_ids):
|
||||||
|
if not config_ids:
|
||||||
|
config_ids = []
|
||||||
|
|
||||||
for conf_id in self.current_config_ids():
|
for conf_id in self.current_config_ids():
|
||||||
if conf_id not in config_ids:
|
if conf_id not in config_ids:
|
||||||
LOG.debug('%s no longer exists, deleting containers' % conf_id)
|
LOG.debug('%s no longer exists, deleting containers' % conf_id)
|
||||||
|
|
Loading…
Reference in New Issue