Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
rmahroua committed May 4, 2023
1 parent 8a7d352 commit 35612c9
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions plugins/modules/s3_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,13 +328,13 @@ def build_rule(client, module):
rule["Transitions"] = []
for transition in transitions:
t_out = dict()
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"]
if transition.get("storage_class"):
t_out["StorageClass"] = transition["storage_class"].upper()
rule["Transitions"].append(t_out)
if transition.get('transition_date'):
t_out['Date'] = transition['transition_date']
elif transition.get('transition_days') is not None:
t_out['Days'] = int(transition['transition_days'])
if transition.get('storage_class'):
t_out['StorageClass'] = transition['storage_class'].upper()
rule['Transitions'].append(t_out)

if noncurrent_version_transition_days is not None:
rule["NoncurrentVersionTransitions"] = [
Expand Down Expand Up @@ -495,10 +495,11 @@ def create_lifecycle_rule(client, module):
# Write lifecycle to bucket
try:
client.put_bucket_lifecycle_configuration(
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
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 interpreted this as not changing anything
changed = False
except (
botocore.exceptions.ClientError,
Expand Down

0 comments on commit 35612c9

Please sign in to comment.