Improving parameters processing
- parametrize BMC credentials. - adding ability to set variables from the ENV to avoid sensitive data leak to a terminal or process listing. 'required=True' has been removed from the '--instance' parameter to allow setting it from the ENV. Change-Id: Ida5df11fc3c50dcdabd2741b9a8abfa5fb87ed45
This commit is contained in:
parent
e7f4a60f4d
commit
002b2d201b
@ -189,18 +189,28 @@ def main():
|
||||
prog='openstackbmc',
|
||||
description='Virtual BMC for controlling OpenStack instance',
|
||||
)
|
||||
parser.add_argument('--bmcuser',
|
||||
dest='bmcuser',
|
||||
default=os.environ.get('BMC_USER', 'admin'),
|
||||
help='Username to use for virtual BMC, defaults to '
|
||||
'admin')
|
||||
parser.add_argument('--bmcpass',
|
||||
dest='bmcpass',
|
||||
default=os.environ.get('BMC_PASSWORD', 'password'),
|
||||
help='Password to use for virtual BMC, defaults to '
|
||||
'password')
|
||||
parser.add_argument('--port',
|
||||
dest='port',
|
||||
type=int,
|
||||
default=623,
|
||||
default=os.environ.get('BMC_PORT', 623),
|
||||
help='Port to listen on; defaults to 623')
|
||||
parser.add_argument('--address',
|
||||
dest='address',
|
||||
default='::',
|
||||
default=os.environ.get('BMC_ADDRESS', '::'),
|
||||
help='Address to bind to; defaults to ::')
|
||||
parser.add_argument('--instance',
|
||||
dest='instance',
|
||||
required=True,
|
||||
default=os.environ.get('INSTANCE_ID'),
|
||||
help='The uuid or name of the OpenStack instance '
|
||||
'to manage')
|
||||
parser.add_argument('--cache-status',
|
||||
@ -222,7 +232,7 @@ def main():
|
||||
addr_format = '%s'
|
||||
if ':' not in args.address:
|
||||
addr_format = '::ffff:%s'
|
||||
mybmc = OpenStackBmc({'admin': 'password'}, port=args.port,
|
||||
mybmc = OpenStackBmc({args.bmcuser: args.bmcpass}, port=args.port,
|
||||
address=addr_format % args.address,
|
||||
instance=args.instance,
|
||||
cache_status=args.cache_status,
|
||||
|
Loading…
Reference in New Issue
Block a user