automation: establish an automation framework

This commit is contained in:
Iain Learmonth 2022-05-08 17:20:04 +01:00
parent 1b53bf451c
commit 8abe5d60fa
31 changed files with 586 additions and 274 deletions

View file

@ -20,11 +20,19 @@ def view_lifecycle(*,
resource: AbstractResource,
action: str):
form = LifecycleForm()
if action == "destroy":
form.submit.render_kw = {"class": "btn btn-danger"}
elif action == "deprecate":
form.submit.render_kw = {"class": "btn btn-warning"}
elif action == "kick":
form.submit.render_kw = {"class": "btn btn-success"}
if form.validate_on_submit():
if action == "destroy":
resource.destroy()
elif action == "deprecate":
resource.deprecate(reason="manual")
elif action == "kick":
resource.kick()
else:
flash("Unknown action")
return redirect(url_for("portal.portal_home"))