From 6df8bf06168394a21ce1a42caadb4b29e33a0216 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Thu, 26 Mar 2020 19:14:25 +0100 Subject: [PATCH] Make sure the containers are stopped before uninstalling --- usr/lib/python3.8/spoc/app.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/usr/lib/python3.8/spoc/app.py b/usr/lib/python3.8/spoc/app.py index 22b8175..476162d 100644 --- a/usr/lib/python3.8/spoc/app.py +++ b/usr/lib/python3.8/spoc/app.py @@ -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: