Don't duplicate existing container records during app update, closes #4
This commit is contained in:
parent
9269c4384c
commit
da892401dd
@ -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
|
||||
self.run_script('update')
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user