From c1ee6424836547fe8848f3046b989927dc4c2e20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20Loipf=C3=BChrer?= <michael.loipfuehrer@stusta.de>
Date: Sun, 15 Mar 2020 21:30:04 +0100
Subject: [PATCH] fix not saving of config

---
 lustmolch/cli.py       | 5 ++---
 lustmolch/lustmolch.py | 6 +++---
 setup.py               | 2 +-
 3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/lustmolch/cli.py b/lustmolch/cli.py
index 999a595..7894975 100644
--- a/lustmolch/cli.py
+++ b/lustmolch/cli.py
@@ -46,7 +46,6 @@ def update_containers(dry_run: bool) -> None:
 
 
 @cli.command()
-@click.option('--dry-run', is_flag=True, default=False)
 @click.argument('name')
-def remove_container(dry_run: bool, name: str) -> None:
-    lustmolch.remove_container(dry_run, name)
+def remove_container(name: str) -> None:
+    lustmolch.remove_container(name)
diff --git a/lustmolch/lustmolch.py b/lustmolch/lustmolch.py
index 29c3977..930d2a4 100755
--- a/lustmolch/lustmolch.py
+++ b/lustmolch/lustmolch.py
@@ -187,6 +187,7 @@ def create_container(dry_run, name):
 
     logging.info('Updating container configuration file')
     if not dry_run:
+        config['containers'][name] = context
         config.save()
 
     logging.info(f'All done, ssh server running on port {ssh_port}\n'
@@ -236,13 +237,12 @@ def update_containers(dry_run: bool) -> None:
             authorized_keys.write_text(keys)
 
 
-def remove_container(dry_run: bool, name: str) -> None:
+def remove_container(name: str) -> None:
     """delete a container and its configuration files"""
     machine_path = Path('/var/lib/machines', name)
 
     logging.info(f'Stopping container')
-    if not dry_run:
-        run(['machinectl', 'stop', name], capture_output=True, check=False)
+    run(['machinectl', 'stop', name], capture_output=True, check=False)
 
     # removing shared folder
     www_dir = Path(config['www_root']) / name
diff --git a/setup.py b/setup.py
index 82493df..d5b5f9c 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 from setuptools import setup
 
-VERSION = '1.0.5'
+VERSION = '1.0.6'
 AUTHOR = 'Michael Loipführer'
 
 
-- 
GitLab