From 310d84d2cb99bca6fb4a2e1c7372cf65a5345b78 Mon Sep 17 00:00:00 2001 From: "sv1004@student.uni-lj.si" Date: Mon, 22 Dec 2014 15:55:11 +0000 Subject: git-svn-id: https://svn.lusy.fri.uni-lj.si/kpov-public-svn/kpov-public@120 5cf9fbd1-b2bc-434c-b4b7-e852f4f63414 --- kpov_judge/tasks/set_ip_static_dhcp/task.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'kpov_judge/tasks/set_ip_static_dhcp') diff --git a/kpov_judge/tasks/set_ip_static_dhcp/task.py b/kpov_judge/tasks/set_ip_static_dhcp/task.py index 5321f9b..98ab069 100644 --- a/kpov_judge/tasks/set_ip_static_dhcp/task.py +++ b/kpov_judge/tasks/set_ip_static_dhcp/task.py @@ -79,12 +79,10 @@ def task(IP_NM, DNS_NM, IP_static, DNS_static): sB = pxssh.pxssh() sA.login(IP_NM, peer_user, peer_passwd) sB.login(IP_static, peer_user, peer_passwd) - # sA - # make sure NM is not handling eth0 + # sA - network manager results['NM_nmcli'] = sA.run('nmcli d') results['NM_nslookup'] = sA.run('nslookup www.arnes.si') - # sB - # check whether NM is handling eth0 + # sB - brez network manager results['static_nmcli'] = sB.run('nmcli d') results['static_nslookup'] = sB.run('nslookup www.arnes.si') sA.logout() @@ -104,15 +102,14 @@ def gen_params(user_id, params_meta): def task_check(results, params): import re - # TODO: (polz) preveri, da na maliNetworkManager NetworkManager skrbi za eth0. - score = -9 - if results['NM_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_NM'])) > -1: + score = 0 + if results['NM_nslookup'].find(params['DNS_NM']) > -1: score += 3 - if results['static_nslookup'].find('Server:\t\t{0}\r'.format(params['DNS_static'])) > -1: + if results['static_nslookup'].find(params['DNS_static']) > -1: score += 3 if re.search(r'eth0 +802-.*connected', results['NM_nmcli']): score += 2 - if not re.search(r'eth0 +802-.*connected', results['static_nmcli']): + if not re.search(r'eth0 +802-.*unmanaged', results['static_nmcli']): score += 2 return score -- cgit v1.2.1