summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-06-28 18:27:26 +0200
committerGitHub <noreply@github.com>2022-06-28 18:27:26 +0200
commitd1ff009703bbe8ce65be79e0ced06881068ba9a1 (patch)
tree8acafe4a11fc80471ae192529118f58aaeacda08 /src
parent49d7ba83958a44b92d80da33cef25ff666a55d7b (diff)
parent6ac48a2051a98f4312ca94a3389befd43e74c60e (diff)
downloadvyos-1x-d1ff009703bbe8ce65be79e0ced06881068ba9a1.tar.gz
vyos-1x-d1ff009703bbe8ce65be79e0ced06881068ba9a1.zip
Merge pull request #1377 from sever-sever/T4486
containers: T4486: Fix path for removing containers
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/container.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py
index 2110fd9e0..77281eb4d 100755
--- a/src/conf_mode/container.py
+++ b/src/conf_mode/container.py
@@ -90,10 +90,10 @@ def get_config(config=None):
container['name'][name] = dict_merge(default_values, container['name'][name])
# Delete container network, delete containers
- tmp = node_changed(conf, base + ['container', 'network'])
+ tmp = node_changed(conf, base + ['network'])
if tmp: container.update({'network_remove' : tmp})
- tmp = node_changed(conf, base + ['container', 'name'])
+ tmp = node_changed(conf, base + ['name'])
if tmp: container.update({'container_remove' : tmp})
return container
@@ -270,12 +270,13 @@ def apply(container):
# Option "--force" allows to delete containers with any status
if 'container_remove' in container:
for name in container['container_remove']:
- call(f'podman stop {name}')
+ call(f'podman stop --time 3 {name}')
call(f'podman rm --force {name}')
# Delete old networks if needed
if 'network_remove' in container:
for network in container['network_remove']:
+ call(f'podman network rm {network}')
tmp = f'/etc/cni/net.d/{network}.conflist'
if os.path.exists(tmp):
os.unlink(tmp)
@@ -294,7 +295,7 @@ def apply(container):
# check if there is a container by that name running
tmp = _cmd('podman ps -a --format "{{.Names}}"')
if name in tmp:
- _cmd(f'podman stop {name}')
+ _cmd(f'podman stop --time 3 {name}')
_cmd(f'podman rm --force {name}')
continue