summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/set_motd/task.py
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/set_motd/task.py')
-rw-r--r--kpov_judge/tasks/set_motd/task.py26
1 files changed, 14 insertions, 12 deletions
diff --git a/kpov_judge/tasks/set_motd/task.py b/kpov_judge/tasks/set_motd/task.py
index b60830c..c8b42e3 100644
--- a/kpov_judge/tasks/set_motd/task.py
+++ b/kpov_judge/tasks/set_motd/task.py
@@ -8,13 +8,15 @@
instructions = {
"si":u"""
-Ustvari dva navidezna računalnika - imenujmo ju Test in Student. Za računalnik Test uporabite
-sliko diska, poimenovano Test. Na računalniku Test dobite kratek niz. Poskrbite, da se bo ta
+Ustvari dva navidezna računalnika - imenujmo ju SimpleArbiterDhcpGW in Student. Za računalnik SimpleArbiterDhcpGW uporabite
+sliko diska, poimenovano SimpleArbiterDhcpGW. Na računalniku SimpleArbiterDhcpGW dobite kratek niz. Poskrbite, da se bo ta
kratki niz pojavil v sporočilu, ki se ob prijavi izpiše na računalniku Student. Temu sporočilu v
angleščini rečemo "message of the day" - MOTD.
Poskrbite, da se bo ob prijavi uporabnika (v Message Of The Day, MOTD) prek ssh izpisal nek niz.
-Računalnik nastavite tako, da bo dostopen s testnega računalnika (Test).
+Računalnik nastavite tako, da bo dostopen s testnega računalnika (SimpleArbiterDhcpGW). Najpreprosteje bo,
+da SimpleArbiterDhcpGW priklopite na omrežje, ki ima dostop do Interneta (npr. prek NAT) in na navidezno omrežje med
+navideznimi računalniki (npr. intnet); računalnik Student priklopite le na navidezno omrežje (npr. intnet).
Uporabniško ime in niz dobite kot parametre ob zagonu run_test.py. Pri nizu pazite, saj utegne biti dovolj dolg, da brez premikanja kurzorja ne bo takoj viden.
@@ -23,9 +25,9 @@ IP navideznega računalnika ter geslo nastavite sami.
Ocenjevalni program pričakuje, da se bo ob koncu prijave pojavila ukazna vrstica oblike uporabnisko_ime@ime_racunalnika:~$ . Pazite, da se bo takšna vrstica pojavila šele po nizu, ki ste ga dobili v navodilih.
""",
'en':u"""
-Create two virtual machines - named Test and Student. For the 'Test' use disc image named Test. You receive short string on machine 'Test'. Make sure that this string appears in the message which is displayed after you login to machine 'Student'. This is so called 'message of the day'MOTD.
+Create two virtual machines - named SimpleArbiterDhcpGW and Student. For the 'SimpleArbiterDhcpGW' use disc image named SimpleArbiterDhcpGW. You receive short string on machine 'SimpleArbiterDhcpGW'. Make sure that this string appears in the message which is displayed after you login to machine 'Student'. This is so called 'message of the day'MOTD.
-Make sure that when the user logins via ssh some string is displayed. Set the machine, so that you can reach it from test computer (Test)
+Make sure that when the user logins via ssh some string is displayed. Set the machine, so that you can reach it from test computer (SimpleArbiterDhcpGW)
You get username and string as parameters when you run run_test.py. Pay attention to the string length, it might not be visible right away without moving the cursor.
@@ -36,13 +38,13 @@ Grading system expects, that at the end of login, a command line similar to upor
}
computers = {
- 'Test': {
+ 'SimpleArbiterDhcpGW': {
'disks': [
- { 'name': 'Test',
+ { 'name': 'SimpleArbiterDhcpGW',
},
],
'flavor': 'm1.tiny',
- 'network_interfaces': [{'network': 'net1'}],
+ 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
'config_drive': True,
'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
},
@@ -51,7 +53,7 @@ computers = {
{ 'name': 'Student', }
],
'flavor': 'm1.tiny',
- 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
+ 'network_interfaces': [{'network': 'net1'}],
'config_drive': True,
'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
}
@@ -71,12 +73,12 @@ def task(peer_ip, peer_user, peer_passwd, niz):
"Check whether ssh works"
import pxssh
import pexpect
- return {"hello": 'kitty'}
+ # return {"hello": 'kitty'}
results = dict()
s = pxssh.pxssh()
#TODO (polz): tole bi utegnilo delovati http://pexpect.sourceforge.net/pxssh.html. Testirajte
s.login (peer_ip, peer_user, peer_passwd, original_prompt=r'{0}@.*:\~\$'.format(peer_user),auto_prompt_reset=False)
- #s.prompt()
+ s.prompt()
#Ce na serverju iz datoteke /var/run/motd.dynamic pobrisemo znak '#' bi moralo delovati.
temp = s.before # print everything before the prompt.
@@ -89,7 +91,7 @@ def gen_params(user_id, params_meta):
return kpov_random_helpers.default_gen(user_id, params_meta)
def task_check(results, params):
- print task_url
+ #print task_url
niz = params['niz']
score = 0
if (results['motd'].find(niz) > -1):