jubos / fake-s3

A lightweight server clone of Amazon S3 that simulates most of the commands supported by S3 with minimal dependencies
2.94k stars 355 forks source link

[Feature] Add support of payer option, to allow usage with ansible s3_bucket library #227

Open bbaja42 opened 6 years ago

bbaja42 commented 6 years ago

Hi, I tried using fakes3 with ansible s3_bucket plugin, with very simple setup.

1) Start fakes3 2) try ansible with following config

- hosts: localhost
  tasks:

  - s3_bucket:
      name: test
      s3_url: fakes3://localhost:8080

This fails with

s_status = get_request_payment_status(bucket)\n  File \"/var/folders/23/qtv6c__j5fsfsfhnl957cm8c8fzbcs/T/ansible_1Rdemc/ansible_module_s3_bucket.py\", line 153, in get_request_payment_status\n    return (payer != \"BucketOwner\")\nUnboundLocalError: local variable 'payer' referenced before assignment\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

The issue is that ansible expects payer in XML returned from S3, and since it is not there; fails

https://github.com/ansible/ansible/blob/devel/lib/ansible/modules/cloud/amazon/s3_bucket.py#L143