Make sure the containers are stopped before uninstalling

This commit is contained in:
Disassembler 2020-03-26 19:14:25 +01:00
parent d4bbce2dcf
commit 6df8bf0616
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -87,11 +87,11 @@ class App:
repo_local.register_app(self.name, self.get_definition())
def update(self):
# Load the local repo data here instead set_definition() to avoid fully defining containers which may not exist already
definition = repo_local.get_app(self.name)
# Remove containers
for container in definition['containers']:
Container(container, False).destroy()
# Load the local repo data here instead set_definition() to avoid fully defining containers which may not exist already
containers = [Container(container, False) for container in repo_local.get_app(self.name)['containers']]
for container in containers:
container.destroy()
# Load online definition
definition = repo_online.get_app(self.name)
self.version = definition['version']
@ -104,12 +104,16 @@ class App:
repo_local.register_app(self.name, self.get_definition())
def uninstall(self):
self.run_script('uninstall')
# Make sure the containers are stopped
# Load the local repo data here instead set_definition() to avoid fully defining containers which may not exist already
definition = repo_local.get_app(self.name)
containers = [Container(container, False) for container in repo_local.get_app(self.name)['containers']]
for container in containers:
container.stop()
# Run uninstall script
self.run_script('uninstall')
# Remove containers
for container in definition['containers']:
Container(container, False).destroy()
for container in containers:
container.destroy()
# Unregister app and remove scripts
repo_local.unregister_app(self.name)
try: