Skip to content

Bucket lifecycle configuration fails when using Ansible S3 roles #990

@JPEWdev

Description

@JPEWdev

Describe the bug
When using the ansible aws roles to configure the bucket lifecycle on RustFS (community.aws.s3_lifecycle), the role fails (it works with AWS S3 and MinIO). The error is:

Traceback (most recent call last):
  File "AnsiballZ_s3_lifecycle.py", line 107, in <module>
    _ansiballz_main()
  File "AnsiballZ_s3_lifecycle.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "AnsiballZ_s3_lifecycle.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.community.aws.plugins.modules.s3_lifecycle', init_globals=dict(_module_fqn='ansible_collections.community.aws.plugins.modules.s3_lifecycle', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "ansible_collections/community/aws/plugins/modules/s3_lifecycle.py", line 684, in <module>
  File "ansible_community.aws.s3_lifecycle_payload.zip/ansible_collections/community/aws/plugins/modules/s3_lifecycle.py", line 678, in main
  File "ansible_community.aws.s3_lifecycle_payload.zip/ansible_collections/community/aws/plugins/modules/s3_lifecycle.py", line 490, in create_lifecycle_rule
  File "ansible_community.aws.s3_lifecycle_payload.zip/ansible_collections/community/aws/plugins/modules/s3_lifecycle.py", line 264, in fetch_rules
KeyError: 'Rules'

To Reproduce
Steps to reproduce the behavior:

  1. Create an ansible role using community.aws.s3_lifecycle to set the lifecycle for a bucket e.g.:
- name: Configure S3 bucket lifecycle
  community.aws.s3_lifecycle:
    endpoint_url: "ENDPOINT_URL"
    access_key: "ACCESS_KEY"
    secret_key: "SECRET_KEY"
    name: "bucket-name"
    rule_id: "rule1"
    state: present
    expiration_days: "1"
  1. The role will fail with the above traceback

Expected behavior
The role can change the bucket lifecycle rules

Metadata

Metadata

Assignees

Labels

S-reproducingStatus: Reproducing a bug report

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions