From 16ebfe3a6373e7bd53e99d60b608a4f22880b355 Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Wed, 9 Oct 2019 14:02:30 -0400 Subject: [PATCH] use fully qualified inventory plugin name --- Makefile | 2 +- awx_collection/plugins/inventory/tower.py | 4 ++-- awx_collection/template_galaxy.yml | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9fd0fd3db4..9b307613d4 100644 --- a/Makefile +++ b/Makefile @@ -400,7 +400,7 @@ flake8_collection: test_collection_all: prepare_collection_venv test_collection flake8_collection build_collection: - ansible-playbook -i localhost, awx_collection/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e namespace_name=$(COLLECTION_NAMESPACE) -e package_version=$(VERSION) + ansible-playbook -i localhost, awx_collection/template_galaxy.yml -e collection_package=$(COLLECTION_PACKAGE) -e collection_namespace=$(COLLECTION_NAMESPACE) -e collection_version=$(VERSION) ansible-galaxy collection build awx_collection --output-path=awx_collection test_unit: diff --git a/awx_collection/plugins/inventory/tower.py b/awx_collection/plugins/inventory/tower.py index f4f20fe509..2cc35b339d 100644 --- a/awx_collection/plugins/inventory/tower.py +++ b/awx_collection/plugins/inventory/tower.py @@ -77,7 +77,7 @@ EXAMPLES = ''' # Example for using tower_inventory.yml file -plugin: tower +plugin: awx.awx.tower host: your_ansible_tower_server_network_address username: your_ansible_tower_username password: your_ansible_tower_password @@ -116,7 +116,7 @@ except ImportError: class InventoryModule(BaseInventoryPlugin): - NAME = 'tower' + NAME = 'awx.awx.tower' # REPLACE # Stays backward compatible with tower inventory script. # If the user supplies '@tower_inventory' as path, the plugin will read from environment variables. no_config_file_supplied = False diff --git a/awx_collection/template_galaxy.yml b/awx_collection/template_galaxy.yml index bfbea58bf7..f37198c46e 100644 --- a/awx_collection/template_galaxy.yml +++ b/awx_collection/template_galaxy.yml @@ -21,6 +21,12 @@ regexp: '^extends_documentation_fragment: awx.awx.auth$' replace: 'extends_documentation_fragment: {{ collection_namespace }}.{{ collection_package }}.auth' with_items: "{{ module_files.files }}" + + - name: Change files to support desired namespace and package names + replace: + path: "{{ playbook_dir }}/plugins/inventory/tower.py" + regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" + replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE" when: - (collection_package != 'awx') or (collection_namespace != 'awx')