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()) repo_local.register_app(self.name, self.get_definition())
def update(self): 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 # Remove containers
for container in definition['containers']: # Load the local repo data here instead set_definition() to avoid fully defining containers which may not exist already
Container(container, False).destroy() containers = [Container(container, False) for container in repo_local.get_app(self.name)['containers']]
for container in containers:
container.destroy()
# Load online definition # Load online definition
definition = repo_online.get_app(self.name) definition = repo_online.get_app(self.name)
self.version = definition['version'] self.version = definition['version']
@ -104,12 +104,16 @@ class App:
repo_local.register_app(self.name, self.get_definition()) repo_local.register_app(self.name, self.get_definition())
def uninstall(self): 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 # 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 # Remove containers
for container in definition['containers']: for container in containers:
Container(container, False).destroy() container.destroy()
# Unregister app and remove scripts # Unregister app and remove scripts
repo_local.unregister_app(self.name) repo_local.unregister_app(self.name)
try: try: