mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
fix container removal if auto_remove was enabled
This commit is contained in:
parent
e533b7182d
commit
97779c965d
1 changed files with 5 additions and 1 deletions
|
@ -3038,6 +3038,7 @@ def rm_(name, force=False, volumes=False, **kwargs):
|
|||
'''
|
||||
kwargs = salt.utils.clean_kwargs(**kwargs)
|
||||
stop_ = kwargs.pop('stop', False)
|
||||
auto_remove = False
|
||||
if kwargs:
|
||||
salt.utils.invalid_kwargs(kwargs)
|
||||
|
||||
|
@ -3047,9 +3048,12 @@ def rm_(name, force=False, volumes=False, **kwargs):
|
|||
'remove this container'.format(name)
|
||||
)
|
||||
if stop_ and not force:
|
||||
auto_remove = inspect_container(name)['HostConfig']['AutoRemove']
|
||||
stop(name)
|
||||
pre = ps_(all=True)
|
||||
_client_wrapper('remove_container', name, v=volumes, force=force)
|
||||
|
||||
if not auto_remove:
|
||||
_client_wrapper('remove_container', name, v=volumes, force=force)
|
||||
_clear_context()
|
||||
return [x for x in pre if x not in ps_(all=True)]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue