summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Kraft <george.kraft@calxeda.com>2012-08-20 11:17:02 -0500
committerGeorge Kraft <george.kraft@calxeda.com>2012-08-20 11:17:02 -0500
commit56c288cae8743a1016a1f6af784304e11c0f4c98 (patch)
tree90f8042e56b259421e71dc3ea3e199fb657fe2fb
parent1e7d6bdc75dd56a6a0152e79a7b49089033a67de (diff)
downloadcxmanage-56c288cae8743a1016a1f6af784304e11c0f4c98.tar.gz
target: Use IPMITOOL_PATH env variable for arbitrary "ipmitool" cmd
Also, always print ipmitool output even when it returns exit status 1.
-rw-r--r--cxmanage/target.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/cxmanage/target.py b/cxmanage/target.py
index 0b2ad77..4b1bffe 100644
--- a/cxmanage/target.py
+++ b/cxmanage/target.py
@@ -345,15 +345,21 @@ class Target:
def ipmitool_command(self, ipmitool_args):
""" Execute an arbitrary ipmitool command """
- command = ["ipmitool", "-U", self.username, "-P", self.password, "-H",
+ if "IPMITOOL_PATH" in os.environ:
+ command = [os.environ["IPMITOOL_PATH"]]
+ else:
+ command = ["ipmitool"]
+
+ command += ["-U", self.username, "-P", self.password, "-H",
self.address]
command += ipmitool_args
if self.verbosity >= 2:
print "Running %s" % " ".join(command)
- output = subprocess.check_output(command, stderr=subprocess.STDOUT)
- return output.strip()
+ process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout, stderr = process.communicate()
+ return (stdout + stderr).strip()
def get_ubootenv(self, tftp):
""" Get the active u-boot environment """