summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'kpov_judge/tasks')
-rw-r--r--kpov_judge/tasks/set_ip_static_dhcp/task.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py
index 61424fe..82e796d 100644
--- a/kpov_judge/tasks/set_ip_static_dhcp/task.py
+++ b/kpov_judge/tasks/set_ip_static_dhcp/task.py
@@ -88,7 +88,7 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static):
# sA - network manager
sA = pxssh.pxssh()
sA.login(IP_NM, peer_user, peer_passwd)
- sA.sendline('nmcli d')
+ sA.sendline('nmcli -c no d')
sA.prompt()
results['NM_nmcli'] = sA.before
sA.sendline('nslookup www.arnes.si')
@@ -98,7 +98,7 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static):
# sB - brez network manager
sB = pxssh.pxssh()
sB.login(IP_static, peer_user, peer_passwd)
- sB.sendline('nmcli d')
+ sB.sendline('nmcli -c no d')
sB.prompt()
results['static_nmcli'] = sB.before
sB.sendline('nslookup www.arnes.si')
@@ -112,7 +112,7 @@ def gen_params(user_id, params_meta):
r = random.Random(user_id)
# IP_NM, DNS_NM, IP_static, DNS_static)
dns_servers = ['193.2.1.66', '193.2.1.72', '8.8.8.8', '8.8.4.4', '208.67.222.222', '208.67.220.220']
- net = kpov_random_helpers.IPv4_subnet_gen(r, '172.23.128.0/18', 24)
+ net = kpov_random_helpers.IPv4_subnet_gen(r, '10.94.96.0/19', 25)
params['DNS_NM'] = r.choice(dns_servers)
params['IP_NM'], params['IP_static'] = kpov_random_helpers.IPv4_addr_gen(r, net, 2)
params['DNS_static'] = r.choice(dns_servers)
@@ -126,15 +126,23 @@ def task_check(results, params):
if results['NM_nslookup'].find(params['DNS_NM']) > -1:
# print "NM_nslookup OK"
score += 2
+ else:
+ hints += ['NM nslookup incorrect']
if results['static_nslookup'].find(params['DNS_static']) > -1:
# print "static_nslookup OK"
score += 2
- if re.search(r'eth0 +802-.*connected', results['NM_nmcli']):
+ else:
+ hints += ['static nslookup incorrect']
+ if re.search(r'e(th0|np0s3|ns3) +ethernet +connected', results['NM_nmcli']):
# print "NM_nmcli OK"
score += 3
- if re.search(r'eth0 +802-.*unmanaged', results['static_nmcli']):
+ else:
+ hints += ['nmcli incorrect']
+ if re.search(r'e(th0|np0s3|ns3) +ethernet +unmanaged', results['static_nmcli']):
# print "static_nmcli OK"
score += 3
+ else:
+ hints += ['nmcli on malibrez incorrect']
return score, hints
def prepare_disks(templates, task_params, global_params):