Why s3_sync module call s3.list_buckets() method? #23409

Closed
otsuka opened this Issue Apr 7, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@otsuka

otsuka commented Apr 7, 2017

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

s3_sync

ANSIBLE VERSION
ansible 2.3.0.0
  config file = /home/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.9 (default, Jun 29 2016, 13:08:31) [GCC 4.9.2]
SUMMARY

https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/modules/cloud/amazon/s3_sync.py#L469

s3_sync module seems to invoke s3.list_buckets() method in order to validate AWS credentials.
For that purpose another method like s3.list_objects() might be appropriate because
list_buckets operation requires the IAM policy to allow "ListAllMyBuckets" action, which is irrelevant to syncing of files.
The "bucket" option is required for s3_sync module, listing all buckets is unnecessary.

@ansibot

This comment has been minimized.

Show comment
Hide comment
@s-hertel

This comment has been minimized.

Show comment
Hide comment
@s-hertel

s-hertel Apr 10, 2017

Contributor

Yeah, list bucket isn't really helping here since permissions aren't all or nothing. I think it would be better to raise exceptions in filter_list() and upload_files() to give better clues about what permissions are actually missing.

Contributor

s-hertel commented Apr 10, 2017

Yeah, list bucket isn't really helping here since permissions aren't all or nothing. I think it would be better to raise exceptions in filter_list() and upload_files() to give better clues about what permissions are actually missing.

@s-hertel s-hertel closed this in #23492 Apr 18, 2017

s-hertel added a commit that referenced this issue Apr 18, 2017

s3_sync: removing irrelevant s3.list_buckets() call - fixes #23409 (#…
…23492)

* Removing irrelevant s3 call

Fix exception handling

Make s3_sync pep8 and remove from legacy file

tedelhourani added a commit to tedelhourani/ansible that referenced this issue May 3, 2017

s3_sync: removing irrelevant s3.list_buckets() call - fixes #23409 (#…
…23492)

* Removing irrelevant s3 call

Fix exception handling

Make s3_sync pep8 and remove from legacy file

@ansibot ansibot added feature and removed feature_idea labels Mar 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment