-
Notifications
You must be signed in to change notification settings - Fork 397
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
s3_lifecycle is not idempotent - does write action for no change #1624
Comments
Files identified in the description:
If these files are inaccurate, please update the |
@mdavis-xyz Can you debug e.g. with community.aws/plugins/modules/s3_lifecycle.py Line 467 in bdb7c9f
import q
q(changed) and |
I've never heard of the Just to be clear, regardless of what community.aws/plugins/modules/s3_lifecycle.py Lines 467 to 476 in bdb7c9f
There's really two issues here.
For the second one, we can fix that with For the first one, perhaps everything after I'll try the |
Ok I couldn't figure out how to run a playbook using a local clone of the module, without messing with my real global installation. (Are there docs for that somewhere? As an Ansible user I never need to touch galaxy or anything like that, because I only use the standard pre-installed collections.) So I just created a whole new VM to test in, and modified the file in the globally installed collection.
So it was True the first time, as expected, and False the remainder, as expected. I tried wrapping up the put and try inside an
What's the best way to add a unit/integration test for this? My MWE uses multiple hosts. Is that easy to do with the existing test setup? Or is there a way to run with a |
Yeah, basically you can also place hacky/patched modules in your roles/playbook directory in the See https://docs.ansible.com/ansible/2.8/user_guide/playbooks_best_practices.html#directory-layout
|
Note for testing: my MWE only was for a non-empty list of rules. |
… change to put (#1629) make s3_lifecycle not call put_lifecycle_configuration if there is no… SUMMARY Fixes #1624 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION I have not written integration tests for this. My MWE in #1624 used multiple hosts (all localhost). I don't know how to add that here. Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Alina Buzachis <None>
… change to put (#1629) make s3_lifecycle not call put_lifecycle_configuration if there is no… SUMMARY Fixes #1624 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION I have not written integration tests for this. My MWE in #1624 used multiple hosts (all localhost). I don't know how to add that here. Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Alina Buzachis <None> (cherry picked from commit 5aa3ff1)
… change to put (#1629) make s3_lifecycle not call put_lifecycle_configuration if there is no… SUMMARY Fixes #1624 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION I have not written integration tests for this. My MWE in #1624 used multiple hosts (all localhost). I don't know how to add that here. Reviewed-by: Markus Bergholz <[email protected]> Reviewed-by: Alina Buzachis <None> (cherry picked from commit 5aa3ff1)
… change to put (#1629) (#1649) [PR #1629/5aa3ff17 backport][stable-5] make s3_lifecycle not call put_lifecycle_configuration if there is no… This is a backport of PR #1629 as merged into main (5aa3ff1). SUMMARY Fixes #1624 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION I have not written integration tests for this. My MWE in #1624 used multiple hosts (all localhost). I don't know how to add that here. Reviewed-by: Markus Bergholz <[email protected]>
… change to put (#1629) (#1647) [PR #1629/5aa3ff17 backport][stable-4] make s3_lifecycle not call put_lifecycle_configuration if there is no… This is a backport of PR #1629 as merged into main (5aa3ff1). SUMMARY Fixes #1624 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION I have not written integration tests for this. My MWE in #1624 used multiple hosts (all localhost). I don't know how to add that here. Reviewed-by: Markus Bergholz <[email protected]>
Summary
When
s3_lifecycle
is run and there are no changes to make, it still callsput_bucket_lifecycle_configuration
.My use case is that I am running a playbook multiple times concurrently, for a lifecycle configuration which is not changing. And I'm getting errors because of concurrency clashes. If I'm not changing the lifecycle, I expect only read-only calls to S3, which shouldn't clash.
This module should get the existing lifecycle config, compare it to what we want, and only if it differs, put the new lifecycle.
Issue Type
Bug Report
Component Name
s3_lifecycle
Ansible Version
Collection Versions
AWS SDK versions
$ pip show boto boto3 botocore
Configuration
OS / Environment
Amazon Linux 2
Steps to Reproduce
playbook.yaml
hosts.yaml
Run with:
Expected Results
By the time we get to the last task, the bucket already has the lifecycle config we want. So the last tasks should also report success (no change), without throwing any errors. boto3 should only be used for read-only calls. No put call should be made by Ansible.
Actual Results
i.e. some reported success, with no change.
Others threw an error.
Code of Conduct
The text was updated successfully, but these errors were encountered: