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

Cannot set cache headers in s3 and aws_s3 module #31232

Closed
pyconsult opened this issue Oct 3, 2017 · 3 comments · Fixed by #31487
Closed

Cannot set cache headers in s3 and aws_s3 module #31232

pyconsult opened this issue Oct 3, 2017 · 3 comments · Fixed by #31487
Labels
affects_2.4 This issue/PR affects Ansible v2.4 aws bug This issue/PR relates to a bug. cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.

Comments

@pyconsult
Copy link

ISSUE TYPE
  • Bug Report
COMPONENT NAME

s3 and aws_s3

ANSIBLE VERSION
ansible 2.4.0.0
  config file = None
  configured module search path = [u'/home/krl/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/krl/.virtualenvs/devops/local/lib/python2.7/site-packages/ansible
  executable location = /home/krl/.virtualenvs/devops/bin/ansible
  python version = 2.7.12 (default, Nov 19 2016, 06:48:10) [GCC 5.4.0 20160609]

CONFIGURATION

vanilla

OS / ENVIRONMENT

ubuntu 16.04

SUMMARY

Setting Cache-Control headers in metadata will result in setting the metadata key: aws_s3 x-amz-meta-cache-control on AWS. This makes it impossible to set the Cache-Control header on the s3 object. The Content-Type was set automatically before. Now it defaults to binary/octet-stream

STEPS TO REPRODUCE

Try to put a file to s3

    - name: Upload images files
      s3:
        bucket: "bucket-name"
        object: "{{ item | basename }}"
        region: "{{ aws_region }}"
        src: "{{ item }}"
        mode: put
        permission: 'public-read'
        metadata: ''Cache-Control='max-age=3600'"
      with_fileglob:
        - "dist/*.png"
EXPECTED RESULTS

I expect the Cache-Control header to be set

ACTUAL RESULTS

aws_s3 x-amz-meta-cache-control was set not Cache-Control

@ansibot
Copy link
Contributor

ansibot commented Oct 3, 2017

cc @lwade
click here for bot help

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 aws bug_report cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Oct 3, 2017
@ryansb ryansb removed the needs_triage Needs a first human triage before being processed. label Oct 3, 2017
@ryansb ryansb self-assigned this Oct 3, 2017
@WUMUXIAN
Copy link

WUMUXIAN commented Oct 5, 2017

+1 Have the some bug here

@ansibot
Copy link
Contributor

ansibot commented Oct 5, 2017

s-hertel added a commit to s-hertel/ansible that referenced this issue Oct 10, 2017
)

* Module option metadata are extra arguments rather than S3 object metadata: update ExtraArgs variable.

* Remove hyphens from ExtraArgs to maintain backwards compatibility

* Map lowercase extra args to CamelCase

* Maintain backwards compatibility by guessing at content type rather than always defaulting to binary/octet-stream.

* Fix ExtraArgs for non-hyphenated options

* Simplify logic
s-hertel added a commit to s-hertel/ansible that referenced this issue Oct 10, 2017
)

* Module option metadata are extra arguments rather than S3 object metadata: update ExtraArgs variable.

* Maintain backwards compatibility by guessing at content type rather than always defaulting to binary/octet-stream.
s-hertel added a commit that referenced this issue Oct 10, 2017
* Module option metadata are extra arguments rather than S3 object metadata: update ExtraArgs variable.

* Maintain backwards compatibility by guessing at content type rather than always defaulting to binary/octet-stream.
BondAnthony pushed a commit to BondAnthony/ansible that referenced this issue Oct 14, 2017
)

* Module option metadata are extra arguments rather than S3 object metadata: update ExtraArgs variable.

* Remove hyphens from ExtraArgs to maintain backwards compatibility

* Map lowercase extra args to CamelCase

* Maintain backwards compatibility by guessing at content type rather than always defaulting to binary/octet-stream.

* Fix ExtraArgs for non-hyphenated options

* Simplify logic
mtb-xt pushed a commit to mtb-xt/ansible that referenced this issue Oct 15, 2017
)

* Module option metadata are extra arguments rather than S3 object metadata: update ExtraArgs variable.

* Remove hyphens from ExtraArgs to maintain backwards compatibility

* Map lowercase extra args to CamelCase

* Maintain backwards compatibility by guessing at content type rather than always defaulting to binary/octet-stream.

* Fix ExtraArgs for non-hyphenated options

* Simplify logic
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bug_report labels Mar 7, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 aws bug This issue/PR relates to a bug. cloud deprecated This issue/PR relates to a deprecated module. module This issue/PR relates to a module. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants