-
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 module is missing a cast to integer for transitions list #1774
Labels
bug
This issue/PR relates to a bug
waiting_on_contributor
Needs help. Feel free to engage to get things unblocked
Comments
markuman
added
bug
This issue/PR relates to a bug
waiting_on_contributor
Needs help. Feel free to engage to get things unblocked
labels
Apr 17, 2023
@Razique thanks for reporting and digging into the code.
|
Yup! |
rmahroua
added a commit
to rmahroua/community.aws
that referenced
this issue
Apr 24, 2023
rmahroua
added a commit
to rmahroua/community.aws
that referenced
this issue
May 4, 2023
tremble
pushed a commit
to tremble/community.aws
that referenced
this issue
May 5, 2023
…ollections#1788) s3_lifecycle - fix invalid value type for transitions list Depends-On: ansible-collections#1792 SUMMARY Fixes ansible-collections#1774 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION Forces casting to integer for the transition_days parameter of a transitions list. Reviewed-by: Mark Chappell
tremble
pushed a commit
to tremble/community.aws
that referenced
this issue
May 5, 2023
…ollections#1788) s3_lifecycle - fix invalid value type for transitions list Depends-On: ansible-collections#1792 SUMMARY Fixes ansible-collections#1774 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION Forces casting to integer for the transition_days parameter of a transitions list. Reviewed-by: Mark Chappell
softwarefactory-project-zuul bot
pushed a commit
that referenced
this issue
May 5, 2023
…1807) [backport] [stable-5] s3_lifecycle - fix invalid value type for transitions list (#1788) Manual backport of #1788 SUMMARY Fixes #1774 ISSUE TYPE Bugfix Pull Request COMPONENT NAME s3_lifecycle ADDITIONAL INFORMATION Forces casting to integer for the transition_days parameter of a transitions list. Reviewed-by: Alina Buzachis
abikouo
pushed a commit
to abikouo/community.aws
that referenced
this issue
Oct 24, 2023
…e_iam_password_policy Promote iam_password_policy
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
This issue/PR relates to a bug
waiting_on_contributor
Needs help. Feel free to engage to get things unblocked
Summary
Hi,
I have noticed that when using the
community.aws.s3_lifecycle
module, AWS S3 complains that values passed for thetransition_days
of a life cycle transition are of string type instead of integer:This is what I have for my transition rule:
With
expiration_days
having a value of 30 andtransition_days
having a value of 15.Looking at the code, I suspect that passing the type instructs Ansible to perform an internal conversion:
The conversion isn't performed for parameters in transtions, because this is a list of dicts:
When the rule is being built via the
build_rule
function, the value is retrieved "as is", which can be a string if the value has been templated by Jinja2.I suggest to force the cast to integer via the following change. This way, irrespective of the type being "rendered" (either native int or str from Jinja2 templating), we always send the correct type:
I could be missing something, but in my test, forcing the conversion solved the issue.
Issue Type
Bug Report
Component Name
s3_lifecycle
Ansible Version
Collection Versions
AWS SDK versions
Configuration
$ ansible-config dump --only-changed
OS / Environment
Fedora release 34 (Thirty Four)
Steps to Reproduce
Expected Results
I expect the module to treat my input value as integer instead of string
Actual Results
"msg": "Parameter validation failed:\nInvalid type for parameter LifecycleConfiguration.Rules[0].Transitions[0].Days, value: 5, type: <class 'str'>, valid types: <class 'int'>",
Code of Conduct
The text was updated successfully, but these errors were encountered: