diff --git a/capsulflask/console.py b/capsulflask/console.py
index 5da5cc8..d4cdbe8 100644
--- a/capsulflask/console.py
+++ b/capsulflask/console.py
@@ -189,7 +189,7 @@ def detail(id):
duration=duration
)
-def _create(vm_sizes, operating_systems, public_keys_for_account, affordable_vm_sizes, server_data):
+def _create(email, vm_sizes, operating_systems, public_keys_for_account, affordable_vm_sizes, server_data):
errors = list()
size = server_data.get("size")
@@ -241,14 +241,14 @@ def _create(vm_sizes, operating_systems, public_keys_for_account, affordable_vm_
if len(errors) == 0:
id = make_capsul_id()
current_app.config["HUB_MODEL"].create(
- email = session["account"],
+ email = email,
id=id,
os=os,
size=size,
template_image_file_name=operating_systems[os]['template_image_file_name'],
vcpus=vm_sizes[size]['vcpus'],
memory_mb=vm_sizes[size]['memory_mb'],
- ssh_authorized_keys=posted_keys
+ ssh_authorized_keys=list(map(lambda x: dict(name=x['name'], content=x['content']), posted_keys))
)
return id, errors
@@ -276,6 +276,7 @@ def create():
if "csrf-token" not in request.form or request.form['csrf-token'] != session['csrf-token']:
return abort(418, f"u want tea")
id, errors = _create(
+ session['account'],
vm_sizes,
operating_systems,
public_keys_for_account,
diff --git a/capsulflask/hub_model.py b/capsulflask/hub_model.py
index 0476632..929e812 100644
--- a/capsulflask/hub_model.py
+++ b/capsulflask/hub_model.py
@@ -198,6 +198,10 @@ class CapsulFlaskHub(VirtualizationInterface):
validate_capsul_id(id)
online_hosts = get_model().get_online_hosts()
#current_app.logger.debug(f"hub_model.create(): ${len(online_hosts)} hosts")
+
+ current_app.logger.error(f'{email}, {id} {os} {size} {template_image_file_name} {vcpus} {memory_mb}')
+ current_app.logger.error(f'{ssh_authorized_keys}')
+
payload = json.dumps(dict(
type="create",
email=email,
diff --git a/capsulflask/publicapi.py b/capsulflask/publicapi.py
index 3e8598d..fbb82f9 100644
--- a/capsulflask/publicapi.py
+++ b/capsulflask/publicapi.py
@@ -15,7 +15,7 @@ bp = Blueprint("publicapi", __name__, url_prefix="/api")
@bp.route("/capsul/create", methods=["POST"])
@account_required
def capsul_create():
- email = session["account"]
+ email = session["account"][0]
from .console import _create, get_account_balance, get_payments, get_vms
@@ -36,6 +36,7 @@ def capsul_create():
request.json['ssh_authorized_key_count'] = 1
id, errors = _create(
+ email,
vm_sizes,
operating_systems,
public_keys_for_account,
diff --git a/capsulflask/theme/yolocolo/base.html b/capsulflask/theme/yolocolo/base.html
index 72d149f..6e983d3 100644
--- a/capsulflask/theme/yolocolo/base.html
+++ b/capsulflask/theme/yolocolo/base.html
@@ -31,7 +31,7 @@
{% if session["account"] %}
Capsuls
- SSH Public Keys
+ SSH & API Keys
Account Balance
{% endif %}