update_services only once per app, suppress umount warnings

This commit is contained in:
Disassembler 2019-12-09 21:49:05 +01:00
parent ad1bfc8860
commit 57212cb6b3
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
3 changed files with 4 additions and 3 deletions

View File

@ -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

View File

@ -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):

View File

@ -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