From 889ec1c96fe5515e26fb531dca4f93780b9817de Mon Sep 17 00:00:00 2001 From: Peter Martini Date: Thu, 6 Nov 2014 16:36:26 +0100 Subject: [PATCH] Check for IPMIPASSWORD env var in pyghmiutil The environment variable IPMIPASSWORD is fetched without checking to see if its present, which throws an exception instead of printing a usage message if its not set. This patch fixes that. Change-Id: I2b15efc4ea4b617e08f096de4130004150d64133 --- bin/pyghmiutil | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/pyghmiutil b/bin/pyghmiutil index d0f00b52..a68b4f4d 100755 --- a/bin/pyghmiutil +++ b/bin/pyghmiutil @@ -25,12 +25,14 @@ import string import sys from pyghmi.ipmi import command -password = os.environ['IPMIPASSWORD'] -os.environ['IPMIPASSWORD'] = "" -if (len(sys.argv) < 3): + +if (len(sys.argv) < 3) or 'IPMIPASSWORD' not in os.environ: print "Usage:" print " IPMIPASSWORD=password %s bmc username " % sys.argv[0] sys.exit(1) + +password = os.environ['IPMIPASSWORD'] +os.environ['IPMIPASSWORD'] = "" bmc = sys.argv[1] userid = sys.argv[2] args = None