summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/public_ip_ssh
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 20:21:31 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 20:21:31 +0200
commit80f050080ce11c6a0cce67c9b0281c09702b00d6 (patch)
treeb486e1f6342bc757dda87df4856084f652895791 /kpov_judge/tasks/public_ip_ssh
parent43d7ef057b4ae752a60b947e523b3a56782bf5cd (diff)
parentdbf585c2a59dbcb7f6d803d5756826b562cd7f43 (diff)
Merge branch 'fix-tasks'
Fixes pexpect usage in most tasks. Several other cleanups and minor refactoring.
Diffstat (limited to 'kpov_judge/tasks/public_ip_ssh')
-rw-r--r--kpov_judge/tasks/public_ip_ssh/task.py25
1 files changed, 9 insertions, 16 deletions
diff --git a/kpov_judge/tasks/public_ip_ssh/task.py b/kpov_judge/tasks/public_ip_ssh/task.py
index a566aa5..561a1fa 100644
--- a/kpov_judge/tasks/public_ip_ssh/task.py
+++ b/kpov_judge/tasks/public_ip_ssh/task.py
@@ -1,9 +1,4 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-
-# bson.son.SON an
-# kpov_random_helpers should be imported by add_assignment.py
-OrderedDict = SON
+# kpov_util should be imported by add_assignment.py
instructions = {
'si':"""
@@ -39,21 +34,19 @@ def task(peer_ip, peer_user, peer_passwd):
return dict()
def gen_params(user_id, params_meta):
- return kpov_random_helpers.default_gen(user_id, params_meta)
+ return kpov_util.default_gen(user_id, params_meta)
def task_check(results, params):
from pexpect import pxssh
- import pexpect
- results = dict()
- s = pxssh.pxssh()
- peer_ip, peer_user, peer_passwd = params['peer_ip'], params['peer_user'], params['peer_passwd']
+ ip, user, passwd = params['peer_ip'], params['peer_user'], params['peer_passwd']
+ results = {}
try:
- s.login(peer_ip, peer_user, peer_passwd)
+ s = pxssh.pxssh(encoding='utf-8')
+ s.login(ip, user, passwd)
s.logout()
- except Exception as e:
- return 0, [str(e)]
- return 10, []
+ return 10, []
+ except Exception as ex:
+ return 0, [str(ex)]
def prepare_disks(templates, task_params, global_params):
write_default_config(templates['simpleArbiter'], global_params)
- # print d1.ls('/')