add catch_login_prompt function
@@ -38,14 +38,22 @@ class Reboot(GenericUnixCommand):
"""
if is_full_line:
self._catch_connection_closed(line)
+ else:
+ self._catch_login_prompt(line)
_re_connection_closed = re.compile(r"(?P<CLOSED>(Connection\s+to\s+\S+\s+closed.*)|"
- r"(Connection closed by foreign host.*)|(.*?login:\s+))", re.I)
+ r"(Connection closed by foreign host.*))", re.I)
+
+ _re_login_prompt = re.compile(r"(?P<CLOSED>.*?login:\s+)", re.I)
def _catch_connection_closed(self, line):
if self._regex_helper.search_compiled(Reboot._re_connection_closed, line):
self.set_result({'RESULT': self._regex_helper.group('CLOSED')})
+ def _catch_login_prompt(self, line):
+ if self._regex_helper.search_compiled(Reboot._re_login_prompt, line):
+ self.set_result({'RESULT': self._regex_helper.group('CLOSED')})
+
COMMAND_OUTPUT_SSH = """
toor4nsn@fzhub:~# reboot
