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 #1174/9401932f backport][stable-5] Refacterization of code to use 'fallback' instead of using os.environ #1224

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Oct 29, 2022

This is a backport of PR #1174 as merged into main (9401932).

SUMMARY

When the "ec2" module was first added, it included support for pulling credentials out of the environment variables. 3.5 years later, in Ansible 2.1, support for configuring a 'fallback' directly in the argument specification was added, but we never got around to using it.

This PR finally cleans up the code and lets the argument parser directly handle fallback to environment variables.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

plugins/module_utils/botocore.py
plugins/module_utils/modules.py

ADDITIONAL INFORMATION

…#1174)

Refacterization of code to use 'fallback' instead of using os.environ

SUMMARY
When the "ec2" module was first added, it included support for pulling credentials out of the environment variables.  3.5 years later, in Ansible 2.1, support for configuring a 'fallback' directly in the argument specification was added, but we never got around to using it.
This PR finally cleans up the code and lets the argument parser directly handle fallback to environment variables.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/module_utils/botocore.py
plugins/module_utils/modules.py
ADDITIONAL INFORMATION

Reviewed-by: Gonéri Le Bouder <[email protected]>
(cherry picked from commit 9401932)
@ansibullbot ansibullbot added community_review feature This issue/PR relates to a feature request module_utils module_utils needs_triage new_contributor Help guide this first time contributor plugins plugin (any type) labels Oct 29, 2022
@github-actions
Copy link

github-actions bot commented Oct 29, 2022

Docs Build 📝

Thank you for contribution!✨

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

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.

✔️ ansible-galaxy-importer SUCCESS in 4m 23s
✔️ build-ansible-collection SUCCESS in 5m 03s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 9m 28s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 10m 12s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 9m 10s
✔️ ansible-test-sanity-aws-ansible-2.14 SUCCESS in 9m 26s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 5m 59s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 5m 45s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 6m 03s
✔️ cloud-tox-py3 SUCCESS in 4m 24s
✔️ ansible-test-splitter SUCCESS in 3m 24s
✔️ integration-amazon.aws-1 SUCCESS in 7m 22s
⚠️ integration-amazon.aws-2 SKIPPED
⚠️ integration-amazon.aws-3 SKIPPED
⚠️ integration-amazon.aws-4 SKIPPED
⚠️ integration-amazon.aws-5 SKIPPED
⚠️ integration-amazon.aws-6 SKIPPED
⚠️ integration-amazon.aws-7 SKIPPED
⚠️ integration-amazon.aws-8 SKIPPED
⚠️ integration-amazon.aws-9 SKIPPED
⚠️ integration-amazon.aws-10 SKIPPED
⚠️ integration-amazon.aws-11 SKIPPED
⚠️ integration-amazon.aws-12 SKIPPED
⚠️ integration-amazon.aws-13 SKIPPED
⚠️ integration-amazon.aws-14 SKIPPED
⚠️ integration-amazon.aws-15 SKIPPED
⚠️ integration-amazon.aws-16 SKIPPED
⚠️ integration-amazon.aws-17 SKIPPED
⚠️ integration-amazon.aws-18 SKIPPED
✔️ integration-community.aws-1 SUCCESS in 5m 06s
✔️ integration-community.aws-2 SUCCESS in 25m 33s
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
✔️ ansible-test-changelog SUCCESS in 2m 16s

@tremble tremble added the mergeit Merge the PR (SoftwareFactory) label Nov 1, 2022
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).

✔️ ansible-galaxy-importer SUCCESS in 4m 54s
✔️ build-ansible-collection SUCCESS in 9m 01s
✔️ ansible-test-sanity-aws-ansible-python38 SUCCESS in 13m 42s
✔️ ansible-test-sanity-aws-ansible-2.12-python38 SUCCESS in 10m 11s
✔️ ansible-test-sanity-aws-ansible-2.13-python38 SUCCESS in 10m 43s
✔️ ansible-test-sanity-aws-ansible-2.14 SUCCESS in 10m 45s
✔️ ansible-test-units-amazon-aws-python36 SUCCESS in 8m 43s
✔️ ansible-test-units-amazon-aws-python38 SUCCESS in 9m 02s
✔️ ansible-test-units-amazon-aws-python39 SUCCESS in 7m 56s
✔️ cloud-tox-py3 SUCCESS in 3m 22s
✔️ ansible-test-splitter SUCCESS in 3m 48s
✔️ integration-amazon.aws-1 SUCCESS in 9m 04s
⚠️ integration-amazon.aws-2 SKIPPED
⚠️ integration-amazon.aws-3 SKIPPED
⚠️ integration-amazon.aws-4 SKIPPED
⚠️ integration-amazon.aws-5 SKIPPED
⚠️ integration-amazon.aws-6 SKIPPED
⚠️ integration-amazon.aws-7 SKIPPED
⚠️ integration-amazon.aws-8 SKIPPED
⚠️ integration-amazon.aws-9 SKIPPED
⚠️ integration-amazon.aws-10 SKIPPED
⚠️ integration-amazon.aws-11 SKIPPED
⚠️ integration-amazon.aws-12 SKIPPED
⚠️ integration-amazon.aws-13 SKIPPED
⚠️ integration-amazon.aws-14 SKIPPED
⚠️ integration-amazon.aws-15 SKIPPED
⚠️ integration-amazon.aws-16 SKIPPED
⚠️ integration-amazon.aws-17 SKIPPED
⚠️ integration-amazon.aws-18 SKIPPED
⚠️ integration-amazon.aws-19 SKIPPED
⚠️ integration-amazon.aws-20 SKIPPED
⚠️ integration-amazon.aws-21 SKIPPED
⚠️ integration-amazon.aws-22 SKIPPED
✔️ integration-community.aws-1 SUCCESS in 8m 22s
✔️ integration-community.aws-2 SUCCESS in 26m 44s
⚠️ integration-community.aws-3 SKIPPED
⚠️ integration-community.aws-4 SKIPPED
⚠️ integration-community.aws-5 SKIPPED
⚠️ integration-community.aws-6 SKIPPED
⚠️ integration-community.aws-7 SKIPPED
⚠️ integration-community.aws-8 SKIPPED
⚠️ integration-community.aws-9 SKIPPED
⚠️ integration-community.aws-10 SKIPPED
⚠️ integration-community.aws-11 SKIPPED
⚠️ integration-community.aws-12 SKIPPED
⚠️ integration-community.aws-13 SKIPPED
⚠️ integration-community.aws-14 SKIPPED
⚠️ integration-community.aws-15 SKIPPED
⚠️ integration-community.aws-16 SKIPPED
⚠️ integration-community.aws-17 SKIPPED
⚠️ integration-community.aws-18 SKIPPED
⚠️ integration-community.aws-19 SKIPPED
⚠️ integration-community.aws-20 SKIPPED
⚠️ integration-community.aws-21 SKIPPED
⚠️ integration-community.aws-22 SKIPPED
✔️ ansible-test-changelog SUCCESS in 2m 29s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 92aa244 into stable-5 Nov 1, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-5/9401932f98ef7c6bc412be0487c8e8c054f934eb/pr-1174 branch November 1, 2022 19:28
tremble added a commit that referenced this pull request Feb 22, 2023
fixes #1353

SUMMARY

#1224 exposed that the removal of support for passing both profiles and security tokens was only partially implemented in release 5.0.0 (#834)

Since we had already announced that support would be dropped for passing both (back in 2020 with release 1.2.0), I think it's reasonable to still fully drop support in 6.0.0. The documentation was originally very fuzzy about when we'd fallback and use which variables.

ISSUE TYPE

- Bugfix Pull Request

COMPONENT NAME

plugins/module_utils/botocore.py
plugins/module_utils/modules.py

ADDITIONAL INFORMATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community_review feature This issue/PR relates to a feature request mergeit Merge the PR (SoftwareFactory) module_utils module_utils needs_triage 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.

2 participants