diff --git a/releasenotes/notes/deprecate-ini-inventory-d7446df7e967adfe.yaml b/releasenotes/notes/deprecate-ini-inventory-d7446df7e967adfe.yaml new file mode 100644 index 000000000..66196aeec --- /dev/null +++ b/releasenotes/notes/deprecate-ini-inventory-d7446df7e967adfe.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The ``--static-inventory`` argument to ``tripleo-ansible-inventory`` has + been deprecated and aliased to ``--static-yaml-inventory``. See + `bug 1751855 `__. diff --git a/scripts/tripleo-ansible-inventory b/scripts/tripleo-ansible-inventory index bd1b81662..329a8bae2 100755 --- a/scripts/tripleo-ansible-inventory +++ b/scripts/tripleo-ansible-inventory @@ -36,9 +36,10 @@ from tripleo_validations.utils import get_auth_session opts = [ cfg.StrOpt('host', help='List details about the specific host'), cfg.BoolOpt('list', help='List active hosts'), - cfg.StrOpt('static-inventory', help=('output the active hosts ' - 'to a static inventory ' - '(ini format) file.'), + cfg.StrOpt('static-inventory', help=('ini inventory is deprecated, ' + 'the inventory will be output ' + 'in yaml format. Please use ' + '--static-yaml-format.'), deprecated_for_removal=True, deprecated_reason="Use --static-yaml-inventory."), cfg.StrOpt('static-yaml-inventory', help=('output the active hosts ' @@ -135,19 +136,21 @@ def main(): ansible_ssh_user=configs.ansible_ssh_user, plan_name=configs.stack or configs.plan) - if configs.list or configs.static_inventory: + if configs.list: try: inventory_list = inventory.list() - if configs.list: - print(json.dumps(inventory_list)) - elif configs.static_inventory: - write_static_inventory(configs.static_inventory, - inventory_list) + print(json.dumps(inventory_list)) except Exception as e: print("Error creating inventory: {}".format(e.message), file=sys.stderr) sys.exit(1) - elif configs.static_yaml_inventory: + elif configs.static_yaml_inventory or configs.static_inventory: + if configs.static_inventory: + configs.static_yaml_inventory = configs.static_inventory + '.yaml' + print('WARNING: ini format is deprecated, the inventory will ' + 'be output in yaml format as {}. Please use ' + '--static-yaml-format.'.format( + configs.static_yaml_inventory)) try: inventory.write_static_inventory(configs.static_yaml_inventory) except Exception as e: