allow deleting external applications
This commit is contained in:
parent
808533fabd
commit
5ac175e44e
2 changed files with 12 additions and 5 deletions
|
@ -25,7 +25,7 @@ class App(db.Model):
|
|||
id = db.Column(Integer, primary_key=True)
|
||||
name = db.Column(String(length=64))
|
||||
slug = db.Column(String(length=64), unique=True)
|
||||
external = db.Column(Boolean, unique=False, nullable=False, default=True, server_default='0')
|
||||
external = db.Column(Boolean, unique=False, nullable=False, server_default='0')
|
||||
# The URL is only stored in the DB for external applications; otherwise the
|
||||
# URL is stored in a configmap (see get_url)
|
||||
url = db.Column(String(length=128), unique=False)
|
||||
|
@ -229,6 +229,12 @@ class AppStatus(): # pylint: disable=too-few-public-methods
|
|||
:type app: App
|
||||
"""
|
||||
def __init__(self, app):
|
||||
if app.external:
|
||||
self.installed = True
|
||||
self.ready = True
|
||||
self.message = "App is external"
|
||||
return
|
||||
|
||||
kustomization = app.kustomization
|
||||
if kustomization is not None and "status" in kustomization:
|
||||
ks_ready, ks_message = AppStatus.check_condition(kustomization['status'])
|
||||
|
|
|
@ -105,12 +105,13 @@ def delete_app(slug):
|
|||
return
|
||||
|
||||
app_status = app_obj.get_status()
|
||||
if not app_status.installed:
|
||||
app_obj.delete()
|
||||
current_app.logger.info("Success.")
|
||||
else:
|
||||
if app_status.installed and not app_obj.external:
|
||||
current_app.logger.info("Can not delete installed application, run"
|
||||
" 'uninstall' first")
|
||||
return
|
||||
|
||||
app_obj.delete()
|
||||
current_app.logger.info("Success.")
|
||||
|
||||
|
||||
@app_cli.command(
|
||||
|
|
Loading…
Reference in a new issue