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

s3_lifecycle - fix invalid value type for transitions list #1788

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions changelogs/fragments/20230424-s3_lifecycle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
bugfixes:
- s3_lifecycle - fix invalid value type for transitions list (https://github.com/ansible-collections/community.aws/issues/1774)
4 changes: 2 additions & 2 deletions plugins/modules/s3_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def build_rule(client, module):
if transition.get("transition_date"):
t_out["Date"] = transition["transition_date"]
elif transition.get("transition_days") is not None:
t_out["Days"] = transition["transition_days"]
t_out["Days"] = int(transition["transition_days"])
if transition.get("storage_class"):
t_out["StorageClass"] = transition["storage_class"].upper()
rule["Transitions"].append(t_out)
Expand Down Expand Up @@ -498,7 +498,7 @@ def create_lifecycle_rule(client, module):
aws_retry=True, Bucket=name, LifecycleConfiguration=lifecycle_configuration
)
except is_boto3_error_message("At least one action needs to be specified in a rule"):
# Amazon interpretted this as not changing anything
# Amazon interpreted this as not changing anything
changed = False
except (
botocore.exceptions.ClientError,
Expand Down
8 changes: 4 additions & 4 deletions tests/integration/targets/s3_lifecycle/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
security_token: '{{ security_token | default(omit) }}'
region: '{{ aws_region }}'
s3_lifecycle:
wait: yes
wait: true
block:

# ============================================================
Expand All @@ -33,7 +33,7 @@
prefix: "{{ item }}"
status: enabled
state: present
wait: yes
wait: true
register: output
loop:
- rule_1
Expand All @@ -51,7 +51,7 @@
prefix: "{{ item }}"
status: enabled
state: absent
wait: yes
wait: true
register: output
loop:
- rule_1
Expand Down Expand Up @@ -700,6 +700,6 @@
s3_bucket:
name: "{{item}}"
state: absent
ignore_errors: yes
ignore_errors: true
with_items:
- '{{ bucket_name }}'