forked from 3wordchant/capsul-flask
add logging around ssh keys to capsul creation to support a user who is
experiencing bugs
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import re
|
||||
import sys
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from flask import Blueprint
|
||||
from flask import flash
|
||||
@ -127,6 +128,9 @@ def create():
|
||||
account_balance = get_account_balance(get_vms(), get_payments(), datetime.utcnow())
|
||||
capacity_avaliable = current_app.config["VIRTUALIZATION_MODEL"].capacity_avaliable(512*1024*1024)
|
||||
errors = list()
|
||||
|
||||
email_to_log = session["account"]
|
||||
current_app.logger.info(f"create for {email_to_log}: ssh keys from db:\n {json.dumps(ssh_public_keys)}")
|
||||
|
||||
if request.method == "POST":
|
||||
if "csrf-token" not in request.form or request.form['csrf-token'] != session['csrf-token']:
|
||||
@ -151,11 +155,15 @@ def create():
|
||||
errors.append("something went wrong with ssh keys")
|
||||
else:
|
||||
for i in range(0, posted_keys_count):
|
||||
to_log_bool = f"ssh_key_{i}" in request.form
|
||||
current_app.logger.info(f"checking for ssh_key_{i}: {to_log_bool}")
|
||||
if f"ssh_key_{i}" in request.form:
|
||||
posted_name = request.form[f"ssh_key_{i}"]
|
||||
current_app.logger.info(f"ssh key posted_name: {posted_name}")
|
||||
key = None
|
||||
for x in ssh_public_keys:
|
||||
if x['name'] == posted_name:
|
||||
current_app.logger.info(f"ssh key posted_name {posted_name} was found")
|
||||
key = x
|
||||
if key:
|
||||
posted_keys.append(key)
|
||||
@ -172,6 +180,8 @@ def create():
|
||||
host(s) at capacity. no capsuls can be created at this time. sorry.
|
||||
""")
|
||||
|
||||
current_app.logger.info(f"create for {email_to_log}: posted_keys:\n {json.dumps(posted_keys)}")
|
||||
|
||||
if len(errors) == 0:
|
||||
id = makeCapsulId()
|
||||
get_model().create_vm(
|
||||
|
Reference in New Issue
Block a user