summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/set_motd
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-28 13:38:28 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-01-28 13:38:28 +0000
commit6a4a5a588e247d9a51425ebe62595e043a84b0d2 (patch)
treed32edf4d545a10dd340bf71097f0a3491e12845b /kpov_judge/tasks/set_motd
parentb46ce13d4e5421990dbc709b42398786c179d40e (diff)
Some fixes for task set_motd
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@246 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks/set_motd')
-rw-r--r--kpov_judge/tasks/set_motd/howtos/si/index.html55
-rw-r--r--kpov_judge/tasks/set_motd/task.py26
2 files changed, 19 insertions, 62 deletions
diff --git a/kpov_judge/tasks/set_motd/howtos/si/index.html b/kpov_judge/tasks/set_motd/howtos/si/index.html
index 4cca135..0df073c 100644
--- a/kpov_judge/tasks/set_motd/howtos/si/index.html
+++ b/kpov_judge/tasks/set_motd/howtos/si/index.html
@@ -1,22 +1,4 @@
-<<<<<<< .mine
-<!--
-Ustvari dva navidezna raunalnika - imenujmo ju Test in Student. Za raunalnik Test uporabite
-sliko diska, poimenovano Test. Na raunalniku Test dobite kratek niz. Poskrbite, da se bo ta
-kratki niz pojavil v sporoilu, ki se ob prijavi izpie na raunalniku Student. Temu sporoilu v
-angleini reemo "message of the day" - MOTD.
-Poskrbite, da se bo ob prijavi uporabnika (v Message Of The Day, MOTD) prek ssh izpisal nek niz.
-Raunalnik nastavite tako, da bo dostopen s testnega raunalnika (Test).
-
-Uporabniko 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.
-
-IP navideznega raunalnika ter geslo nastavite sami.
-
-Ocenjevalni program priakuje, 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.
--->
-
-<h2>Namen vaje</h2>
<h2>Naloga na hitro</h2>
@@ -35,39 +17,12 @@ Pazite, da se bo takšna vrstica pojavila ele po nizu, ki ste ga dobili v navod
<li></li>
</ol></h2>
=======
-<!--
-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
-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).
-
-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.
-
-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.
-
-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.
-
-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)
-
-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.
-
-Set up IP and password of virtual machine yourself.
-
-Grading system expects, that at the end of login, a command line similar to uporabnisko_ime@ime_racunalnika:~$ appears.
-Make sure that this line shows up after the string you got in the instructions.
--->
+<h2>Namen vaje</h2>
+<p>Kako se ustvari uporabnik? Kako se popravi datoteka? Kako se s pomočjo ssh
+povežemo na drug računalnik? Kako ugotovimo IP naslov računalnika?</p>
<h2>Naloga na hitro</h2>
-<p></p>
+<p>Postavi 2 navidezna računalnika, nastavi MOTD.</p>
<h2>Navodila</h2>
<ul>
@@ -83,4 +38,4 @@ Make sure that this line shows up after the string you got in the instructions.
<li>Prijavi se v računalnik <br /> <img src="../images/first.png"></li>
<li>S poljubnim urejevalnikom besedila odpri <b>/etc/motd</b> <br /> <img src="../images/second.png"></li>
<li>Nastavite MOTD na vaš dodeljen String</li>
-</ol>>>>>>>> .r197
+</ol>
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):