From 56c288cae8743a1016a1f6af784304e11c0f4c98 Mon Sep 17 00:00:00 2001 From: George Kraft Date: Mon, 20 Aug 2012 11:17:02 -0500 Subject: target: Use IPMITOOL_PATH env variable for arbitrary "ipmitool" cmd Also, always print ipmitool output even when it returns exit status 1. --- cxmanage/target.py | 12 +++++++++--- 1 file 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 """ -- cgit v1.2.1