Skip to content

Commit

Permalink
fix ignore_nonexistent_bucket bug for listing (#966) (#967)
Browse files Browse the repository at this point in the history
fix ignore_nonexistent_bucket bug for listing (#966)

SUMMARY
remove duplicated use of bucket_check() and reuse bucketrtn instead
Fixes #966
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME
s3_object
ADDITIONAL INFORMATION

Reviewed-by: Mark Chappell <None>
  • Loading branch information
akiuni authored Aug 12, 2022
1 parent ffd8c1a commit f4e81e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/966-ignore_nonexistent_bucket_list.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- s3_object - also use ``ignore_nonexistent_bucket`` when listing a bucket (https://github.com/ansible-collections/amazon.aws/issues/966).
3 changes: 1 addition & 2 deletions plugins/modules/s3_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -1168,10 +1168,9 @@ def main():

# Support for listing a set of keys
if mode == 'list':
exists = bucket_check(module, s3, bucket)

# If the bucket does not exist then bail out
if not exists:
if not bucketrtn:
module.fail_json(msg="Target bucket (%s) cannot be found" % bucket)

list_keys(module, s3, bucket, prefix, marker, max_keys)
Expand Down

0 comments on commit f4e81e9

Please sign in to comment.