diff --git a/usr/lib/python3.6/lxcmgr/lxcmgr.py b/usr/lib/python3.6/lxcmgr/lxcmgr.py index e3aa810..2edb240 100644 --- a/usr/lib/python3.6/lxcmgr/lxcmgr.py +++ b/usr/lib/python3.6/lxcmgr/lxcmgr.py @@ -29,7 +29,8 @@ def mount_rootfs(container, layers, mountpoint): subprocess.run(['mount', '-t', 'overlay', '-o', 'upperdir={},lowerdir={},workdir={}'.format(layers[0], ':'.join(layers[1:]), olwork), 'none', mountpoint]) def unmount_rootfs(mountpoint): - subprocess.run(['umount', '--quiet', mountpoint]) + if os.path.exists(mountpoint): + subprocess.run(['umount', '--quiet', mountpoint]) def clean_ephemeral_layer(container): # Cleans containers ephemeral layer. Called in lxc.hook.post-stop and lxc.hook.pre-start in case of unclean shutdown diff --git a/usr/lib/python3.6/lxcmgr/pkgmgr.py b/usr/lib/python3.6/lxcmgr/pkgmgr.py index 6bc32d4..af8bc4c 100644 --- a/usr/lib/python3.6/lxcmgr/pkgmgr.py +++ b/usr/lib/python3.6/lxcmgr/pkgmgr.py @@ -220,12 +220,14 @@ class PkgMgr: image['depends'] = containers[container]['depends'] lxcmgr.create_container(container, image) svcmgr.create_service(container, image) + svcmgr.update_services() def destroy_containers(self, containers): # Destroy LXC containers for container in containers: svcmgr.delete_service(container) lxcmgr.destroy_container(container) + svcmgr.update_services() @flock.flock_ex(REPO_LOCK) def uninstall_app(self, app): diff --git a/usr/lib/python3.6/lxcmgr/svcmgr.py b/usr/lib/python3.6/lxcmgr/svcmgr.py index 61811a6..bae2e65 100644 --- a/usr/lib/python3.6/lxcmgr/svcmgr.py +++ b/usr/lib/python3.6/lxcmgr/svcmgr.py @@ -19,7 +19,6 @@ def create_service(container, image): with open(service_file, 'w') as f: f.write(SERVICE.format(container=container, depends=depends, start_post=start_post)) os.chmod(service_file, 0o755) - update_services() def delete_service(service): if is_service_started(service): @@ -28,7 +27,6 @@ def delete_service(service): update_service_autostart(service, False) try: os.unlink(os.path.join(SERVICE_DIR, lxcize(service))) - update_services() except FileNotFoundError: pass