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

Add option "metadata_token_ttl_seconds" to ec2_metadata_facts module. #2209

Merged
merged 6 commits into from
Aug 5, 2024

Conversation

tonyswu
Copy link
Contributor

@tonyswu tonyswu commented Aug 1, 2024

Fixes: #2205

SUMMARY

ec2_metadata_facts sometimes returns 401 unauthorized if the IMDSv2 token times out. The token TTL is currently hardcoded to 60, this pull request aims to make it configurable.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

ec2_metadata_facts

Copy link

github-actions bot commented Aug 1, 2024

Docs Build 📝

Thank you for contribution!✨

This PR has been merged and your docs changes will be incorporated when they are next published.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/0ff8166844b4453bbe71fceb339a710e

✔️ ansible-galaxy-importer SUCCESS in 5m 06s
✔️ build-ansible-collection SUCCESS in 10m 21s
✔️ ansible-test-splitter SUCCESS in 4m 12s
✔️ integration-amazon.aws-1 SUCCESS in 13m 26s
Skipped 43 jobs

Copy link
Contributor

@tremble tremble left a comment

Choose a reason for hiding this comment

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

Looks good as a starting point, thanks for this. 3 things:

  1. Please add an integration test for the change. The current tests for this module can be found in tests/integration/targets/ec2_metadata_facts/playbooks/test_metadata.yml
    I think this can be as simple as overwriting some of the gathered facts, running ec2_metadata_facts again with the timeout set, and then testing that the facts got updated.

  2. Please add a changelog fragment

  3. Please add "version_added: 8.2.0" to the documentation for options (just underneath default, at the same indentation.

plugins/modules/ec2_metadata_facts.py Show resolved Hide resolved
@tonyswu
Copy link
Contributor Author

tonyswu commented Aug 2, 2024

@tremble thanks for the comments, I've added integration test and changelog fragments as suggested.

Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/a8cca4916ae54cbfaf9875b110be1692

✔️ ansible-galaxy-importer SUCCESS in 4m 37s
✔️ build-ansible-collection SUCCESS in 10m 20s
✔️ ansible-test-splitter SUCCESS in 4m 14s
✔️ integration-amazon.aws-1 SUCCESS in 9m 52s
Skipped 43 jobs

@tremble tremble added the backport-8 PR should be backported to the stable-8 branch label Aug 5, 2024
plugins/modules/ec2_metadata_facts.py Outdated Show resolved Hide resolved
Copy link
Contributor

Build succeeded.
https://ansible.softwarefactory-project.io/zuul/buildset/889644bd60be44a5b5a5c2da8bfda1db

✔️ ansible-galaxy-importer SUCCESS in 4m 53s
✔️ build-ansible-collection SUCCESS in 10m 28s
✔️ ansible-test-splitter SUCCESS in 4m 17s
✔️ integration-amazon.aws-1 SUCCESS in 9m 34s
Skipped 43 jobs

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Aug 5, 2024
Copy link
Contributor

Build succeeded (gate pipeline).
https://ansible.softwarefactory-project.io/zuul/buildset/05bd0c29a2214f7ca66998d58dc8a3e3

✔️ ansible-galaxy-importer SUCCESS in 4m 51s
✔️ build-ansible-collection SUCCESS in 10m 30s
✔️ ansible-test-splitter SUCCESS in 4m 13s
✔️ integration-amazon.aws-1 SUCCESS in 9m 08s
Skipped 43 jobs

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 5756ac4 into ansible-collections:main Aug 5, 2024
36 checks passed
Copy link

patchback bot commented Aug 5, 2024

Backport to stable-8: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-8/5756ac437c79393c009d99df71d9ded95dd6be84/pr-2209

Backported as #2210

🤖 @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 Aug 5, 2024
…#2209)

Fixes: #2205
SUMMARY
ec2_metadata_facts sometimes returns 401 unauthorized if the IMDSv2 token times out. The token TTL is currently hardcoded to 60, this pull request aims to make it configurable.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_metadata_facts

Reviewed-by: Mark Chappell
(cherry picked from commit 5756ac4)
softwarefactory-project-zuul bot pushed a commit that referenced this pull request Aug 28, 2024
…#2209) (#2210)

Depends-On: #2258
This is a backport of PR #2209 as merged into main (5756ac4).
Fixes: #2205
SUMMARY
ec2_metadata_facts sometimes returns 401 unauthorized if the IMDSv2 token times out. The token TTL is currently hardcoded to 60, this pull request aims to make it configurable.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_metadata_facts

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
braydencw1 pushed a commit to braydencw1/amazon.aws that referenced this pull request Aug 29, 2024
…ansible-collections#2209)

Fixes: ansible-collections#2205
SUMMARY
ec2_metadata_facts sometimes returns 401 unauthorized if the IMDSv2 token times out. The token TTL is currently hardcoded to 60, this pull request aims to make it configurable.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
ec2_metadata_facts

Reviewed-by: Mark Chappell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-8 PR should be backported to the stable-8 branch mergeit Merge the PR (SoftwareFactory)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ec2_metadata_facts returns 401 if IMDSv2 token times out
2 participants