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

Add prefix parameter in s3_object_info module to list S3 objects under a specific prefix #2477

Closed
1 task done
mredouin opened this issue Jan 21, 2025 · 4 comments · Fixed by #2485
Closed
1 task done
Labels
feature This issue/PR relates to a feature request has_pr

Comments

@mredouin
Copy link

Summary

As the support for list has been deprecated in s3_object module (and will be removed), I was looking for a way to list the content of a S3 bucket under a specific prefix.
I did not find this option in s3_object_info module.

Issue Type

Feature Idea

Component Name

amazon.aws.s3_object_info

Additional Information

S3bucket , aws_region, prefix are defined beforehand.
Access keys and secret has been defined to access the S3 bucket.

- name: "List {{ S3bucket }} S3 bucket content under {{ prefix }}"
  amazon.aws.s3_object_info:
    bucket_name: "{{ S3bucket }}"
    region: "{{ aws_region }}"
    prefix: "{{ prefix }}"
  register: S3bucket_list_result

- name: "Display the list of objects"
  ansible.builtin.debug:
    msg: "{{ S3bucket_list_result.s3_keys }}"

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@hakbailey
Copy link
Contributor

Hi @mredouin, thanks for filing this issue. Would you be open to submitting a pull request for the feature?

@hakbailey hakbailey added waiting_on_contributor Needs help. Feel free to engage to get things unblocked feature This issue/PR relates to a feature request jira and removed needs_triage labels Jan 21, 2025
@abikouo abikouo added has_pr and removed waiting_on_contributor Needs help. Feel free to engage to get things unblocked jira labels Jan 23, 2025
@abikouo
Copy link
Contributor

abikouo commented Jan 23, 2025

@mredouin PR #2485 has introduced the new feature, could you please give it a try?

@mredouin
Copy link
Author

Hello @abikouo, thank you.
I need to figure out how to tell ansible to use this modified collection (after this checkout of this branch).
I will let you know.

@mredouin
Copy link
Author

Hello @abikouo, I could download and install the collection from this PR. It worked fine: I could use s3_object_info with the prefix parameter and it worked as expected.

softwarefactory-project-zuul bot pushed a commit that referenced this issue Jan 27, 2025
SUMMARY

Closes #2477

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

s3_object_info

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
patchback bot pushed a commit that referenced this issue Jan 27, 2025
SUMMARY

Closes #2477

ISSUE TYPE

Feature Pull Request

COMPONENT NAME

s3_object_info

Reviewed-by: Mark Chappell
Reviewed-by: Alina Buzachis
(cherry picked from commit 528843e)
softwarefactory-project-zuul bot pushed a commit that referenced this issue Jan 27, 2025
…2487)

This is a backport of PR #2485 as merged into main (528843e).
SUMMARY

Closes #2477

ISSUE TYPE


Feature Pull Request

COMPONENT NAME

s3_object_info

Reviewed-by: Bikouo Aubin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request has_pr
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants