add ipmi to prottypemap
[pcucontrol.git] / pcucontrol / models / OpenIPMI.py
1
2 from pcucontrol.reboot import *
3
4 class OpenIPMI(PCUControl):
5
6         supported_ports = [80,443,623]
7
8         # TODO: get exit codes to determine success or failure...
9         def run_ipmi(self, node_port, dryrun):
10
11                 if not dryrun:
12                         cmd = "ipmitool -I lanplus -H %s -U %s -P '%s' power cycle  "
13                         (i,p) = os.popen4(cmd % ( self.host, self.username, self.password) )
14                         result = p.read()
15                         print "RESULT: ", result
16                 else:
17                         cmd = "ipmitool -I lanplus -H %s -U %s -P '%s' user list  "
18                         (i,p) = os.popen4(cmd % ( self.host, self.username, self.password) )
19                         result = p.read()
20                         print "RESULT: ", result
21
22                 if "Error" in result:
23                         return result
24                 else:
25                         return 0