controller_meta, templating

This commit is contained in:
Seth Foster 2021-04-30 15:41:01 -04:00
parent 6911a59f39
commit ef56571772
No known key found for this signature in database
GPG Key ID: 86E90D96F7184028
10 changed files with 34 additions and 73 deletions

View File

@ -1,4 +1,4 @@
# AWX Ansible Collection
# Tower Ansible Collection
[comment]: # (*******************************************************)
[comment]: # (* *)
@ -12,7 +12,7 @@
[comment]: # (* upon build of the collection *)
[comment]: # (*******************************************************)
This Ansible collection allows for easy interaction with an AWX server via Ansible playbooks.
This Ansible collection allows for easy interaction with an Ansible Tower server via Ansible playbooks.
This source for this collection lives in the `awx_collection` folder inside of the
AWX source.
@ -22,12 +22,7 @@ doc fragment.
## Building and Installing
This collection templates the `galaxy.yml` file it uses.
Run `make build_collection` from the root folder of the AWX source tree.
This will create the `tar.gz` file inside the `awx_collection` folder
with the current AWX version, for example: `awx_collection/awx-awx-9.2.0.tar.gz`.
Installing the `tar.gz` involves no special instructions.
This collection should be installed from [Content Hub](https://cloud.redhat.com/ansible/automation-hub/ansible/tower/)
## Running
@ -63,11 +58,9 @@ oauth_token = LEdCpKVKc4znzffcpQL5vLG8oyeku6
## Release and Upgrade Notes
Notable releases of the `awx.awx` collection:
Notable releases of the `ansible.controller` collection:
- 7.0.0 is intended to be identical to the content prior to the migration, aside from changes necessary to function as a collection.
- 11.0.0 has no non-deprecated modules that depend on the deprecated `tower-cli` [PyPI](https://pypi.org/project/ansible-tower-cli/).
- 0.0.1-devel is the version you should see if installing from source, which is intended for development and expected to be unstable.
- 3.7.0 initial release
The following notes are changes that may require changes to playbooks:
@ -96,38 +89,6 @@ The following notes are changes that may require changes to playbooks:
- `tower_credential` no longer supports passing a file name to ssh_key_data.
- The HipChat `notification_type` has been removed and can no longer be created using the `tower_notification_template` module.
## Running Unit Tests
Tests to verify compatibility with the most recent AWX code are in `awx_collection/test/awx`.
These can be ran by `make test_collection` in the development container.
To run outside of the development container, or to run against
Ansible source, set up a working environment:
```
mkvirtualenv my_new_venv
# may need to replace psycopg2 with psycopg2-binary in requirements/requirements.txt
pip install -r requirements/requirements.txt -r requirements/requirements_dev.txt -r requirements/requirements_git.txt
make clean-api
pip install -e <path to your Ansible>
pip install -e .
pip install -e awxkit
py.test awx_collection/test/awx/
```
## Running Integration Tests
The integration tests require a virtualenv with `ansible` >= 2.9 and `awxkit`.
The collection must first be installed, which can be done using `make install_collection`.
You also need a configuration file, as described in the running section.
Run the tests:
```
# ansible-test must be run from the directory in which the collection is installed
cd ~/.ansible/collections/ansible_collections/awx/awx/
ansible-test integration
```
## Licensing

View File

@ -19,8 +19,8 @@ homepage: https://www.ansible.com/
issues: https://github.com/ansible/awx/issues?q=is%3Aissue+label%3Acomponent%3Aawx_collection
license:
- GPL-3.0-only
name: awx
namespace: awx
name: controller
namespace: ansible
readme: README.md
repository: https://github.com/ansible/awx
tags:

View File

@ -75,7 +75,7 @@ plugin_routing:
tower_settings:
redirect: settings
tower_meta:
redirect: meta
redirect: controller_meta
tower_export:
redirect: export
tower_ad_hoc_command_cancel:

View File

@ -13,7 +13,7 @@ ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported
DOCUMENTATION = '''
---
module: meta
module: controller_meta
author: "Alan Rominger (@alancoding)"
short_description: Returns metadata about the collection this module lives in.
description:
@ -49,7 +49,7 @@ version:
EXAMPLES = '''
- meta:
- controller_meta:
register: result
- name: Show details about the collection
@ -66,7 +66,7 @@ from ..module_utils.controller_api import ControllerAPIModule
def main():
module = ControllerAPIModule(argument_spec={})
namespace = {'awx': 'awx', 'tower': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown')
namespace = {'awx': 'awx', 'controller': 'ansible'}.get(module._COLLECTION_TYPE, 'unknown')
namespace_name = '{0}.{1}'.format(namespace, module._COLLECTION_TYPE)
module.exit_json(prefix=namespace_name, name=module._COLLECTION_TYPE, namespace=namespace, version=module._COLLECTION_VERSION)

View File

@ -25,7 +25,7 @@ no_module_for_endpoint = []
# Some modules work on the related fields of an endpoint. These modules will not have an auto-associated endpoint
no_endpoint_for_module = [
'import',
'meta',
'controller_meta',
'export',
'inventory_source_update',
'job_launch',
@ -170,7 +170,7 @@ def test_completeness(collection_import, request, admin_user, job_template, exec
if root == module_directory:
for filename in files:
# must begin with a letter a-z, and end in .py
if re.match('^[a-z].*\.py$', filename):
if re.match(r'^[a-z].*.py$', filename):
module_name = filename[:-3]
option_comparison[module_name] = {
'endpoint': 'N/A',

View File

@ -16,7 +16,7 @@
group_name: "AWX-Collection-tests-tower_api_lookup-group1-{{ test_id }}"
- name: Get our collection package
meta:
controller_meta:
register: tower_meta
- name: Generate the name of our plugin

View File

@ -1,6 +1,6 @@
---
- name: Get our collection package
meta:
controller_meta:
register: tower_meta
- name: Generate the name of our plugin

View File

@ -5,7 +5,7 @@
- name: Try to use a token as a dict which is missing the token parameter
job_list:
oauthtoken:
tower_oauthtoken:
not_token: "This has no token entry"
register: results
ignore_errors: true
@ -17,7 +17,7 @@
- name: Try to use a token as a list
job_list:
oauthtoken:
tower_oauthtoken:
- dummy_token
register: results
ignore_errors: true

View File

@ -1,16 +1,16 @@
plugins/modules/tower_receive.py validate-modules:deprecation-mismatch
plugins/modules/tower_send.py validate-modules:deprecation-mismatch
plugins/modules/tower_workflow_template.py validate-modules:deprecation-mismatch
plugins/modules/tower_credential.py pylint:wrong-collection-deprecated-version-tag
plugins/modules/tower_job_wait.py pylint:wrong-collection-deprecated-version-tag
plugins/modules/tower_notification_template.py pylint:wrong-collection-deprecated-version-tag
plugins/inventory/tower.py pylint:raise-missing-from
plugins/inventory/tower.py pylint:super-with-arguments
plugins/lookup/tower_schedule_rrule.py pylint:raise-missing-from
plugins/module_utils/tower_api.py pylint:super-with-arguments
plugins/module_utils/tower_awxkit.py pylint:super-with-arguments
plugins/modules/receive.py validate-modules:deprecation-mismatch
plugins/modules/send.py validate-modules:deprecation-mismatch
plugins/modules/workflow_template.py validate-modules:deprecation-mismatch
plugins/modules/credential.py pylint:wrong-collection-deprecated-version-tag
plugins/modules/job_wait.py pylint:wrong-collection-deprecated-version-tag
plugins/modules/notification_template.py pylint:wrong-collection-deprecated-version-tag
plugins/inventory/controller.py pylint:raise-missing-from
plugins/inventory/controller.py pylint:super-with-arguments
plugins/lookup/schedule_rrule.py pylint:raise-missing-from
plugins/module_utils/controller_api.py pylint:super-with-arguments
plugins/module_utils/awxkit.py pylint:super-with-arguments
plugins/module_utils/tower_legacy.py pylint:super-with-arguments
plugins/module_utils/tower_module.py pylint:super-with-arguments
plugins/module_utils/tower_module.py pylint:raise-missing-from
plugins/module_utils/controller_module.py pylint:super-with-arguments
plugins/module_utils/controller_module.py pylint:raise-missing-from
test/awx/conftest.py pylint:raise-missing-from
plugins/module_utils/tower_api.py pep8:E203
plugins/module_utils/controller_api.py pep8:E203

View File

@ -24,15 +24,15 @@
with_fileglob:
- "{{ collection_path }}/plugins/inventory/*.py"
- "{{ collection_path }}/plugins/lookup/*.py"
- "{{ collection_path }}/plugins/modules/tower_*.py"
- "{{ collection_path }}/plugins/modules/*.py"
loop_control:
label: "{{ item | basename }}"
- name: Change inventory file to support desired namespace and package names
replace:
path: "{{ collection_path }}/plugins/inventory/controller.py"
regexp: "^ NAME = 'awx.awx.tower' # REPLACE$"
replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE"
regexp: "^ NAME = 'awx.awx.controller' # REPLACE$"
replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.controller' # REPLACE"
- name: get list of test files
find: