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

[PR #6983/a942545d backport][stable-7] Rundeck - fix TypeError on 404 api response #7041

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Jul 31, 2023

This is a backport of PR #6983 as merged into main (a942545).

Hello dear Ansible community :)

This is my first contribution, feel free to express any kind of criticism, be it on the content or the format.

SUMMARY

I found a bug when using community.general.rundeck_acl_policy.

While creating a new ACL, I was greeted by the following trace:

  File "/.../community/general/plugins/modules/rundeck_acl_policy.py", line 239, in <module>
  File "/.../community/general/plugins/modules/rundeck_acl_policy.py", line 233, in main
  File "/.../community/general/plugins/modules/rundeck_acl_policy.py", line 143, in create_or_update_acl
  File "/.../community/general/plugins/modules/rundeck_acl_policy.py", line 137, in get_acl
  File "/.../community/general/plugins/module_utils/rundeck.py", line 83, in api_request
TypeError: 'NoneType' object is not callable
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME
  • plugins/module_utils/rundeck.py
ADDITIONAL INFORMATION

On success, the fetch_url function returns something like:
<addinfourl at 139713744344848 whose fp = <socket._fileobject object at 0x7f11a69761d0>>

However, when the api returns a 404, the return value is:
HTTP Error 404: Not Found
In such a case, response.read() fails with the aforementionned TypeError.

The error could be specific to sundeck's API version. I did my testing with api version 40, which is not too far behind latest (v45), and way ahead of the current depreciation threshold (v14). source

Let me know if I am missing anything!

Have a great day :)

* fix TypeError on 404 api response

* add changelog fragment

* Update changelogs/fragments/6983-rundeck-fix-typerrror-on-404-api-response.yml

Co-authored-by: Felix Fontein <felix@fontein.de>

---------

Co-authored-by: Vincent CHARLES <vincent.charles@swatchgroup.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit a942545)
@ansibullbot ansibullbot added backport bug This issue/PR relates to a bug module_utils module_utils needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) traceback and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR labels Jul 31, 2023
@felixfontein felixfontein merged commit eda3d16 into stable-7 Jul 31, 2023
150 checks passed
@felixfontein felixfontein deleted the patchback/backports/stable-7/a942545dd2ec718993f95db35ac3e988d24e73a5/pr-6983 branch July 31, 2023 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) traceback
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants