summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-01 14:54:19 +0000
committergasperfele@fri1.uni-lj.si <gasperfele@fri1.uni-lj.si@5cf9fbd1-b2bc-434c-b4b7-e852f4f63414>2015-04-01 14:54:19 +0000
commit2fe40ec78ce6ab3a8c2c5659713b7f947a5686fc (patch)
tree15d0cd5e4855f87c1a59637be3b261eb8c675bd2
parenta0c78c82a5cb3a69f66a4ed631b555e3df54d6e5 (diff)
fixed create_disk_images to work from any directory
git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@295 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414
-rwxr-xr-xkpov_judge/kpov_random_helpers.py12
-rw-r--r--kpov_judge/tasks/copy_rename_20_files_tail_env/task.py13
2 files changed, 13 insertions, 12 deletions
diff --git a/kpov_judge/kpov_random_helpers.py b/kpov_judge/kpov_random_helpers.py
index 9775224..0a25d00 100755
--- a/kpov_judge/kpov_random_helpers.py
+++ b/kpov_judge/kpov_random_helpers.py
@@ -9,6 +9,7 @@ import math
import re
import subprocess
import glob
+import os
def alnum_gen(r, l=1):
s = u""
@@ -85,11 +86,12 @@ def fname_gen(r, extension = True):
s += '.' + r.choice(common_file_extensions)
return s
-with open('random_data/greek_gods.txt') as f:
+fdir = os.path.dirname(os.path.realpath(__file__))
+with open(os.path.join(fdir, 'random_data/greek_gods.txt')) as f:
greek_gods = [i.strip() for i in f.readlines()]
-with open('random_data/roman_gods.txt') as f:
+with open(os.path.join(fdir, 'random_data/roman_gods.txt')) as f:
roman_gods = [i.strip() for i in f.readlines()]
-with open('random_data/slavic_gods.txt') as f:
+with open(os.path.join(fdir, 'random_data/slavic_gods.txt')) as f:
slavic_gods = [i.strip() for i in f.readlines()]
gods = greek_gods + roman_gods + slavic_gods
@@ -97,10 +99,10 @@ gods = greek_gods + roman_gods + slavic_gods
def hostname_gen(r):
return "{0}-{1:02}".format(r.choice(gods), r.randint(1, 99))
-with open('random_data/slovenian_names.txt') as f:
+with open(os.path.join(fdir, 'random_data/slovenian_names.txt')) as f:
names = [i.strip() for i in f.readlines()]
-with open('random_data/slovenian_surnames.txt') as f:
+with open(os.path.join(fdir, 'random_data/slovenian_surnames.txt')) as f:
surnames = [i.strip() for i in f.readlines()]
def username_gen(r):
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 b4f11ef..00d4daf 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
@@ -77,7 +77,7 @@ computers = {
},
'SimpleArbiter': {
'disks': [
- { 'name': 'simpleArbiterDhcp',
+ { 'name': 'simpleArbiter',
# attempt automount
},
#{ 'name': 'CDROM',
@@ -268,8 +268,8 @@ def task_check(results, params):
linknames = []
for i in xrange(20):
linknames.append("".join([ r.choice("123456789abcdefghijk") for j in xrange(8)]))
- print( results['grep_mama'])
- print( results['grep_napake'])
+ #print( results['grep_mama'])
+ #print( results['grep_napake'])
for i in dirnames + linknames + papa_fnames:
if (i not in papa_fnames) and results['grep_napake'].find(i) < 0:
task3_ok = False
@@ -286,9 +286,9 @@ def task_check(results, params):
if task3_ok:
score += 2
# sledenje syslog
- print( results['syslog_start_time'])
- print( results['syslog_result'])
- print( results['syslog_end_time'])
+ #print( results['syslog_start_time'])
+ #print( results['syslog_result'])
+ #print( results['syslog_end_time'])
return score
def prepare_disks(templates, params):
@@ -347,7 +347,6 @@ def prepare_disks(templates, params):
lx = l1 + l2
r.shuffle(lx)
d.write("/var/www/html/{}".format(params['curl_fname']), ''.join(lx))
- d.write("/var/www/html/{}".format(params['curl_fname']), ''.join(lx))
# wc
lx = ['\n']*int(params['wc_n_lines'])
lx += ['a', 'b', 'c', 'repa', 'in', 'krompir',