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

Running 'assemble' as handler in check mode will result in changed destination file #14175

Closed
sigio opened this issue Jan 28, 2016 · 3 comments
Closed
Assignees
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Milestone

Comments

@sigio
Copy link
Contributor

sigio commented Jan 28, 2016

On ansible 1.9.4 I'm seeing the following bug (which isn't present in 2.1.x)

We ran into the following issue today: Running an 'assemble' task in a handler from an ansible-playbook in 'check' mode will result in overwriting the destination file:

mark@shell:/tmp/ansibletest$ echo "original destinationfile" > dest/destfile
mark@shell:/tmp/ansibletest$ cat dest/destfile
original destinationfile
mark@shell:/tmp/ansibletest$ echo "source-file1" > source/file1
mark@shell:/tmp/ansibletest$ echo "source-file2" > source/file2
mark@shell:/tmp/ansibletest$ ls -al source/ dest/
dest/:
total 12
drwxr-xr-x 2 mark maniac 4096 Jan 28 11:21 .
drwxr-xr-x 5 mark maniac 4096 Jan 28 11:21 ..
-rw------- 1 mark maniac 25 Jan 28 11:26 destfile

source/:
total 16
drwxr-xr-x 2 mark maniac 4096 Jan 28 11:21 .
drwxr-xr-x 5 mark maniac 4096 Jan 28 11:21 ..
-rw-r--r-- 1 mark maniac 13 Jan 28 11:26 file1
-rw-r--r-- 1 mark maniac 13 Jan 28 11:26 file2
mark@shell:/tmp/ansibletest$ ansible-playbook -i hosts plays/test.yml --check

PLAY [localhost] **************************************************************

TASK: [test] ******************************************************************
changed: [localhost]

NOTIFIED: [assembletest] ******************************************************
changed: [localhost]

PLAY RECAP ********************************************************************
localhost : ok=2 changed=2 unreachable=0 failed=0

mark@shell:/tmp/ansibletest$ cat dest/destfile
source-file1
source-file2
mark@shell:/tmp/ansibletest$

The playbook used:

  • hosts: localhost
    connection: local
    gather_facts: no
    vars:
    sudo: no
    tasks:

    • name: test
      command: /bin/true
      notify: assembletest
      always_run: yes

    handlers:

    • name: assembletest
      assemble: dest=/tmp/ansibletest/dest/destfile src=/tmp/ansibletest/source/

Running the same on ansible 2.1.0 (current devel) doesn't do this, as it skips running the handler

PLAY ***************************************************************************

TASK [test] ********************************************************************
changed: [localhost]

RUNNING HANDLER [assembletest] *************************************************
skipping: [localhost]

PLAY RECAP *********************************************************************
localhost : ok=1 changed=1 unreachable=0 failed=0

@jimi-c jimi-c added this to the stable-1.9 milestone Jan 29, 2016
@jimi-c
Copy link
Member

jimi-c commented Jan 29, 2016

Thanks for testing this against devel as well (and glad to see we've resolved it there). Holding this open for review as a possible inclusion in a future 1.9.x release.

@jimi-c jimi-c added the P2 Priority 2 - Issue Blocks Release label Jan 29, 2016
@abadger
Copy link
Contributor

abadger commented Mar 7, 2016

@bcoca is going to look at backporting the fix for this from the 2.0 action plugin.

bcoca added a commit that referenced this issue Mar 7, 2016
@bcoca
Copy link
Member

bcoca commented Mar 7, 2016

fixed via 46ae226

@bcoca bcoca closed this as completed Mar 7, 2016
@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 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue/PR relates to a bug. P2 Priority 2 - Issue Blocks Release
Projects
None yet
Development

No branches or pull requests

5 participants