forked from 3wordchant/capsul-flask
remove extra debug logs
This commit is contained in:
parent
50cea6e0b4
commit
a7c61f01df
@ -117,9 +117,6 @@ def detail(id):
|
|||||||
vm["created"] = vm['created'].strftime("%b %d %Y %H:%M")
|
vm["created"] = vm['created'].strftime("%b %d %Y %H:%M")
|
||||||
vm["ssh_authorized_keys"] = ", ".join(vm["ssh_authorized_keys"]) if len(vm["ssh_authorized_keys"]) > 0 else "<missing>"
|
vm["ssh_authorized_keys"] = ", ".join(vm["ssh_authorized_keys"]) if len(vm["ssh_authorized_keys"]) > 0 else "<missing>"
|
||||||
|
|
||||||
|
|
||||||
current_app.logger.info(f"asd {needs_ssh_host_keys} {json.dumps(vm['ssh_host_keys'])})")
|
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"capsul-detail.html",
|
"capsul-detail.html",
|
||||||
csrf_token = session["csrf-token"],
|
csrf_token = session["csrf-token"],
|
||||||
@ -139,10 +136,6 @@ def create():
|
|||||||
account_balance = get_account_balance(get_vms(), get_payments(), datetime.utcnow())
|
account_balance = get_account_balance(get_vms(), get_payments(), datetime.utcnow())
|
||||||
capacity_avaliable = current_app.config["VIRTUALIZATION_MODEL"].capacity_avaliable(512*1024*1024)
|
capacity_avaliable = current_app.config["VIRTUALIZATION_MODEL"].capacity_avaliable(512*1024*1024)
|
||||||
errors = list()
|
errors = list()
|
||||||
|
|
||||||
ssh_keys_from_db_string = "\n".join(list(map(lambda x: f"name: {x['name']}**content: {x['content']}", public_keys_for_account)))
|
|
||||||
email_to_log = session["account"]
|
|
||||||
current_app.logger.info(f"create for {email_to_log}: ssh keys from db:\n {ssh_keys_from_db_string}")
|
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
if "csrf-token" not in request.form or request.form['csrf-token'] != session['csrf-token']:
|
if "csrf-token" not in request.form or request.form['csrf-token'] != session['csrf-token']:
|
||||||
@ -167,15 +160,11 @@ def create():
|
|||||||
errors.append("something went wrong with ssh keys")
|
errors.append("something went wrong with ssh keys")
|
||||||
else:
|
else:
|
||||||
for i in range(0, posted_keys_count):
|
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:
|
if f"ssh_key_{i}" in request.form:
|
||||||
posted_name = request.form[f"ssh_key_{i}"]
|
posted_name = request.form[f"ssh_key_{i}"]
|
||||||
current_app.logger.info(f"ssh key posted_name: {posted_name}")
|
|
||||||
key = None
|
key = None
|
||||||
for x in public_keys_for_account:
|
for x in public_keys_for_account:
|
||||||
if x['name'] == posted_name:
|
if x['name'] == posted_name:
|
||||||
current_app.logger.info(f"ssh key posted_name {posted_name} was found")
|
|
||||||
key = x
|
key = x
|
||||||
if key:
|
if key:
|
||||||
posted_keys.append(key)
|
posted_keys.append(key)
|
||||||
@ -192,9 +181,6 @@ def create():
|
|||||||
host(s) at capacity. no capsuls can be created at this time. sorry.
|
host(s) at capacity. no capsuls can be created at this time. sorry.
|
||||||
""")
|
""")
|
||||||
|
|
||||||
posted_keys_string = "\n".join(list(map(lambda x: f"name: {x['name']}**content: {x['content']}", posted_keys)))
|
|
||||||
current_app.logger.info(f"create for {email_to_log}: posted_keys:\n {posted_keys_string}")
|
|
||||||
|
|
||||||
if len(errors) == 0:
|
if len(errors) == 0:
|
||||||
id = makeCapsulId()
|
id = makeCapsulId()
|
||||||
get_model().create_vm(
|
get_model().create_vm(
|
||||||
|
@ -123,8 +123,6 @@ class DBModel:
|
|||||||
)
|
)
|
||||||
|
|
||||||
for ssh_authorized_key in ssh_authorized_keys:
|
for ssh_authorized_key in ssh_authorized_keys:
|
||||||
current_app.logger.info(f"INSERT INTO vm_ssh_authorized_key (email, vm_id, ssh_public_key_name) VALUES (\"{email}\", \"{id}\", \"{ssh_authorized_key}\")")
|
|
||||||
|
|
||||||
self.cursor.execute("""
|
self.cursor.execute("""
|
||||||
INSERT INTO vm_ssh_authorized_key (email, vm_id, ssh_public_key_name)
|
INSERT INTO vm_ssh_authorized_key (email, vm_id, ssh_public_key_name)
|
||||||
VALUES (%s, %s, %s)
|
VALUES (%s, %s, %s)
|
||||||
|
@ -102,9 +102,6 @@ main {
|
|||||||
.row.grid-large > div {
|
.row.grid-large > div {
|
||||||
flex: 1 1 20em;
|
flex: 1 1 20em;
|
||||||
}
|
}
|
||||||
.row.grid-medium > div {
|
|
||||||
flex: 1 1 13em;
|
|
||||||
}
|
|
||||||
.row.grid-small > div {
|
.row.grid-small > div {
|
||||||
flex: 0 0 8em;
|
flex: 0 0 8em;
|
||||||
}
|
}
|
||||||
|
@ -147,8 +147,6 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
|||||||
|
|
||||||
ssh_keys_string = "\n".join(ssh_authorized_keys)
|
ssh_keys_string = "\n".join(ssh_authorized_keys)
|
||||||
|
|
||||||
current_app.logger.info(f"create vm virt model ssh_keys_string: {ssh_keys_string}")
|
|
||||||
|
|
||||||
completedProcess = run([
|
completedProcess = run([
|
||||||
join(current_app.root_path, 'shell_scripts/create.sh'),
|
join(current_app.root_path, 'shell_scripts/create.sh'),
|
||||||
id,
|
id,
|
||||||
@ -170,8 +168,6 @@ class ShellScriptVirtualization(VirtualizationInterface):
|
|||||||
ssh_authorized_keys={ssh_keys_string}
|
ssh_authorized_keys={ssh_keys_string}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
current_app.logger.info(f"create vm status: {status} vmSettings: {vmSettings}")
|
|
||||||
|
|
||||||
if not status == "success":
|
if not status == "success":
|
||||||
raise ValueError(f"""failed to create vm for {email} with:
|
raise ValueError(f"""failed to create vm for {email} with:
|
||||||
{vmSettings}
|
{vmSettings}
|
||||||
|
Loading…
Reference in New Issue
Block a user