Fix merge conflicts
Merge branch 'main' into 45-allow-database-to-have-external-apps
This commit is contained in:
commit
dd5d4f1acd
5 changed files with 265 additions and 805 deletions
|
|
@ -17,7 +17,7 @@ from config import HYDRA_ADMIN_URL, KRATOS_ADMIN_URL, KRATOS_PUBLIC_URL
|
|||
from helpers import KratosUser
|
||||
from cliapp import cli
|
||||
from areas.roles import Role
|
||||
from areas.apps import AppRole, App, APP_NOT_INSTALLED_STATUS
|
||||
from areas.apps import AppRole, App
|
||||
from database import db
|
||||
|
||||
# APIs
|
||||
|
|
@ -126,9 +126,14 @@ def delete_app(slug):
|
|||
current_app.logger.info("Not found")
|
||||
return
|
||||
|
||||
deleted = app_obj.delete()
|
||||
current_app.logger.info(f"Success: {deleted}")
|
||||
return
|
||||
app_status = app_obj.get_status()
|
||||
if not app_status.installed:
|
||||
app_obj.delete()
|
||||
current_app.logger.info("Success.")
|
||||
else:
|
||||
current_app.logger.info("Can not delete installed application, run"
|
||||
" 'uninstall' first")
|
||||
|
||||
|
||||
@app_cli.command(
|
||||
"uninstall",
|
||||
|
|
@ -138,15 +143,15 @@ def uninstall_app(slug):
|
|||
"""Uninstalls the app from the cluster
|
||||
:param slug: str Slug of app to remove
|
||||
"""
|
||||
current_app.logger.info(f"Trying to delete app: {slug}")
|
||||
current_app.logger.info(f"Trying to uninstall app: {slug}")
|
||||
app_obj = App.query.filter_by(slug=slug).first()
|
||||
|
||||
if not app_obj:
|
||||
current_app.logger.info("Not found")
|
||||
return
|
||||
|
||||
uninstalled = app_obj.uninstall()
|
||||
current_app.logger.info(f"Success: {uninstalled}")
|
||||
app_obj.uninstall()
|
||||
current_app.logger.info("Success.")
|
||||
return
|
||||
|
||||
@app_cli.command("status")
|
||||
|
|
@ -163,7 +168,7 @@ def status_app(slug):
|
|||
current_app.logger.error(f"App {slug} does not exist")
|
||||
return
|
||||
|
||||
current_app.logger.info(f"Status: {app.get_status()}")
|
||||
current_app.logger.info(app.get_status())
|
||||
|
||||
@app_cli.command("install")
|
||||
@click.argument("slug")
|
||||
|
|
@ -185,13 +190,12 @@ def install_app(slug):
|
|||
return
|
||||
|
||||
current_status = app.get_status()
|
||||
if current_status == APP_NOT_INSTALLED_STATUS:
|
||||
if not current_status.installed:
|
||||
app.install()
|
||||
current_app.logger.info(
|
||||
f"App {slug} installing... use `status` to see status")
|
||||
else:
|
||||
current_app.logger.error("App {slug} should have status"
|
||||
f" {APP_NOT_INSTALLED_STATUS} but has status: {current_status}")
|
||||
current_app.logger.error(f"App {slug} is already installed")
|
||||
|
||||
@app_cli.command("roles")
|
||||
@click.argument("slug")
|
||||
|
|
|
|||
Reference in a new issue