summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-09 18:00:43 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-09 18:00:43 +0000
commitd3e8f24b4da66059058627168f3f71eaf7626a93 (patch)
treecf2f524d42af38ef0b5ea556f8bc41df4bf07779 /kpov_judge/tasks
parent54c45f7e5e85a088eeb301fb3677f9c743cccbb5 (diff)
fixed disk template names
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@298 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/copy_rename_20_files_tail_env/task.py75
-rw-r--r--kpov_judge/tasks/custom_rdate/task.py6
-rw-r--r--kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/mini.isobin40894464 -> 0 bytes
-rw-r--r--kpov_judge/tasks/isc_dhcp_live_boot/task.py6
-rw-r--r--kpov_judge/tasks/ldap_search/task.py4
-rw-r--r--kpov_judge/tasks/nat_vlc/task.py4
-rw-r--r--kpov_judge/tasks/openvpn_simple_smb/task.py14
-rw-r--r--kpov_judge/tasks/radius_mysql_pam/task.py4
-rw-r--r--kpov_judge/tasks/set_motd/task.py5
-rw-r--r--kpov_judge/tasks/smb_nfs/task.py8
-rw-r--r--kpov_judge/tasks/snmp_agent_uptime/task.py8
-rw-r--r--kpov_judge/tasks/vlc_stream_rtp/task.py31
12 files changed, 101 insertions, 64 deletions
diff --git a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
index 44e9f87..d020a7a 100644
--- a/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
+++ b/kpov_judge/tasks/copy_rename_20_files_tail_env/task.py
@@ -8,12 +8,14 @@ instructions = {
Prijavi se na sistem kot uporabnik student z geslom vaje.
V domači mapi najdeš imenik {file_rename_dirname} z 20 datotekami.
- Preimenuj vse datoteke tako, da zamenjaš minuse s podčrtaji
- - Napiši čim krajši ukaz v bash, ki vse datoteke iz imenika {mv_src_dir}
- podanega imenika premakne v imenik {mv_dst_dir}. Spravi ga v
- /home/student/mv_ukaz. Pazi, da bodo ob testiranju v izvornem imeniku iste
- datoteke, kot so bile, ko je bila virtualka nova, ciljni imenik pa bo prazen.
- - Napiši ukaz, ki s pomočjo ukaza grep v datoteko ~/mama.txt izpiše vse
- navadne (ne skrite) datoteke v trenutnem imeniku, ki vsebujejo niz "mama",
+ - Napiši najkrajši ukaz v bash, ki vse datoteke iz imenika {mv_src_dir}
+ premakne v imenik {mv_dst_dir}. Ukaz spravi v
+ /home/student/mv_ukaz. Pazi, da bodo ob testiranju v izvornem imeniku ISTE
+ datoteke, kot so bile, ko je bila virtualka nova, ciljni imenik pa bo
+ prazen. To pomeni, da boste verjetno morali po vsakem testiranju datoteke
+ premakniti nazaj. Za krajšanje ukaza lahko izkoristite imeni imenikov.
+ - Napiši ukaz, ki s pomočjo ukaza grep v datoteko ~/mama.txt izpiše imena vseh
+ navadnih (ne skritih) datotek v trenutnem imeniku, ki vsebujejo niz "mama",
v datoteko ~/napake.txt pa izpiše vse morebitne napake (npr. to, da so nekateri
objekti v trenutnem imeniku dejansko imeniki ali napačne simbolične povezave).
Ukaz spravite v datoteko /home/student/mama_ukaz.
@@ -37,12 +39,17 @@ In your home folder you will find a directory called {file_rename_dirname}
underscores
- Find the shortest command for copying all the files located in
{mv_src_dir} into the folder {mv_dst_dir}.
- Create a shell script /home/student/mv_ukaz containing this commant
- - Specify the shortest command which will, using the grep command,
- write all normal (not hidden) files containing a string "mama" located
- in working directory (pwd) into the file ~/mama.txt while writing errors such as
- files in current directory being folders or symbolic links in the file called
- "napake.txt"
+ Create a shell script /home/student/mv_ukaz containing this command.
+ Before running test_task, make sure {mv_src_dir} contains the same
+ files as when you downloaded your virtual disk. This probably means
+ that you will have to move the files back from {mv_dst_dir} to
+ {mv_src_dir} after each test. You can use the directory na
+ - Come up with a command or sequence of commands in bash which will,
+ using grep, write the names all normal (not hidden) files which contain
+ the string "mama" and are located in the working directory (pwd)
+ into the file ~/mama.txt while writing errors such as files in current
+ directory being folders or symbolic links in the file called
+ "napake.txt". Write this command
- Write a program (which may be a shell script) that will track the contents
of /var/log/syslog for 5s. Every time an entry containing the string "zmeda"
appears in the syslog, in syslog, the script should output "imam ga".
@@ -70,7 +77,7 @@ computers = {
# 'parts': [],# no parts, no mounting.
#}
],
- 'network_interfaces': [{'network': 'net1'}],
+ 'network_interfaces': [{'network': 'test-net'}],
'flavor': 'm1.tiny',
'config_drive': False
@@ -85,13 +92,13 @@ computers = {
# 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
#},
],
- 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
+ 'network_interfaces': [{'network': 'test-net'}],
'flavor': 'm1.tiny',
'config_drive': False
}
}
-networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
+networks = {'test-net': {'public': True} }
params_meta = {
'IP_malishell': {'descriptions': {'si': 'Naslov malishell'}, 'w': True, 'public':True, 'type': 'IP', 'generated': False},
@@ -170,7 +177,10 @@ def task(IP_malishell, file_rename_dirname, mv_src_dir, mv_dst_dir, cowsay_strin
conn.sendline('cowsay "{}"'.format(cowsay_string))
conn.prompt()
results['cowsay'] = conn.before
- results['curl_env'] = os.environ['images']
+ try:
+ results['curl_env'] = os.environ['images']
+ except:
+ results['curl_env'] = ''
conn.sendline('cat {}/count.txt'.format(wc_dirname))
conn.prompt()
results['wc_origfile'] = conn.before
@@ -239,17 +249,20 @@ def task_check(results, params):
hints += ["wrong dash rename"]
# premakni datoteke s cim krajsim ukazom
fnames = []
- for i in xrange(40):
- fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)]))
- task2_re = re.search(
- r"-rw[x-][r-][w-][x-][r-][w-][x-] \d* student student (\d*) .*mv_ukaz",
- results['mv_ls_size'])
- mv_ls_size = int(task2_re.group(1))
- task2_ok = mv_ls_size < 15 and mv_ls_size > 2
+ try:
+ for i in xrange(40):
+ fnames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)]))
+ task2_re = re.search(
+ r"-rw[x-][r-][w-][x-][r-][w-][x-] \d* student student (\d*) .*mv_ukaz",
+ results['mv_ls_size'])
+ mv_ls_size = int(task2_re.group(1))
+ task2_ok = mv_ls_size <= 17 and mv_ls_size > 2
+ except:
+ task2_ok = False
if task2_ok:
score += 1
else:
- hints += ["wrong rename size"]
+ hints += ["wrong mv_command size or owner"]
pre_src = set([i.strip() for i in results['pre_mv_src'].split('\n')[3:-1]])
pre_dst = set([i.strip() for i in results['pre_mv_dst'].split('\n')[3:-1]])
task2_ok = task2_ok and pre_src == set(fnames)
@@ -309,7 +322,9 @@ def task_check(results, params):
hints += ["wrong syslog count"]
#
task5_ok = True
- if int(results['curl_env'].strip()) != int(params['curl_n_images']):
+ try:
+ assert int(results['curl_env'].strip()) != int(params['curl_n_images'])
+ except:
task5_ok = False
if task5_ok:
score += 2
@@ -319,7 +334,9 @@ def task_check(results, params):
wc_cat_str = 'cat {}/lines.txt'.format(params['wc_dirname'])
if not wc_cat_str == results['wc_lines'][:len(wc_cat_str)]:
task6_ok = False
- if int(results['wc_lines'][len(wc_cat_str):].strip()) != int(params['wc_n_lines']):
+ try:
+ assert int(results['wc_lines'][len(wc_cat_str):].strip()) == int(params['wc_n_lines'])
+ except:
task6_ok = False
if task6_ok:
score += 1
@@ -330,9 +347,9 @@ def task_check(results, params):
def prepare_disks(templates, params):
# d = templates['simpleArbiterDhcp']
import random
- print "Haha!"
- print params
- print templates
+ #print "Haha!"
+ #print params
+ #print templates
d = templates['malishell']
r = random.Random(params['file_creator_random_seed'])
# rename
diff --git a/kpov_judge/tasks/custom_rdate/task.py b/kpov_judge/tasks/custom_rdate/task.py
index ee1e245..8c2724d 100644
--- a/kpov_judge/tasks/custom_rdate/task.py
+++ b/kpov_judge/tasks/custom_rdate/task.py
@@ -37,7 +37,7 @@ resulting integer (as a string) to standard output.
computers = {
'rdateClient': {
'disks': [
- { 'name': 'rdateClient',
+ { 'name': 'student-rdate',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -51,7 +51,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcpRdate',
+ { 'name': 'simpleArbiterDhcpGWRdate',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -147,7 +147,7 @@ def prepare_disks(templates, params):
# d = templates['simpleArbiterDhcp']
# print templates
# print params
- d = templates['simpleArbiterDhcpRdate']
+ d = templates['simpleArbiterDhcpGWRdate']
s1 = """service "time_tcp" {{
enabled yes;
protocol tcp;
diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/mini.iso b/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/mini.iso
deleted file mode 100644
index 33c0dc9..0000000
--- a/kpov_judge/tasks/isc_dhcp_live_boot/howtos/images/mini.iso
+++ /dev/null
Binary files differ
diff --git a/kpov_judge/tasks/isc_dhcp_live_boot/task.py b/kpov_judge/tasks/isc_dhcp_live_boot/task.py
index 0e86c11..eb4ad01 100644
--- a/kpov_judge/tasks/isc_dhcp_live_boot/task.py
+++ b/kpov_judge/tasks/isc_dhcp_live_boot/task.py
@@ -45,7 +45,7 @@ Both BootableCLientA and BootableClientB should be diskless.
computers = {
'DHCPServer': {
'disks': [
- { 'name': 'DHCPServer',
+ { 'name': 'student-DHCPServer',
},
{ 'name': 'bootable_usb',
'options':{'readonly': True},
@@ -196,7 +196,7 @@ def task_check(results, params):
def prepare_disks(templates, params):
# d = templates['simpleArbiterDhcp']
- d = templates['DHCPServer']
+ d = templates['student-DHCPServer']
s = """# use this exact config for your booting clients.
# search path for the c32 support libraries (libcom32, libutil etc.)
path
@@ -206,7 +206,7 @@ prompt 0
timeout 0
# {}""".format(params['TFTP_STRING'])
d.write('/mnt/syslinux.cfg', s)
- d = templates['SimpleArbiter']
+ d = templates['simpleArbiterGW']
s = """auto lo
iface lo inet loopback
diff --git a/kpov_judge/tasks/ldap_search/task.py b/kpov_judge/tasks/ldap_search/task.py
index bbc636f..eeaf8cd 100644
--- a/kpov_judge/tasks/ldap_search/task.py
+++ b/kpov_judge/tasks/ldap_search/task.py
@@ -70,7 +70,7 @@ The program will be given the CN of the object as it's first argument.
computers = {
'LDAPServer': {
'disks': [
- { 'name': 'LDAPServer',
+ { 'name': 'student-LDAPServer',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -84,7 +84,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiterDhcpGW',
# attempt automount
},
#{ 'name': 'CDROM',
diff --git a/kpov_judge/tasks/nat_vlc/task.py b/kpov_judge/tasks/nat_vlc/task.py
index 556535c..25708a3 100644
--- a/kpov_judge/tasks/nat_vlc/task.py
+++ b/kpov_judge/tasks/nat_vlc/task.py
@@ -37,7 +37,7 @@ SimpleArbiter.
computers = {
'NATServer': {
'disks': [
- { 'name': 'NATServer',
+ { 'name': 'student-NATServer',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -51,7 +51,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiter',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
diff --git a/kpov_judge/tasks/openvpn_simple_smb/task.py b/kpov_judge/tasks/openvpn_simple_smb/task.py
index 09ad026..c807f90 100644
--- a/kpov_judge/tasks/openvpn_simple_smb/task.py
+++ b/kpov_judge/tasks/openvpn_simple_smb/task.py
@@ -42,7 +42,7 @@ computers = {
'SimpleArbiter': {
'disks': [
{
- 'name': 'SimpleArbiterVPN',
+ 'name': 'simpleArbiterDhcpGWVPN',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -63,7 +63,7 @@ computers = {
},
'VPNClient1': {
'disks': [
- { 'name': 'VPNClient1',
+ { 'name': 'student-VPNClient1',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -291,7 +291,7 @@ def prepare_disks(templates, params):
-----END OpenVPN Static key V1-----
""".format(s)
keyfile = kpov_random_helpers.fname_gen(r, extension=False) + ".key"
- templates['SimpleArbiterVPN'].write("/etc/openvpn/secret.key", s)
+ templates['simpleArbiterDhcpGWVPN'].write("/etc/openvpn/secret.key", s)
netaddr_s = """auto tap0
iface tap0 inet static
openvpn server
@@ -299,15 +299,15 @@ iface tap0 inet static
address {}
netmask 255.255.255.0
""".format(params['IP_SimpleArbiterVPN'])
- templates['SimpleArbiterVPN'].write_append("/etc/network/interfaces", netaddr_s)
+ templates['simpleArbiterDhcpGWVPN'].write_append("/etc/network/interfaces", netaddr_s)
for i in xrange(3):
fname = kpov_random_helpers.fname_gen(r, False)
- templates['SimpleArbiterVPN'].write(
+ templates['simpleArbiterDhcpGWVPN'].write(
"/srv/smb/" + fname + '.txt',
kpov_random_helpers.fortune(r, 4096))
- templates['VPNClient1'].write("/home/student/" + keyfile, s)
+ templates['student-VPNClient1'].write("/home/student/" + keyfile, s)
# uid, gid (student = )
- templates['VPNClient1'].chown(1000, 1000, "/home/student/" + keyfile)
+ templates['student-VPNClient1'].chown(1000, 1000, "/home/student/" + keyfile)
diff --git a/kpov_judge/tasks/radius_mysql_pam/task.py b/kpov_judge/tasks/radius_mysql_pam/task.py
index 7dbfe8c..908ee49 100644
--- a/kpov_judge/tasks/radius_mysql_pam/task.py
+++ b/kpov_judge/tasks/radius_mysql_pam/task.py
@@ -56,7 +56,7 @@ and/or /etc/password.
computers = {
'RadiusServer': {
'disks': [
- { 'name': 'RadiusServer',
+ { 'name': 'student-RadiusServer',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -70,7 +70,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiterDhcpGW',
# attempt automount
},
#{ 'name': 'CDROM',
diff --git a/kpov_judge/tasks/set_motd/task.py b/kpov_judge/tasks/set_motd/task.py
index ee82765..72a5105 100644
--- a/kpov_judge/tasks/set_motd/task.py
+++ b/kpov_judge/tasks/set_motd/task.py
@@ -56,14 +56,13 @@ computers = {
},
'Student': {
'disks': [
- { 'name': 'Student', }
+ { 'name': 'student-console', }
],
'flavor': 'm1.tiny',
'network_interfaces': [{'network': 'net1'}],
'config_drive': True,
'userdata': {'string': "#!/bin/bash\nsed -i '/cloud/d' /etc/fstab\npoweroff &\n"}
- }
-
+ }
}
networks = { 'net1': {'public': False}, 'test-net': {'public': True} }
diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py
index 6623248..244ac76 100644
--- a/kpov_judge/tasks/smb_nfs/task.py
+++ b/kpov_judge/tasks/smb_nfs/task.py
@@ -27,7 +27,7 @@ SimpleArbiterDhcp should have write access to {NFS_MOUNT} over NFS.
computers = {
'FileServer': {
'disks': [
- { 'name': 'FileServer',
+ { 'name': 'student-fileserver',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -41,7 +41,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiterDhcpGW',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -136,12 +136,12 @@ def task_check(results, params):
return score, hints
def prepare_disks(templates, params):
- d = templates['FileServer']
+ d = templates['student-fileserver']
d.mkdir("/srv/nfs")
d.mkdir(params['NFS_MOUNT'])
d.write(params['NFS_MOUNT'] + "/" + params["SHARED_FILENAME"],
params["SHARED_CONTENT"])
- d = templates['SimpleArbiter']
+ d = templates['simpleArbiterDhcpGW']
d.mkdir('/mnt/nfs')
d.mkdir('/mnt/smb')
diff --git a/kpov_judge/tasks/snmp_agent_uptime/task.py b/kpov_judge/tasks/snmp_agent_uptime/task.py
index dd8880e..9d38083 100644
--- a/kpov_judge/tasks/snmp_agent_uptime/task.py
+++ b/kpov_judge/tasks/snmp_agent_uptime/task.py
@@ -46,7 +46,7 @@ Make all the data available over SNMP readable by the "studentje" community.
computers = {
'SNMPClient': {
'disks': [
- { 'name': 'SNMPClient',
+ { 'name': 'student-SNMPClient',
},
#{ 'name': 'CDROM',
@@ -60,7 +60,7 @@ computers = {
},
'SNMPServer': {
'disks': [
- { 'name': 'SNMPServer',
+ { 'name': 'student-SNMPServer',
},
#{ 'name': 'CDROM',
# 'options':{'readonly': True},
@@ -213,5 +213,5 @@ elif action == '-n' and oid < ".{oid}":
print "string"
print "{val}"
""".format(oid = params['SNMP_CLIENT_OID'], val = params['SNMP_VALUE'])
- templates['SNMPServer'].write('/usr/local/bin/snmpext.py', prog)
- templates['SNMPServer'].chmod(0766, '/usr/local/bin/snmpext.py')
+ templates['student-SNMPServer'].write('/usr/local/bin/snmpext.py', prog)
+ templates['student-SNMPServer'].chmod(0766, '/usr/local/bin/snmpext.py')
diff --git a/kpov_judge/tasks/vlc_stream_rtp/task.py b/kpov_judge/tasks/vlc_stream_rtp/task.py
index f292ed1..3838c12 100644
--- a/kpov_judge/tasks/vlc_stream_rtp/task.py
+++ b/kpov_judge/tasks/vlc_stream_rtp/task.py
@@ -7,8 +7,11 @@
instructions = {
'si':u"""
-Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter. Posodobi
-datoteko /etc/apt/sources.list, preveri posodobitve in naloži VLC.
+Postavi navidezni računalnik SimpleArbiter z diska simpleArbiter
+ter StudentVLC z diska student-VLC. Poskrbi, da bosta na istem omrežju, od
+koder bosta imela dostop tudi do Interneta
+Na StudentVLC posodobi datoteko /etc/apt/sources.list, preveri posodobitve in
+naloži VLC.
Posnemi ali kako drugače ustvari film ter poskrbi, da bo film dostopen na
lokalnem omrežju prek RTP z imenom toka {TOK} na naslovu {NASLOV}.
@@ -16,8 +19,11 @@ Računaj, da bodo film lahko videli tvoji sošolci. Kršenje avtorskih pravic
je pri reševanju te naloge strogo prepovedano.
""",
'en':u"""
-Set up a virtual computer SimpleArbiter from the simpleArbiter disk.
-Update /etc/apt/sources.list, check the for updates and install VLC.
+Set up a virtual computer called SimpleArbiter using the simpleArbiter disk and
+a virtual computer called StudentVLC using the student-VLC disk. Make sure they
+are on the same network and that they have access to the Internet.
+On StundentVLC, update /etc/apt/sources.list, check the for updates and install
+VLC.
Record or otherwise create a movie and make sure the movie is avaliable
on your local network via RTP with the name of the stream {TOK} at the address
@@ -39,10 +45,25 @@ computers = {
# 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
#},
],
- 'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
+ 'network_interfaces': [{'network': 'test-net'}],
+ 'flavor': 'm1.tiny',
+ 'config_drive': False
+ },
+ 'StudentVLC': {
+ 'disks': [
+ { 'name': 'student-VLC',
+ # attempt automount
+ },
+ #{ 'name': 'CDROM',
+ # 'options': {'readonly': True},
+ # 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
+ #},
+ ],
+ 'network_interfaces': [{'network': 'test-net'}],
'flavor': 'm1.tiny',
'config_drive': False
}
+
}
networks = { 'test-net': {'public': True} }