Implement app update
This commit is contained in:
parent
d1e5b83186
commit
1e12d78efe
@ -42,11 +42,11 @@ def install(app_name):
|
|||||||
|
|
||||||
@locked(LOCK_FILE, print_lock)
|
@locked(LOCK_FILE, print_lock)
|
||||||
def update(app_name):
|
def update(app_name):
|
||||||
App(app_name).update()
|
App(app_name, False).update()
|
||||||
|
|
||||||
@locked(LOCK_FILE, print_lock)
|
@locked(LOCK_FILE, print_lock)
|
||||||
def uninstall(app_name):
|
def uninstall(app_name):
|
||||||
App(app_name).uninstall()
|
App(app_name, False).uninstall()
|
||||||
|
|
||||||
def start(app_name):
|
def start(app_name):
|
||||||
App(app_name).start()
|
App(app_name).start()
|
||||||
|
@ -87,11 +87,26 @@ class App:
|
|||||||
repo_local.register_app(self.name, self.get_definition())
|
repo_local.register_app(self.name, self.get_definition())
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
raise NotImplementedError()
|
# 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 online definition
|
||||||
|
definition = repo_online.get_app(self.name)
|
||||||
|
self.version = definition['version']
|
||||||
|
self.meta = definition['meta']
|
||||||
|
# Build containers
|
||||||
|
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')
|
||||||
|
repo_local.register_app(self.name, self.get_definition())
|
||||||
|
|
||||||
def uninstall(self):
|
def uninstall(self):
|
||||||
definition = repo_local.get_app(self.name)
|
|
||||||
self.run_script('uninstall')
|
self.run_script('uninstall')
|
||||||
|
# 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
|
# Remove containers
|
||||||
for container in definition['containers']:
|
for container in definition['containers']:
|
||||||
Container(container, False).destroy()
|
Container(container, False).destroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user