Pass IP addr to racadm rather than hostname.
class DRAC(BasicPCUControl):
supported_ports = [22,443,5869]
def run_drac(self, node_port, dryrun):
class DRAC(BasicPCUControl):
supported_ports = [22,443,5869]
def run_drac(self, node_port, dryrun):
- return self.run_expect_script("DRAC.exp racadm", dryrun=dryrun, model="None")
+ return self.run_expect_script("DRAC.exp racadm", dryrun=dryrun, model="None", ip=True)
def run_ssh(self, node_port, dryrun):
return self.run_expect_script("DRAC.exp ssh", dryrun=dryrun, model="None")
def run_ssh(self, node_port, dryrun):
return self.run_expect_script("DRAC.exp ssh", dryrun=dryrun, model="None")
"Could not resolve hostname" { send_user "DRAC ssh: $expect_out(0,string)"; exit }
"Connection timed out" { send_user "DRAC ssh: $expect_out(0,string)"; exit }
-re "Received disconnect.*" { send_user "DRAC ssh: $expect_out(0,string)"; exit}
"Could not resolve hostname" { send_user "DRAC ssh: $expect_out(0,string)"; exit }
"Connection timed out" { send_user "DRAC ssh: $expect_out(0,string)"; exit }
-re "Received disconnect.*" { send_user "DRAC ssh: $expect_out(0,string)"; exit}
- -re "\\$|/.*>|\[$user\]#" { send "\r"; }
+ -re "\\$|/.*>|.*$user.*#" { send "\r"; }
timeout { send_user "DRAC ssh: timeout" ; exit; }
eof { if { $cont == 1 } { send_user "DRAC ssh failed twice"; exit ; } ; set cont 1 }
}
timeout { send_user "DRAC ssh: timeout" ; exit; }
eof { if { $cont == 1 } { send_user "DRAC ssh failed twice"; exit ; } ; set cont 1 }
}
if { "$dryrun" == "True" } {
expect {
-re "\\$|/.*>" { send "racadm getsysinfo\r"; }
if { "$dryrun" == "True" } {
expect {
-re "\\$|/.*>" { send "racadm getsysinfo\r"; }
- -re "\[$user\]#" { send "getsysinfo\r" }
+ -re ".*$user.*#" { send "getsysinfo\r" }
}
} else {
expect {
-re "\\$|/.*>" { send "racadm serveraction powercycle\r"; }
}
} else {
expect {
-re "\\$|/.*>" { send "racadm serveraction powercycle\r"; }
- -re "\[$user\]#" { send "serveraction powercycle\r" }
+ -re ".*$user.*#" { send "serveraction powercycle\r" }
- expect -re "\\$|/.*>|\[$user\]#" { send "exit\r"; }
+ expect -re "\\$|/.*>|.*$user.*#" { send "exit\r"; }
expect eof { send_user "$reset_msg\n" }
expect eof { send_user "$reset_msg\n" }
def run_expect_script(self, scriptname, **args):
locfg = command.CMD()
def run_expect_script(self, scriptname, **args):
locfg = command.CMD()
+ if 'ip' in args:
+ host = self.ip
+ else:
+ host = self.host
+
cmd_str = get_python_lib(1) + "/pcucontrol/models/exp/"
cmd = cmd_str + "%s %s %s '%s' %s %s " % (
cmd_str = get_python_lib(1) + "/pcucontrol/models/exp/"
cmd = cmd_str + "%s %s %s '%s' %s %s " % (
- scriptname, self.host, self.username,
+ scriptname, host, self.username,
self.password, args['dryrun'], args['model'])
print cmd
cmd_out, cmd_err = locfg.run_noexcept(cmd)
self.password, args['dryrun'], args['model'])
print cmd
cmd_out, cmd_err = locfg.run_noexcept(cmd)