summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/smb_nfs
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks/smb_nfs')
-rw-r--r--kpov_judge/tasks/smb_nfs/task.py35
1 files changed, 12 insertions, 23 deletions
diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py
index 5ea7695..a94d677 100644
--- a/kpov_judge/tasks/smb_nfs/task.py
+++ b/kpov_judge/tasks/smb_nfs/task.py
@@ -1,7 +1,5 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
+# kpov_util should be imported by add_assignment.py
-# kpov_random_helpers should be imported by add_assignment.py
# TODO: dokoncaj!
instructions = {
'si':"""
@@ -29,10 +27,6 @@ computers = {
'disks': [
{ 'name': 'student-fileserver',
},
- #{ 'name': 'CDROM',
- # 'options':{'readonly': True},
- # 'parts': [],# no parts, no mounting.
- #}
],
'network_interfaces': [{'network': 'net1'}],
'flavor': 'm1.tiny',
@@ -42,12 +36,7 @@ computers = {
'SimpleArbiter': {
'disks': [
{ 'name': 'simpleArbiterDhcpGW',
- # attempt automount
},
- #{ 'name': 'CDROM',
- # 'options': {'readonly': True},
- # 'parts': [{'dev': 'b1', 'path': '/cdrom'}],
- #},
],
'network_interfaces': [{'network': 'net1'}, {'network': 'test-net'}],
'flavor': 'm1.tiny',
@@ -84,8 +73,8 @@ def task(FILESERVER_IP, FILESERVER_NAME, NFS_MOUNT, SMB_SHARENAME, SHARED_FILE_S
results['ls_smbmount'] = pexpect.run('ls /mnt/smb')
results['ls_nfs'] = pexpect.run('ls /mnt/nfs')
r = random.Random(SHARED_FILE_SEED)
- testfile = kpov_random_helpers.fname_gen(r)
- teststring = kpov_random_helpers.alnum_gen(r, 200)
+ testfile = kpov_util.fname_gen(r)
+ teststring = kpov_util.alnum_gen(r, 200)
with open('/mnt/nfs/{}'.format(testfile),'w') as f:
f.write(teststring)
results['filestr'] = pexpect.run(
@@ -99,22 +88,22 @@ def task(FILESERVER_IP, FILESERVER_NAME, NFS_MOUNT, SMB_SHARENAME, SHARED_FILE_S
return results
def gen_params(user_id, params_meta):
- d = kpov_random_helpers.default_gen(user_id, params_meta)
+ d = kpov_util.default_gen(user_id, params_meta)
r = random.Random(user_id)
- d['FILESERVER_NAME'] = kpov_random_helpers.hostname_gen(r)
- d['SMB_SHARENAME'] = kpov_random_helpers.hostname_gen(r)
- d['NFS_MOUNT'] = "/srv/nfs/" + kpov_random_helpers.fname_gen(r, False)
- d['SHARED_FILENAME'] = kpov_random_helpers.fname_gen(r)
- d['SHARED_CONTENT'] = kpov_random_helpers.fortune(r, 4096)
- d['SHARED_FILE_SEED'] = kpov_random_helpers.alnum_gen(r, 42)
+ d['FILESERVER_NAME'] = kpov_util.hostname_gen(r)
+ d['SMB_SHARENAME'] = kpov_util.hostname_gen(r)
+ d['NFS_MOUNT'] = "/srv/nfs/" + kpov_util.fname_gen(r, False)
+ d['SHARED_FILENAME'] = kpov_util.fname_gen(r)
+ d['SHARED_CONTENT'] = kpov_util.fortune(r, 4096)
+ d['SHARED_FILE_SEED'] = kpov_util.alnum_gen(r, 42)
return d
def task_check(results, params):
score = 0
hints = []
r = random.Random(params['SHARED_FILE_SEED'])
- testfile = kpov_random_helpers.fname_gen(r)
- teststring = kpov_random_helpers.alnum_gen(r, 200)
+ testfile = kpov_util.fname_gen(r)
+ teststring = kpov_util.alnum_gen(r, 200)
# no need to check results['mount'] or results['try_mount_nfs']
# or results['try_mount_smb']
if results['mount_after'].find('//{}/{} on /mnt/smb type cifs'.format(