Skip to content
Snippets Groups Projects
Commit 91c43fa2 authored by Rohit Gupta's avatar Rohit Gupta
Browse files

updates for terminating program after fatal SSH Errors

parent 959f13e1
No related branches found
No related tags found
No related merge requests found
......@@ -83,10 +83,13 @@ class openair(core):
return (stdout, stderr)
def connect(self, username, password, prompt='PEXPECT_OAI'):
while True:
max_retries=100
i=0
while i <= max_retries:
self.prompt1 = prompt
self.prompt2 = prompt
self.password = ''
i=i+1
# WE do not store the password when sending commands for secuirity reasons. The password might be accidentally logged in such cases.
#The password is used only to make ssh connections. In case user wants to run programs with sudo, then he/she needs to add following line in /etc/sudoers
# your_user_name ALL=(ALL:ALL) NOPASSWD: ALL
......@@ -113,7 +116,9 @@ class openair(core):
print error
print "Retrying again in 1 seconds"
time.sleep(1)
#sys.exit(1)
if i==max_retries:
print "Fatal Error: Terminating the program now..."
sys.exit(1)
def connect2(self, username, password, prompt='$'):
self.prompt1 = prompt
......
......@@ -273,9 +273,12 @@ def SSHSessionWrapper(machine, username, key_file, password, logdir_remote_testc
error = error + '\n username = ' + username + '\n machine = ' + machine + '\n logdir_remote = ' + logdir_remote_testcase + '\n logdir_local_base = ' + logdir_local_base
error = error + traceback.format_exc()
print error
print " Trying again in 1 seconds"
print " Retrying again in 1 seconds"
time.sleep(1)
print "Continuing ..."
if i ==max_tries:
print "Fatal Error: Max no of retries reached. Exiting now..."
sys.exit(1)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment