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 #1077/4f989bdd backport][stable-3] s3_lifecycle: support value '0' for transition_days #1083

Conversation

patchback[bot]
Copy link

@patchback patchback bot commented Apr 20, 2022

This is a backport of PR #1077 as merged into main (4f989bd).

SUMMARY

s3_lifecycle module does not support value 0 for transition_days parameter.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

s3_lifecycle

ADDITIONAL INFORMATION

A lifecycle rule with 0 as transition_days allows to create a rule that will move objects with a delta of just few hours (if set to 1, objects will be moved with a delta of 1d + few hours).

When the value 0 is set, the value is stripped from the query and we get an error that is hard to correlate with an "invalid" value on this parameter (which is valid as 0 is an integer):

- name: Create s3 buckets lifecycle rules
  s3_lifecycle:
    ec2_url: "FIXME"
    region: "FIXME"
    aws_access_key: "FIXME"
    aws_secret_key: "FIXME"
    name: "FIXME"
    rule_id: "onezone"
    transitions:
    - transition_days: 0
      storage_class: "ONEZONE_IA"
    state: present
    status: enabled

fatal: [localhost]: FAILED! => {
    "boto3_version": "1.21.3",
    "botocore_version": "1.24.19",
    "changed": false,
    "error": {
        "code": "MalformedXML",
        "message": "Extra element Transition in interleave"
    },
    "lifecycle_configuration": {
        "Rules": [
            {
                "Filter": {
                    "Prefix": ""
                },
                "ID": "onezone",
                "Status": "Enabled",
                "Transitions": [
                    {
                        "StorageClass": "ONEZONE_IA"
                    }
                ]
            }
        ]
    },
    ...
MSG:

An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: Extra element Transition in interleave

This is because transition.get('transition_days') returns 0 which is considered as False on a condition (this patch just check if the value is defined; e.g. is not None).

s3_lifecycle: support value '0' for transition_days

SUMMARY
s3_lifecycle module does not support value 0 for transition_days parameter.
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
s3_lifecycle
ADDITIONAL INFORMATION
A lifecycle rule with 0 as transition_days allows to create a rule that will move objects with a delta of just few hours (if set to 1, objects will be moved with a delta of 1d + few hours).
When the value 0 is set, the value is stripped from the query and we get an error that is hard to correlate with an "invalid"  value on this parameter (which is valid as 0 is an integer):
- name: Create s3 buckets lifecycle rules
  s3_lifecycle:
    ec2_url: "FIXME"
    region: "FIXME"
    aws_access_key: "FIXME"
    aws_secret_key: "FIXME"
    name: "FIXME"
    rule_id: "onezone"
    transitions:
    - transition_days: 0
      storage_class: "ONEZONE_IA"
    state: present
    status: enabled

fatal: [localhost]: FAILED! => {
    "boto3_version": "1.21.3",
    "botocore_version": "1.24.19",
    "changed": false,
    "error": {
        "code": "MalformedXML",
        "message": "Extra element Transition in interleave"
    },
    "lifecycle_configuration": {
        "Rules": [
            {
                "Filter": {
                    "Prefix": ""
                },
                "ID": "onezone",
                "Status": "Enabled",
                "Transitions": [
                    {
                        "StorageClass": "ONEZONE_IA"
                    }
                ]
            }
        ]
    },
    ...
MSG:

An error occurred (MalformedXML) when calling the PutBucketLifecycleConfiguration operation: Extra element Transition in interleave

This is because transition.get('transition_days') returns 0 which is considered as False on a condition (this patch just check if the value is defined; e.g. is not None).

Reviewed-by: Mark Chappell <None>
Reviewed-by: Markus Bergholz <[email protected]>
(cherry picked from commit 4f989bd)
@ansibullbot
Copy link

@ansibullbot ansibullbot added bug This issue/PR relates to a bug community_review integration tests/integration module module needs_triage new_contributor Help guide this first time contributor plugins plugin (any type) tests tests labels Apr 20, 2022
@markuman markuman added the mergeit Merge the PR (SoftwareFactory) label Apr 21, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 8eed231 into stable-3 Apr 21, 2022
@softwarefactory-project-zuul softwarefactory-project-zuul bot deleted the patchback/backports/stable-3/4f989bdd5578373f97ce31008f50a15c825af5ef/pr-1077 branch April 21, 2022 19:27
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
Work around for ansible-collections#1083

SUMMARY
The collection currently doesn't run on Ansible 2.9 (which we say we test against).
fixes: ansible-collections#1083
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
plugins/module_utils/cloud.py
ADDITIONAL INFORMATION

Reviewed-by: Alina Buzachis <None>
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
Drop support for Ansible Core < 2.11

SUMMARY
We only perform integration tests against milestone.  And we only perform sanity tests against 2.12+.  Ansible Core  2.11 goes out of support in November
Trying to maintain support for Ansible 2.9 is only going to get more painful as time goes on, as demonstrated by ansible-collections#1083.
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
meta/runtime.yml
ADDITIONAL INFORMATION
Dropping support for 2.9/2.10 puts us in line with Ansible Core, community.general and community.network.
Additionally:

AAP 1.2 (based on 2.9) is in "Maintenance support 2" bugs and security fixes only (https://access.redhat.com/support/policy/updates/ansible-automation-platform), which we can support by backporting fixes if necessary
Later versions of AAP support ee-2.9, however ee-2.9 is only supported for "the Ansible Core RPMs" which would mean backports
Ansible Tower is in "Maintenance support 2" bugs and security fixes only (https://access.redhat.com/support/policy/updates/ansible-tower), with support ending in November which we can support by backporting fixes if necessary.
Ansible Engine 2.9 support has ended already (https://access.redhat.com/support/policy/updates/ansible-engine)

Reviewed-by: Jill R <None>
abikouo pushed a commit to abikouo/community.aws that referenced this pull request Oct 24, 2023
…#1086)" (ansible-collections#1094)

Revert "Work around for ansible-collections#1083 (ansible-collections#1086)"

This reverts commit e0aeafd.
SUMMARY
Following ansible-collections#1087 we no longer need the workaround for ansible-collections#1083.
The work around has been backported to stable-4, which still announces support for Ansible 2.9, however we've now dropped support for 2.9 so don't need this in main/5.0.0
ISSUE TYPE

Feature Pull Request

COMPONENT NAME
plugins/module_utils/cloud.py
ADDITIONAL INFORMATION

Reviewed-by: Gonéri Le Bouder <[email protected]>
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 community_review integration tests/integration mergeit Merge the PR (SoftwareFactory) module module new_contributor Help guide this first time contributor plugins plugin (any type) tests tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants