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

Fixed payload format #7754

Merged
merged 3 commits into from
Dec 26, 2023
Merged

Fixed payload format #7754

merged 3 commits into from
Dec 26, 2023

Conversation

eeferg
Copy link
Contributor

@eeferg eeferg commented Dec 20, 2023

SUMMARY

Changes the REST API Payload format to work with the current status.io API

There was no known bugfix issue for this. I discovered it this week and found a fix.

bugfixes:

  • community.general.statusio_maintenance - fix error caused by incorrectly formed api data payload. was raising Failed to create maintenance: HTTP Error 400: Bad Request caused by bad data type for date/time and deprecated dict keys.
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

community.general.statusio_maintenance

ADDITIONAL INFORMATION
  • API dates and times are expecting string but original module provided list type. Author added a step to turn the list of strings into a list of list items, containing one string each. I removed that step and correctly parse the strings into the payload.

The current status.io API requires a combined infrastructure ID, in the form of 'component_id-container_id'. I have not been able to find any change history on the API to show when this changed from what the original module was sending but the individual component_id and container_id are no longer supported.

$ ansible-playbook -i hosts.txt status-io-maintenance.yml

PLAY [Status.IO maintenance update] **************************************************************************************************************

TASK [Create a maintenance window for 60 minutes on server1 and server2] *************************************************************************
fatal: [localhost]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python3"}, "changed": false, "msg": "Failed to create maintenance: HTTP Error 400: Bad Request"}

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   


$ ansible-playbook -i hosts.txt status-io-maintenance.yml

PLAY [Status.IO maintenance update] **************************************************************************************************************

TASK [Create a maintenance window for 60 minutes on server1 and server2] *************************************************************************
changed: [localhost]

PLAY RECAP ***************************************************************************************************************************************
localhost                  : ok=1    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0 

@ansibullbot
Copy link
Collaborator

@ansibullbot ansibullbot added bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type) labels Dec 20, 2023
@felixfontein felixfontein added check-before-release PR will be looked at again shortly before release and merged if possible. backport-7 backport-8 Automatically create a backport for the stable-8 branch labels Dec 21, 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. Could you please add a changelog fragment? Thanks.

@eeferg
Copy link
Contributor Author

eeferg commented Dec 21, 2023

I have added the changelog fragment.

@bhcopeland
Copy link

LGTM! Thanks for the contribution!

@felixfontein
Copy link
Collaborator

@eeferg in case you added the changelog fragment, you haven't pushed it :)

@felixfontein
Copy link
Collaborator

(It's a YAML file in changelogs/fragments/.)

Co-authored-by: Felix Fontein <felix@fontein.de>
@eeferg
Copy link
Contributor Author

eeferg commented Dec 26, 2023

Thanks for the assistance on my first commit.

@felixfontein felixfontein removed the check-before-release PR will be looked at again shortly before release and merged if possible. label Dec 26, 2023
@felixfontein felixfontein merged commit 4a1006a into ansible-collections:main Dec 26, 2023
Copy link

patchback bot commented Dec 26, 2023

Backport to stable-7: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-7/4a1006ac34460b0819007c13d0aab191cb607673/pr-7754

Backported as #7762

🤖 @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 Dec 26, 2023
* Fixed payload format

* added changelog fragment

* Update changelogs/fragments/7754-fixed-payload-format.yml

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

---------

Co-authored-by: Ed Ferguson <eferguson@nrtc.coop>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4a1006a)
Copy link

patchback bot commented Dec 26, 2023

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/4a1006ac34460b0819007c13d0aab191cb607673/pr-7754

Backported as #7763

🤖 @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 Dec 26, 2023
* Fixed payload format

* added changelog fragment

* Update changelogs/fragments/7754-fixed-payload-format.yml

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

---------

Co-authored-by: Ed Ferguson <eferguson@nrtc.coop>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4a1006a)
@felixfontein
Copy link
Collaborator

@eeferg thank you very much for fixing this!
@bhcopeland thanks a lot for reviewing!

felixfontein pushed a commit that referenced this pull request Dec 26, 2023
Fixed payload format (#7754)

* Fixed payload format

* added changelog fragment

* Update changelogs/fragments/7754-fixed-payload-format.yml

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

---------

Co-authored-by: Ed Ferguson <eferguson@nrtc.coop>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4a1006a)

Co-authored-by: Ed Ferguson <5855090+eeferg@users.noreply.github.com>
felixfontein pushed a commit that referenced this pull request Dec 26, 2023
Fixed payload format (#7754)

* Fixed payload format

* added changelog fragment

* Update changelogs/fragments/7754-fixed-payload-format.yml

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

---------

Co-authored-by: Ed Ferguson <eferguson@nrtc.coop>
Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 4a1006a)

Co-authored-by: Ed Ferguson <5855090+eeferg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 Automatically create a backport for the stable-8 branch bug This issue/PR relates to a bug module module new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants