Add help for --plan, add --stack

In order to use tripleo-ansible-inventory with a different stack name,
you had to know to specify that name with --plan.

This commit adds help for the --plan cli arg, and also adds a new
--stack cli arg that has the same effect. --stack is more consistent
with other cli tools in TripleO. If both are specified, --stack will
take precedence.

Change-Id: I64b2c66eb2d37f0f231895c0cec3f8415de9f342
This commit is contained in:
James Slagle 2018-02-09 14:40:52 -05:00
parent bed5df2431
commit 80c842c09d
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1,6 @@
---
fixes:
- In order to use tripleo-ansible-inventory with a different stack name, that
name had to be specified with --plan. This commit adds help for the --plan
cli arg, and also adds a new --stack cli arg that has the same effect. If
both are specified, --stack will take precedence.

View File

@ -51,7 +51,12 @@ opts = [
cfg.StrOpt('project-name', default=os.environ.get(
'OS_PROJECT_NAME', os.environ.get('OS_TENANT_NAME'))),
cfg.StrOpt('cacert', default=os.environ.get('OS_CACERT')),
cfg.StrOpt('plan', default=os.environ.get('TRIPLEO_PLAN_NAME')),
cfg.StrOpt('plan', default=os.environ.get('TRIPLEO_PLAN_NAME'),
help=('stack name to use for generating the '
'inventory data.')),
cfg.StrOpt('stack', help=('This arg has the same effect '
'as --plan. If both are specified, --stack '
'will take precedence.')),
cfg.StrOpt('ansible_ssh_user', default=os.environ.get('ANSIBLE_SSH_USER',
'heat-admin')),
]
@ -128,7 +133,7 @@ def main():
project_name=configs.project_name,
username=configs.username,
ansible_ssh_user=configs.ansible_ssh_user,
plan_name=configs.plan)
plan_name=configs.stack or configs.plan)
if configs.list or configs.static_inventory:
try: