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

s3_sync: The skip logic of `date_size` file_change_strategy is wrong #54076

Open
issei-m opened this issue Mar 20, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@issei-m
Copy link
Contributor

commented Mar 20, 2019

SUMMARY

While the documentation of s3_sync claims setting file_change_strategy as date_size will upload if file sizes don't match or if local file modified date is newer than s3's version but the implementation doesn't look like that.

ISSUE TYPE
  • Bug Report
COMPONENT NAME
  • s3_sync
ANSIBLE VERSION
$ ansible --version                                                    
ansible 2.7.1
  config file = None
  configured module search path = ['/Users/issei/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.7.1/libexec/lib/python3.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 3.7.1 (default, Nov  6 2018, 18:45:35) [Clang 10.0.0 (clang-1000.11.45.5)]

But I suppose almost all version is affected because the current devel branch itself is also suffered a bug.

CONFIGURATION
$ ansible-config dump --only-changed
(no output)
OS / ENVIRONMENT

macOS Mojave (10.14.3)

$ uname -a             
Darwin MacBookPro2017 18.2.0 Darwin Kernel Version 18.2.0: Thu Dec 20 20:46:53 PST 2018; root:xnu-4903.241.1~1/RELEASE_X86_64 x86_64
STEPS TO REPRODUCE

The playbook is like this:

- hosts: localhost
  tasks:
    - name: copy file to s3
      s3_sync:
        bucket: "{{ bucket_name }}"
        file_root: "./s3"
        mode: push
        file_change_strategy: date_size

And there is a single file named target.txt in s3 directory, containing just 5 bytes: Test!.
Then, run the following:

Replace your-bucket-name with actual your bucket name

$ ansible-playbook playbook.yml --extra-vars 'bucket_name=your-bucket-name'

As a result, we will see the file s3/target.txt is uploaded to the bucket you specified, at this point.
Next, rewrite contents of s3/target.txt with Yeah!, it's the same bytes as original contents. And make sure the file last-modified-date is updated.
Then, re-run the playbook.

EXPECTED RESULTS

The file target.txt is rewritten.

ACTUAL RESULTS

Never.

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

Files identified in the description:

If these files are inaccurate, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot

This comment has been minimized.

Copy link
Contributor

commented Mar 20, 2019

@issei-m, just so you are aware we have a dedicated Working Group for aws.
You can find other people interested in this in #ansible-aws on Freenode IRC
For more information about communities, meetings and agendas see https://github.com/ansible/community

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.