update_services only once per app, suppress umount warnings
This commit is contained in:
parent
ad1bfc8860
commit
57212cb6b3
@ -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])
|
subprocess.run(['mount', '-t', 'overlay', '-o', 'upperdir={},lowerdir={},workdir={}'.format(layers[0], ':'.join(layers[1:]), olwork), 'none', mountpoint])
|
||||||
|
|
||||||
def unmount_rootfs(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):
|
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
|
# Cleans containers ephemeral layer. Called in lxc.hook.post-stop and lxc.hook.pre-start in case of unclean shutdown
|
||||||
|
@ -220,12 +220,14 @@ class PkgMgr:
|
|||||||
image['depends'] = containers[container]['depends']
|
image['depends'] = containers[container]['depends']
|
||||||
lxcmgr.create_container(container, image)
|
lxcmgr.create_container(container, image)
|
||||||
svcmgr.create_service(container, image)
|
svcmgr.create_service(container, image)
|
||||||
|
svcmgr.update_services()
|
||||||
|
|
||||||
def destroy_containers(self, containers):
|
def destroy_containers(self, containers):
|
||||||
# Destroy LXC containers
|
# Destroy LXC containers
|
||||||
for container in containers:
|
for container in containers:
|
||||||
svcmgr.delete_service(container)
|
svcmgr.delete_service(container)
|
||||||
lxcmgr.destroy_container(container)
|
lxcmgr.destroy_container(container)
|
||||||
|
svcmgr.update_services()
|
||||||
|
|
||||||
@flock.flock_ex(REPO_LOCK)
|
@flock.flock_ex(REPO_LOCK)
|
||||||
def uninstall_app(self, app):
|
def uninstall_app(self, app):
|
||||||
|
@ -19,7 +19,6 @@ def create_service(container, image):
|
|||||||
with open(service_file, 'w') as f:
|
with open(service_file, 'w') as f:
|
||||||
f.write(SERVICE.format(container=container, depends=depends, start_post=start_post))
|
f.write(SERVICE.format(container=container, depends=depends, start_post=start_post))
|
||||||
os.chmod(service_file, 0o755)
|
os.chmod(service_file, 0o755)
|
||||||
update_services()
|
|
||||||
|
|
||||||
def delete_service(service):
|
def delete_service(service):
|
||||||
if is_service_started(service):
|
if is_service_started(service):
|
||||||
@ -28,7 +27,6 @@ def delete_service(service):
|
|||||||
update_service_autostart(service, False)
|
update_service_autostart(service, False)
|
||||||
try:
|
try:
|
||||||
os.unlink(os.path.join(SERVICE_DIR, lxcize(service)))
|
os.unlink(os.path.join(SERVICE_DIR, lxcize(service)))
|
||||||
update_services()
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user