Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tower_role: ensure alias of "validate_certs" parameter is handled #57518

Open
wants to merge 2 commits into
base: devel
from

Conversation

Projects
None yet
2 participants
@pilou-
Copy link
Contributor

commented Jun 7, 2019

SUMMARY

tower_role: fix exception when tower_verify_ssl parameter is used

integration test provided.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

tower modules

ADDITIONAL INFORMATION

Caused by #54315.
Once merged, i will create propose a backport.

@pilou-

This comment has been minimized.

Copy link
Contributor Author

commented Jun 7, 2019

As expected, test fails:

03:58 TASK [tower_role : Test tower_verify_ssl alias] ********************************
03:58 task path: /root/.ansible/test/tmp/tower_role-Oop_DK-ÅÑŚÌβŁÈ/test/integration/targets/tower_role/tasks/main.yml:30
[...]
03:58 The full traceback is:
03:58 WARNING: The below traceback may *not* be related to the actual failure.
03:58   File "/tmp/ansible_tower_role_payload_dA8CdD/__main__.py", line 148, in main
03:58     result = role.revoke(**params)
03:58   File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 393, in revoke
03:58     disassociate=True, **kwargs)
03:58   File "/usr/local/lib/python2.7/dist-packages/tower_cli/resources/role.py", line 241, in role_write
03:58     fail_on_multiple_results=True, **data)
03:58   File "/usr/local/lib/python2.7/dist-packages/tower_cli/models/base.py", line 288, in read
03:58     r = client.get(url, params=kwargs)
03:58   File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 546, in get
03:58     return self.request('GET', url, **kwargs)
03:58   File "/usr/local/lib/python2.7/dist-packages/tower_cli/api.py", line 286, in request
03:58     kwargs.get('data', None), r.content.decode('utf8'))
03:58 
03:58 fatal: [testhost]: FAILED! => {
03:58     "changed": false, 
03:58     "invocation": {
03:58         "module_args": {
03:58             "credential": null, 
03:58             "inventory": null, 
03:58             "job_template": null, 
03:58             "organization": null, 
03:58             "project": "Demo Project", 
03:58             "target_team": null, 
03:58             "team": null, 
03:58             "tower_verify_ssl": true, 
03:58             "user": "joe"
03:58         }
03:58     }, 
03:58     "msg": "Failed to update role: The Tower server claims it was sent a bad request.\n\nGET https://ec2-34-204-199-179.compute-1.amazonaws.com/api/v2/projects/4/object_roles/\nParams: {'tower_verify_ssl': True, 'role_field': 'update_role'}\nData: None\n\nResponse: {\"detail\":\"Role has no field named 'tower_verify_ssl'\"}"

Next commit will propose a fix.

@ansibot ansibot added the small_patch label Jun 7, 2019

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Jun 7, 2019

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

lib/ansible/module_utils/ansible_tower.py:73:52: E261 at least two spaces before inline comment

click here for bot help

@ansibot ansibot added the ci_verified label Jun 7, 2019

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'))

@pilou- pilou- force-pushed the pilou-:tower_modules_handle_tower_verify_ssl_alias branch from dc0a412 to 6e9d220 Jun 7, 2019

@ansibot ansibot removed the ci_verified label Jun 7, 2019

@pilou- pilou- changed the title [WIP] tower_role: ensure alias of "validate_certs" parameter is handled tower_role: ensure alias of "validate_certs" parameter is handled Jun 8, 2019

@ansibot ansibot added community_review and removed WIP labels Jun 8, 2019

@ansibot ansibot added the stale_ci label Jun 16, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.