- print "trying racadm_reboot..."
- racadm_reboot(self.host, self.username, self.password, node_port, dryrun)
+ def run_ssh(self, node_port, dryrun):
+ ssh_options="-o StrictHostKeyChecking=no "+\
+ "-o PasswordAuthentication=yes "+\
+ "-o PubkeyAuthentication=no"
+ s = pxssh.pxssh()
+ if not s.login(self.host, self.username, self.password, ssh_options,
+ original_prompts="Dell", login_timeout=TELNET_TIMEOUT):
+ raise ExceptionPassword("Invalid Password")
+
+ print "logging in..."
+ s.send("\r\n\r\n")
+ try:
+ # Testing Reboot ?
+ #index = s.expect(["DRAC 5", "[%s]#" % self.username ])
+ # NOTE: be careful to escape any characters used by 're.compile'
+ index = s.expect(["\$", "\[%s\]#" % self.username ])
+ print "INDEX:", index
+ if dryrun:
+ if index == 0:
+ s.send("racadm getsysinfo")
+ elif index == 1:
+ s.send("getsysinfo")
+ else:
+ if index == 0:
+ s.send("racadm serveraction powercycle")
+ elif index == 1:
+ s.send("serveraction powercycle")
+
+ s.send("exit")
+
+ except pexpect.EOF:
+ raise ExceptionPrompt("EOF before expected Prompt")
+ except pexpect.TIMEOUT:
+ print s
+ raise ExceptionPrompt("Timeout before expected Prompt")
+
+ s.close()