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

Rundeck - fix TypeError on 404 api response #6983

Merged
merged 3 commits into from
Jul 31, 2023

Conversation

MehuiSeklayr
Copy link
Contributor

@MehuiSeklayr MehuiSeklayr commented Jul 20, 2023

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

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module_utils module_utils new_contributor Help guide this first time contributor plugins plugin (any type) small_patch Hopefully easy to review traceback labels Jul 20, 2023
@MehuiSeklayr MehuiSeklayr changed the title fix TypeError on 404 api response Rundeck - fix TypeError on 404 api response Jul 20, 2023
@ansibullbot ansibullbot removed the small_patch Hopefully easy to review label Jul 20, 2023
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-6 backport-7 Automatically create a backport for the stable-7 branch labels Jul 20, 2023
Copy link
Collaborator

@felixfontein felixfontein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!

…ponse.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
@felixfontein
Copy link
Collaborator

If nobody objects, I'll merge this by the end of this week.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Jul 31, 2023
@felixfontein felixfontein merged commit a942545 into ansible-collections:main Jul 31, 2023
151 checks passed
@patchback
Copy link

patchback bot commented Jul 31, 2023

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/a942545dd2ec718993f95db35ac3e988d24e73a5/pr-6983

Backported as #7040

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

patchback bot pushed a commit that referenced this pull request Jul 31, 2023
* 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)
@patchback
Copy link

patchback bot commented Jul 31, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/a942545dd2ec718993f95db35ac3e988d24e73a5/pr-6983

Backported as #7041

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@felixfontein
Copy link
Collaborator

@MehuiSeklayr thanks for your contribution!

patchback bot pushed a commit that referenced this pull request Jul 31, 2023
* 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)
felixfontein pushed a commit that referenced this pull request Jul 31, 2023
… api response (#7041)

Rundeck - fix TypeError on 404 api response (#6983)

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

Co-authored-by: Vincent CHARLES <124702855+MehuiSeklayr@users.noreply.github.com>
felixfontein pushed a commit that referenced this pull request Jul 31, 2023
… api response (#7040)

Rundeck - fix TypeError on 404 api response (#6983)

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

Co-authored-by: Vincent CHARLES <124702855+MehuiSeklayr@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-7 Automatically create a backport for the stable-7 branch 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

4 participants