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] Support GET Bucket requestPayment #241

Open ikr0m opened 5 years ago

ikr0m commented 5 years ago

I faced this issue when I tried to create bucket from ansible. This is provision.yml ansible playbook.

---
- hosts: remote_server
  gather_facts: false
  become: yes
  environment: "{{ env_params }}"
  vars_files:
    - vars/main.yml
  tasks:
    - s3_bucket:
        name: s3backup
        s3_url: http://s3.amazonaws.com:4567

It created bucket but resulted Bucket request payment failed to apply in the expected time error. I saw multiple requests like this in fakes3 console:

localhost - - [11/Dec/2018:00:37:59 EST] "GET / HTTP/1.1" 200 303                                                                                                                                                                                                              
- -> /                                                                                                                                                                                                                                                                         
localhost - - [11/Dec/2018:00:37:59 EST] "PUT /s3backup HTTP/1.1" 200 0                                                                                                                                                                                                        
- -> /s3backup                                                                                                                                                                                                                                                                 
localhost - - [11/Dec/2018:00:37:59 EST] "HEAD /s3backup HTTP/1.1" 200 0                                                                                                                                                                                                       
- -> /s3backup                                                                                                                                                                                                                                                                 
localhost - - [11/Dec/2018:00:37:59 EST] "GET /s3backup?versioning HTTP/1.1" 200 217                                                                                                                                                                                           
- -> /s3backup?versioning                                                                                                                                                                                                                                                      
localhost - - [11/Dec/2018:00:37:59 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                                                                                                                       
- -> /s3backup?requestPayment                                                                                                                                                                                                                                                  
localhost - - [11/Dec/2018:00:38:00 EST] "PUT /s3backup?requestPayment HTTP/1.1" 200 0                                                                                                                                                                                         
- -> /s3backup?requestPayment                                                                                                                                                                                                                                                  
localhost - - [11/Dec/2018:00:38:00 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                                                                                                                       
- -> /s3backup?requestPayment                                                                                                                                                                                                                                                  
localhost - - [11/Dec/2018:00:38:05 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                                                                                                                       
- -> /s3backup?requestPayment                                                                                                                                                      
localhost - - [11/Dec/2018:00:38:10 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                           
- -> /s3backup?requestPayment                                                                                                                                                      
localhost - - [11/Dec/2018:00:38:15 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                           
- -> /s3backup?requestPayment                                                                                                                                                      
localhost - - [11/Dec/2018:00:38:20 EST] "GET /s3backup?requestPayment HTTP/1.1" 200 217                                                                                           
- -> /s3backup?requestPayment                                                                                                                                                                                                                                           
...

Ansible sent more than 20 times this request and time was out. So it would be better if fakes3 supports this request. Here is the doc about this request https://docs.aws.amazon.com/AmazonS3/latest/API/RESTrequestPaymentGET.html