2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-15 04:07:48 +00:00

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
This commit is contained in:
Peter Martini 2014-11-06 16:36:26 +01:00
parent 467c2e52b8
commit 889ec1c96f

View File

@ -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 <cmd> <optarg>" % sys.argv[0]
sys.exit(1)
password = os.environ['IPMIPASSWORD']
os.environ['IPMIPASSWORD'] = ""
bmc = sys.argv[1]
userid = sys.argv[2]
args = None