summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-19 00:59:41 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2019-02-19 01:02:36 +0100
commitee6530f2cdaed693cd0725590acbda82f6dba1e5 (patch)
treedf8f683f535e9fc0e9757bb99d0643f617cc29b1
parent9d14de909cc3b34b1ca4b8669fdab98472bbab09 (diff)
write_default_config: copy random_data directory to image
Images are now generated without random_data directory (commit pending). Instead copy this directory when setting up the disks for each student.
-rw-r--r--kpov_judge/util.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/kpov_judge/util.py b/kpov_judge/util.py
index f465329..6d9e085 100644
--- a/kpov_judge/util.py
+++ b/kpov_judge/util.py
@@ -2,7 +2,7 @@ import os
import yaml
def write_default_config(disk, global_params):
- home = '/home/tester'
+ home = '/home/test'
params_file = os.path.join(home, '.kpov_params.yaml')
default_params = {}
for k in [
@@ -14,9 +14,11 @@ def write_default_config(disk, global_params):
disk.write(params_file, yaml.dump(default_params))
disk.chown(1001, 1001, params_file)
+ mydir = os.path.dirname(os.path.abspath(__file__))
# write testing script and helper
for f in ['test_task.py', 'kpov_util.py']:
- src = os.path.join(os.path.dirname(os.path.abspath(__file__)), f)
- dst = os.path.join('/home/tester', f)
+ src = os.path.join(mydir, f)
+ dst = os.path.join('/home/test', f)
disk.write(dst, open(src).read())
- disk.chown(1001, 1001, dst)
+ disk.chmod(0o755, dst)
+ disk.copy_in(os.path.join(mydir, 'random_data'), '/home/test')