|
|
|
@ -30,9 +30,6 @@ def make_capsul_id():
|
|
|
|
|
def double_check_capsul_address(id, get_ssh_host_keys): |
|
|
|
|
try: |
|
|
|
|
result = current_app.config["HUB_MODEL"].get(id, get_ssh_host_keys) |
|
|
|
|
# if result != None and result.ipv4 != None and result.ipv4 != ipv4: |
|
|
|
|
# ipv4 = result.ipv4 |
|
|
|
|
# get_model().update_vm_ip(email=session["account"], id=id, ipv4=result.ipv4) |
|
|
|
|
|
|
|
|
|
if result != None and result.ssh_host_keys != None and get_ssh_host_keys: |
|
|
|
|
get_model().update_vm_ssh_host_keys(email=session["account"], id=id, ssh_host_keys=result.ssh_host_keys) |
|
|
|
@ -122,6 +119,7 @@ def detail(id):
|
|
|
|
|
return abort(400, "action is required") |
|
|
|
|
|
|
|
|
|
if request.form['action'] == "start": |
|
|
|
|
get_model().set_desired_state(email=session["account"], vm_id=id, desired_state="running") |
|
|
|
|
current_app.config["HUB_MODEL"].vm_state_command(email=session['account'], id=id, command="start") |
|
|
|
|
|
|
|
|
|
vm["state"] = "starting" |
|
|
|
@ -150,6 +148,7 @@ def detail(id):
|
|
|
|
|
) |
|
|
|
|
else: |
|
|
|
|
current_app.logger.info(f"force stopping {vm['id']} per user request ({session['account']})") |
|
|
|
|
get_model().set_desired_state(email=session["account"], vm_id=id, desired_state="shut off") |
|
|
|
|
current_app.config["HUB_MODEL"].vm_state_command(email=session['account'], id=id, command="force-stop") |
|
|
|
|
|
|
|
|
|
vm["state"] = "stopped" |
|
|
|
|