From e33085889f26c76587fdab2ad600ed336dc028b5 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Sat, 6 Oct 2018 23:35:00 +0200 Subject: Improve ssh error reporting in some tasks --- kpov_judge/tasks/public_ip_ssh/task.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'kpov_judge/tasks/public_ip_ssh') 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('/') -- cgit v1.2.1