From 082617af1bf93bdb3d54efdab86912e974b2dbb2 Mon Sep 17 00:00:00 2001 From: linggao Date: Thu, 29 May 2014 19:50:38 +0000 Subject: [PATCH] Added password file support Allow the BMC password being passed in to pyghmicons as a command paremeter. Change-Id: I696691701622802f228befff9e43a8169657f27b --- bin/pyghmicons | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/pyghmicons b/bin/pyghmicons index 1130d7cf..0e310a55 100755 --- a/bin/pyghmicons +++ b/bin/pyghmicons @@ -40,8 +40,6 @@ tty.setraw(sys.stdin.fileno()) currfl = fcntl.fcntl(sys.stdin.fileno(), fcntl.F_GETFL) fcntl.fcntl(sys.stdin.fileno(), fcntl.F_SETFL, currfl | os.O_NONBLOCK) -passwd = os.environ['IPMIPASSWORD'] - sol = None @@ -66,6 +64,13 @@ def _print(data): raise Exception(data) try: + if sys.argv[3] is None: + passwd = os.environ['IPMIPASSWORD'] + else: + passwd_file = sys.argv[3] + with open(passwd_file, "r") as f: + passwd = f.read() + sol = console.Console(bmc=sys.argv[1], userid=sys.argv[2], password=passwd, iohandler=_print, force=True) inputthread = threading.Thread(target=_doinput)