diff options
author | softwarefactory-project-zuul[bot] <33884098+softwarefactory-project-zuul[bot]@users.noreply.github.com> | 2020-10-30 22:15:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-30 22:15:20 +0100 |
commit | 17b5b531bf36e337995aa46735c1b598b2e686fb (patch) | |
tree | 36e13a904382d1d853f21ee9b26e874b9151a619 /awx_collection | |
parent | Merge pull request #8496 from jainnikhil30/fix_tower_inventory_empty__child_g... (diff) | |
parent | fix busted webhook notifications (diff) | |
download | awx-17b5b531bf36e337995aa46735c1b598b2e686fb.tar.xz awx-17b5b531bf36e337995aa46735c1b598b2e686fb.zip |
Merge pull request #8506 from ryanpetrello/yet-another-downstream-merge
merge in some downstream changes
Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
Diffstat (limited to 'awx_collection')
-rw-r--r-- | awx_collection/plugins/modules/tower_instance_group.py | 2 | ||||
-rw-r--r-- | awx_collection/plugins/modules/tower_license.py | 41 | ||||
-rw-r--r-- | awx_collection/tools/roles/template_galaxy/tasks/main.yml | 13 |
3 files changed, 36 insertions, 20 deletions
diff --git a/awx_collection/plugins/modules/tower_instance_group.py b/awx_collection/plugins/modules/tower_instance_group.py index 77c4ac4ece..076610f7c0 100644 --- a/awx_collection/plugins/modules/tower_instance_group.py +++ b/awx_collection/plugins/modules/tower_instance_group.py @@ -111,7 +111,7 @@ def main(): # Attempt to look up an existing item based on the provided data existing_item = module.get_one('instance_groups', name_or_id=name) - if state is 'absent': + if state == 'absent': # If the state was absent we can let the module delete it if needed, the module will handle exiting from this module.delete_if_needed(existing_item) diff --git a/awx_collection/plugins/modules/tower_license.py b/awx_collection/plugins/modules/tower_license.py index 25d337cc24..b432fef9ec 100644 --- a/awx_collection/plugins/modules/tower_license.py +++ b/awx_collection/plugins/modules/tower_license.py @@ -21,11 +21,11 @@ description: - Get or Set Ansible Tower license. See U(https://www.ansible.com/tower) for an overview. options: - data: + manifest: description: - - The contents of the license file + - file path to a Red Hat subscription manifest (a .zip file) required: True - type: dict + type: str eula_accepted: description: - Whether or not the EULA is accepted. @@ -39,10 +39,11 @@ RETURN = ''' # ''' EXAMPLES = ''' - name: Set the license using a file license: - data: "{{ lookup('file', '/tmp/my_tower.license') }}" + manifest: "/tmp/my_manifest.zip" eula_accepted: True ''' +import base64 from ..module_utils.tower_api import TowerAPIModule @@ -50,29 +51,31 @@ def main(): module = TowerAPIModule( argument_spec=dict( - data=dict(type='dict', required=True), + manifest=dict(type='str', required=True), eula_accepted=dict(type='bool', required=True), ), ) - json_output = {'changed': False} + json_output = {'changed': True} if not module.params.get('eula_accepted'): module.fail_json(msg='You must accept the EULA by passing in the param eula_accepted as True') - json_output['old_license'] = module.get_endpoint('settings/system/')['json']['LICENSE'] - new_license = module.params.get('data') - - if json_output['old_license'] != new_license: - json_output['changed'] = True - - # Deal with check mode - if module.check_mode: - module.exit_json(**json_output) - - # We need to add in the EULA - new_license['eula_accepted'] = True - module.post_endpoint('config', data=new_license) + try: + manifest = base64.b64encode( + open(module.params.get('manifest'), 'rb').read() + ) + except OSError as e: + module.fail_json(msg=str(e)) + + # Deal with check mode + if module.check_mode: + module.exit_json(**json_output) + + module.post_endpoint('config', data={ + 'eula_accepted': True, + 'manifest': manifest.decode() + }) module.exit_json(**json_output) diff --git a/awx_collection/tools/roles/template_galaxy/tasks/main.yml b/awx_collection/tools/roles/template_galaxy/tasks/main.yml index 96eb26413c..84f8174095 100644 --- a/awx_collection/tools/roles/template_galaxy/tasks/main.yml +++ b/awx_collection/tools/roles/template_galaxy/tasks/main.yml @@ -34,6 +34,19 @@ regexp: "^ NAME = 'awx.awx.tower' # REPLACE$" replace: " NAME = '{{ collection_namespace }}.{{ collection_package }}.tower' # REPLACE" + - name: get list of test files + find: + paths: "{{ collection_path }}/tests/integration/targets/" + recurse: true + register: test_files + + - name: Change lookup plugin fqcn usage in tests + replace: + path: "{{ item.path }}" + regexp: 'awx.awx' + replace: '{{ collection_namespace }}.{{ collection_package }}' + loop: "{{ test_files.files }}" + - name: Get sanity tests to work with non-default name lineinfile: path: "{{ collection_path }}/tests/sanity/ignore-2.10.txt" |