summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPilou <pierre-louis.bonicoli@libregerbil.fr>2019-06-26 08:04:50 +0000
committerToshio Kuratomi <a.badger@gmail.com>2019-07-17 12:44:31 -0700
commitafb91e51408731859422c019f65f169e887ab31c (patch)
tree7622831f541a03cb83bf504e8abffc4d68887dc7
parent863520b077b24e33bed0a92ecd3d56b3d5a4b3ae (diff)
downloadansible-afb91e51408731859422c019f65f169e887ab31c.tar.gz
[2.8] tower_role: ensure alias of "validate_certs" parameter is handled
* tower_role: ensure alias of validate_certs is handled * tower modules: remove tower_verify_ssl alias too Error was: Failed to update role: The Tower server claims it was sent a bad request. GET https://tower/api/v2/projects/22/object_roles/ Params: [('tower_verify_ssl', False), ('role_field', 'admin_role')] Data: None Response: {"detail": "Role has no field named 'tower_verify_ssl'"} Full traceback: File "/tmp/ansible_tower_role_payload_7_2p0X/__main__.py", line 145, in main result = role.grant(**params) File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 365, in grant return self.role_write(fail_on_found=fail_on_found, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 242, in role_write fail_on_multiple_results=True, **data) File "/usr/local/lib/python2.7/dist-packages/tower_cli/models/base.py", line 301, in read r = client.get(url, params=params) File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 546, in get return self.request('GET', url, **kwargs) File "/usr/local/lib/python2.7/dist-packages/tower_cli/api.py", line 299, in request kwargs.get('data', None), r.content.decode('utf8')) (cherry picked from commit 77e01e6abc67efe4056924c620281f29a42c0159)
-rw-r--r--changelogs/fragments/57518-tower_role-fix_validate_certs.yml2
-rw-r--r--lib/ansible/module_utils/ansible_tower.py1
-rw-r--r--test/integration/targets/tower_role/tasks/main.yml8
3 files changed, 11 insertions, 0 deletions
diff --git a/changelogs/fragments/57518-tower_role-fix_validate_certs.yml b/changelogs/fragments/57518-tower_role-fix_validate_certs.yml
new file mode 100644
index 0000000000..95a0b48b1b
--- /dev/null
+++ b/changelogs/fragments/57518-tower_role-fix_validate_certs.yml
@@ -0,0 +1,2 @@
+minor_changes:
+ - fix exception when tower_verify_ssl parameter is used in tower_role module (https://github.com/ansible/ansible/pull/57518).
diff --git a/lib/ansible/module_utils/ansible_tower.py b/lib/ansible/module_utils/ansible_tower.py
index e20dd21326..ef687a669c 100644
--- a/lib/ansible/module_utils/ansible_tower.py
+++ b/lib/ansible/module_utils/ansible_tower.py
@@ -70,6 +70,7 @@ def tower_auth_config(module):
password = module.params.pop('tower_password', None)
if password:
auth_config['password'] = password
+ module.params.pop('tower_verify_ssl', None) # pop alias if used
verify_ssl = module.params.pop('validate_certs', None)
if verify_ssl is not None:
auth_config['verify_ssl'] = verify_ssl
diff --git a/test/integration/targets/tower_role/tasks/main.yml b/test/integration/targets/tower_role/tasks/main.yml
index eb1602f9b6..7088cc8059 100644
--- a/test/integration/targets/tower_role/tasks/main.yml
+++ b/test/integration/targets/tower_role/tasks/main.yml
@@ -27,6 +27,14 @@
that:
- "result is changed"
+- name: Test tower_verify_ssl alias
+ tower_role:
+ user: joe
+ role: update
+ project: Demo Project
+ tower_verify_ssl: true
+ state: absent
+
- name: Delete a User
tower_user:
username: joe