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

Added password file support

Allow the BMC password being passed in to pyghmicons as a
command paremeter.

Change-Id: I696691701622802f228befff9e43a8169657f27b
This commit is contained in:
linggao
2014-05-29 19:50:38 +00:00
parent 9e31a70f5f
commit 082617af1b

View File

@ -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)