Add another expect pattern to catch when we loose connection.

This commit is contained in:
Ben Greear
2019-12-15 08:22:50 -08:00
parent e7a228bc52
commit 8333416479

View File

@@ -166,6 +166,7 @@ def main():
EXITPROMPT = "Would you like to save them now\? \(y/N\)" EXITPROMPT = "Would you like to save them now\? \(y/N\)"
AREYOUSURE = "Are you sure you want to continue\? \(y/n\)" AREYOUSURE = "Are you sure you want to continue\? \(y/n\)"
CLOSEDBYREMOTE = "closed by remote host." CLOSEDBYREMOTE = "closed by remote host."
CLOSEDCX = "Connection to .* closed."
egg.expect(CCPROMPT) egg.expect(CCPROMPT)
logg.info("Ap[%s] Action[%s] Value[%s] "%(args.ap, args.action, args.value)) logg.info("Ap[%s] Action[%s] Value[%s] "%(args.ap, args.action, args.value))
@@ -228,7 +229,7 @@ def main():
egg.sendline("y") egg.sendline("y")
egg.sendline("logout") egg.sendline("logout")
i = egg.expect([EXITPROMPT, CLOSEDBYREMOTE]) i = egg.expect([EXITPROMPT, CLOSEDBYREMOTE, CLOSEDCX])
if i == 0: if i == 0:
egg.sendline("y") egg.sendline("y")