Attempt to stop containers in App update/uninstall, closes #3
This commit is contained in:
parent
cedd257f63
commit
bb694671f2
2
APKBUILD
2
APKBUILD
@ -1,7 +1,7 @@
|
||||
# Contributor: Disassembler <disassembler@dasm.cz>
|
||||
# Maintainer: Disassembler <disassembler@dasm.cz>
|
||||
pkgname=spoc
|
||||
pkgver=0.0.1
|
||||
pkgver=0.9.2
|
||||
pkgrel=0
|
||||
pkgdesc="SPOC application, container, and image manager"
|
||||
url="https://spotter.vm/"
|
||||
|
@ -85,7 +85,10 @@ def modify(container_name, depends, mounts, env, uid, gid, cmd, cwd, ready, halt
|
||||
|
||||
def destroy(container_name):
|
||||
# Remove container and its directory
|
||||
Container(container_name, False).destroy()
|
||||
container = Container(container_name, False)
|
||||
if container.is_running():
|
||||
container.stop()
|
||||
container.destroy()
|
||||
|
||||
def start(container_name, command):
|
||||
# Start the container using init values from its definition
|
||||
|
@ -108,8 +108,10 @@ class App:
|
||||
repo_local.register_app(self.name, self.get_definition())
|
||||
|
||||
def update(self, observer=None):
|
||||
# Remove containers
|
||||
# Stop and remove containers
|
||||
for container in self.containers.copy():
|
||||
if container.is_running():
|
||||
container.stop()
|
||||
container.destroy()
|
||||
self.containers.remove(container)
|
||||
# Load online definition
|
||||
@ -130,14 +132,13 @@ class App:
|
||||
repo_local.register_app(self.name, self.get_definition())
|
||||
|
||||
def uninstall(self, observer=None):
|
||||
# Make sure the containers are stopped
|
||||
# Stop and remove containers
|
||||
for container in self.containers:
|
||||
container.stop()
|
||||
if container.is_running():
|
||||
container.stop()
|
||||
container.destroy()
|
||||
# Run uninstall script
|
||||
self.run_script('uninstall')
|
||||
# Remove containers
|
||||
for container in self.containers:
|
||||
container.destroy()
|
||||
# Unregister app and remove scripts
|
||||
repo_local.unregister_app(self.name)
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user