Don't duplicate existing container records during app update, closes #4

This commit is contained in:
Disassembler 2020-04-26 17:16:41 +02:00
parent 9269c4384c
commit da892401dd
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499

View File

@ -109,8 +109,9 @@ class App:
def update(self, observer=None):
# Remove containers
for container in self.containers:
for container in self.containers.copy():
container.destroy()
self.containers.remove(container)
# Load online definition
definition = repo_online.get_app(self.name)
self.version = definition['version']
@ -119,7 +120,13 @@ class App:
for container,container_defintion in definition['containers'].items():
self.create_container(container, container_defintion)
# Run update script and re-register the app
try:
self.run_script('update')
except:
# Stop all containers if update.sh fails
for container in self.containers:
container.stop()
raise
repo_local.register_app(self.name, self.get_definition())
def uninstall(self, observer=None):