summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-08-23 16:57:38 +0200
committerChristian Poessinger <christian@poessinger.com>2021-08-23 16:57:38 +0200
commit7762e74d928e9f23360798a21c8dd970579365b6 (patch)
tree0fd3fb95213d98d31f2e5995631170493f957193 /src
parentf480f236d8bd43bbfc5928702a94d6b3684cbb68 (diff)
downloadvyos-1x-7762e74d928e9f23360798a21c8dd970579365b6.tar.gz
vyos-1x-7762e74d928e9f23360798a21c8dd970579365b6.zip
container: T2216: add option to "disable" a container
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/containers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/conf_mode/containers.py b/src/conf_mode/containers.py
index 97e84a5bb..5b863fa03 100755
--- a/src/conf_mode/containers.py
+++ b/src/conf_mode/containers.py
@@ -214,8 +214,15 @@ def apply(container):
# Add container
if 'name' in container:
for name, container_config in container['name'].items():
- # Check if the container has already been created
image = container_config['image']
+
+ if 'disable' in container_config:
+ # 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}')
+ continue
+
memory = container_config['memory']
restart = container_config['restart']