diff --git a/usr/lib/python3.8/spoc/app.py b/usr/lib/python3.8/spoc/app.py index 88563fe..ef7ae0b 100644 --- a/usr/lib/python3.8/spoc/app.py +++ b/usr/lib/python3.8/spoc/app.py @@ -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):