Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rmahroua committed Apr 24, 2023
1 parent 0b8dfc5 commit fec67c3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
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 @@ -326,7 +326,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 @@ -489,7 +489,7 @@ def create_lifecycle_rule(client, module):
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, botocore.exceptions.BotoCoreError) as e: # pylint: disable=duplicate-except
module.fail_json_aws(e, lifecycle_configuration=lifecycle_configuration, name=name, old_lifecycle_rules=old_lifecycle_rules)
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 @@ -704,6 +704,6 @@
s3_bucket:
name: "{{item}}"
state: absent
ignore_errors: yes
ignore_errors: true
with_items:
- '{{ bucket_name }}'

0 comments on commit fec67c3

Please sign in to comment.