diff --git a/tes/apiendpoints.py b/tes/apiendpoints.py index cfd90471b4cc1eecbfed9a2606ddd9faa2db53d7..522c83993e53191e88014914772d7a0523e50424 100644 --- a/tes/apiendpoints.py +++ b/tes/apiendpoints.py @@ -187,7 +187,7 @@ class ContactUs(Resource): f.close() return -def wrap_execute(sshsess, host, bastion=None, user=None, cmd=None): +def wrap_execute(sess, host, user, cmd, bastion=None,stdin=None, sshport="22", bastionsshport="22"): """ This function is supposed to interpret all the possible exceptions from Ssh.execute and generate approrparite HTTP errors (both status codes and messages) @@ -199,10 +199,7 @@ def wrap_execute(sshsess, host, bastion=None, user=None, cmd=None): the data on stderr might be valid json or not. """ try: - if bastion is None: - res = Ssh.execute(sshsess, host=host, user=user, cmd=cmd) - else: - res = Ssh.execute(sshsess, host=host, bastion=bastion, user=user, cmd=cmd) + res = Ssh.execute(sess, host, user, cmd, bastion, stdin, sshport, bastionsshport) if not (res['stderr'] == '' or res['stderr'] is None or res['stderr'] == b''): logger.error(res['stderr']) #flask_restful.abort(400, message=res['stderr'].decode())