From fb9fc7185ad66ed7a2cc7549ba7d65ad932d0d5d Mon Sep 17 00:00:00 2001
From: Timotej Lazar
Date: Thu, 11 Oct 2018 17:22:30 +0200
Subject: Use backing files in created disk images
---
kpov_judge/web/kpov_judge/kpov_judge.py | 14 +++++++++--
.../web/kpov_judge/templates/task_greeting.html | 27 +++++++++++++++++-----
2 files changed, 33 insertions(+), 8 deletions(-)
(limited to 'kpov_judge/web')
diff --git a/kpov_judge/web/kpov_judge/kpov_judge.py b/kpov_judge/web/kpov_judge/kpov_judge.py
index b832007..2231db0 100755
--- a/kpov_judge/web/kpov_judge/kpov_judge.py
+++ b/kpov_judge/web/kpov_judge/kpov_judge.py
@@ -250,7 +250,11 @@ def task_greeting(class_id, task_id, lang):
# instructions = instructions.format(**public_params).encode('utf8')
except Exception as e:
instructions = str(e)
- computer_list = db.student_computers.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id})
+ computer_list = list(db.student_computers.find({'class_id': class_id, 'task_id': task_id, 'student_id': student_id}))
+ backing_images = set()
+ for computer in computer_list:
+ for disk_url in computer.get('disk_urls', []):
+ backing_images |= set(disk_url['backing'])
if request.args.get('narediStack', 'false') == 'true':
#db.student_tasks.update({'task_id': task_id, 'student_id': student_id}, {'$set': {'create_openstack': True}}, upsert = True)
openstackCreated = False # Spremeni na True, ko odkomentiras zgornjo vrstico.
@@ -261,7 +265,13 @@ def task_greeting(class_id, task_id, lang):
openstackCreated = True
else:
openstackCreated = False
- return render_template('task_greeting.html', computers=computer_list, lang=lang, openstack=openstackCreated, instructions=instructions)
+ return render_template('task_greeting.html',
+ disk_base_url='/'.join([app.config['STUDENT_DISK_URL'], student_id, class_id, task_id, '']),
+ computers=computer_list,
+ backing_images=sorted(backing_images),
+ lang=lang,
+ openstack=openstackCreated,
+ instructions=instructions)
@app.route('/tasks///params.json', methods=['GET', 'POST'])
diff --git a/kpov_judge/web/kpov_judge/templates/task_greeting.html b/kpov_judge/web/kpov_judge/templates/task_greeting.html
index 188145c..422f14b 100644
--- a/kpov_judge/web/kpov_judge/templates/task_greeting.html
+++ b/kpov_judge/web/kpov_judge/templates/task_greeting.html
@@ -2,9 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
-
-{{task_id}}
-
+{{task_id}}
Navodila
{{instructions}}
@@ -14,24 +12,40 @@
Podrobna navodila (HOWTO)
+
Računalniki v vaji
+
{% for c in computers %}
{{c['name']}}
{% if 'disk_urls' in c %}
{% else %}
Slike navideznih diskov so v izdelavi in bodo kmalu na voljo.
{% endif %}
{% endfor %}
-
+
-
+
+
+
+
+{% if backing_images %}
+Osnovne slike
+
+{% for b in backing_images %}
+ - {{b}}
+{% endfor %}
+
+{% endif %}
+
+
+
Lahko si ogledate surove:
+
{% if openstack %}
Openstack projekt za to vajo je že ustvarjen ali v izdelavi (funkcionalnost še ne deluje).
--
cgit v1.2.1