From 9c51bbe5016495c714789f5df01806a6d366e11a Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 6 Oct 2018 23:56:03 +0200 Subject: Rename kpov_random_helpers to kpov_util --- kpov_judge/tasks/smb_nfs/task.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'kpov_judge/tasks/smb_nfs/task.py') diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py index 5ea7695..b0a3c02 100644 --- a/kpov_judge/tasks/smb_nfs/task.py +++ b/kpov_judge/tasks/smb_nfs/task.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# kpov_random_helpers should be imported by add_assignment.py +# kpov_util should be imported by add_assignment.py # TODO: dokoncaj! instructions = { 'si':""" @@ -84,8 +84,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 +99,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( -- cgit v1.2.1 From 3091fc2877600f7926ed6a596c316183499125f8 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 7 Oct 2018 19:11:49 +0200 Subject: Remove coding: lines Python 3 source is utf-8 by default. --- kpov_judge/tasks/smb_nfs/task.py | 1 - 1 file changed, 1 deletion(-) (limited to 'kpov_judge/tasks/smb_nfs/task.py') diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py index b0a3c02..d2d47b0 100644 --- a/kpov_judge/tasks/smb_nfs/task.py +++ b/kpov_judge/tasks/smb_nfs/task.py @@ -1,5 +1,4 @@ #!/usr/bin/env python -# -*- coding: utf-8 -*- # kpov_util should be imported by add_assignment.py # TODO: dokoncaj! -- cgit v1.2.1 From dbf585c2a59dbcb7f6d803d5756826b562cd7f43 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sun, 7 Oct 2018 19:38:40 +0200 Subject: Fix or remove hashbangs --- kpov_judge/tasks/smb_nfs/task.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) (limited to 'kpov_judge/tasks/smb_nfs/task.py') diff --git a/kpov_judge/tasks/smb_nfs/task.py b/kpov_judge/tasks/smb_nfs/task.py index d2d47b0..a94d677 100644 --- a/kpov_judge/tasks/smb_nfs/task.py +++ b/kpov_judge/tasks/smb_nfs/task.py @@ -1,6 +1,5 @@ -#!/usr/bin/env python - # kpov_util should be imported by add_assignment.py + # TODO: dokoncaj! instructions = { 'si':""" @@ -28,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', @@ -41,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', -- cgit v1.2.1