summaryrefslogtreecommitdiff
path: root/kpov_judge/tasks/public_ip_ssh
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-06 23:35:00 +0200
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2018-10-07 00:13:58 +0200
commite33085889f26c76587fdab2ad600ed336dc028b5 (patch)
tree980dd39519bc355aeb17572affcae58d3a0966cd /kpov_judge/tasks/public_ip_ssh
parent43d7ef057b4ae752a60b947e523b3a56782bf5cd (diff)
Improve ssh error reporting in some tasks
Diffstat (limited to 'kpov_judge/tasks/public_ip_ssh')
-rw-r--r--kpov_judge/tasks/public_ip_ssh/task.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/kpov_judge/tasks/public_ip_ssh/task.py b/kpov_judge/tasks/public_ip_ssh/task.py
index a566aa5..02c4ac5 100644
--- a/kpov_judge/tasks/public_ip_ssh/task.py
+++ b/kpov_judge/tasks/public_ip_ssh/task.py
@@ -43,17 +43,15 @@ def gen_params(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('/')