Commit 7ba238de authored by PERNOT Guillaume's avatar PERNOT Guillaume

try harder commands

parent 7130a061
......@@ -37,14 +37,24 @@ logging.basicConfig(filename='atsctl.log', level=logging.DEBUG)
def cmd(proc, msg, expect=None, error=None):
#if DEVEL:
# print(msg)
output = proc.run_command(msg, timeout=None)
if error is not None and re.match(error, output):
logging.error(output)
raise Exception(output)
for i in range(3):
_err = False
output = proc.run_command(msg, timeout=None)
if error is not None and re.match(error, output):
# an error occured. wait a minute before trying again.
logging.error(output)
time.sleep(60)
_err = True
continue
#raise Exception(output)
if expect is None:
return None
if expect is None:
return None
if _err:
raise Exception(output)
m = re.match(expect, output)
if m is None:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment