From 787388ac30bbe6eb0929c98d6944a0457e864e89 Mon Sep 17 00:00:00 2001 From: Dan Rue Date: Tue, 17 Feb 2015 15:02:08 -0600 Subject: [PATCH 1/2] Do not mark "skipped" when changed is false When using the "creates" option with the unarchive module, set changed to False if the file already exists. This behavior is consistent with other modules which use "creates", such as command and shell. --- lib/ansible/runner/action_plugins/unarchive.py | 1 - test/integration/roles/test_unarchive/tasks/main.yml | 2 -- 2 files changed, 3 deletions(-) diff --git a/lib/ansible/runner/action_plugins/unarchive.py b/lib/ansible/runner/action_plugins/unarchive.py index 572cd03d5e4..7cf61006c3f 100644 --- a/lib/ansible/runner/action_plugins/unarchive.py +++ b/lib/ansible/runner/action_plugins/unarchive.py @@ -69,7 +69,6 @@ class ActionModule(object): conn=conn, comm_ok=True, result=dict( - skipped=True, changed=False, msg=("skipped, since %s exists" % creates) ) diff --git a/test/integration/roles/test_unarchive/tasks/main.yml b/test/integration/roles/test_unarchive/tasks/main.yml index 3e315a7e94c..fa5891396c3 100644 --- a/test/integration/roles/test_unarchive/tasks/main.yml +++ b/test/integration/roles/test_unarchive/tasks/main.yml @@ -96,7 +96,6 @@ assert: that: - "unarchive02c.changed == false" - - "unarchive02c.skipped == true" - name: unarchive a tar.gz file with creates over an existing file using complex_args unarchive: @@ -110,7 +109,6 @@ assert: that: - "unarchive02d.changed == false" - - "unarchive02d.skipped == true" - name: remove our tar.gz unarchive destination file: path={{output_dir}}/test-unarchive-tar-gz state=absent From 67eb9f301ddcf6a34e3c2d775ada18a2f30251f4 Mon Sep 17 00:00:00 2001 From: Dan Rue Date: Tue, 17 Feb 2015 15:14:21 -0600 Subject: [PATCH 2/2] Do not mark "skipped" when changed is false When using the "creates" option with the script module, set changed to False if the file already exists. This behavior is consistent with other modules which use "creates", such as command and shell. --- lib/ansible/runner/action_plugins/script.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/action_plugins/script.py b/lib/ansible/runner/action_plugins/script.py index 3f8fd60cfbd..1159428b4c1 100644 --- a/lib/ansible/runner/action_plugins/script.py +++ b/lib/ansible/runner/action_plugins/script.py @@ -66,7 +66,7 @@ class ActionModule(object): conn=conn, comm_ok=True, result=dict( - skipped=True, + changed=False, msg=("skipped, since %s exists" % creates) ) ) @@ -83,7 +83,7 @@ class ActionModule(object): conn=conn, comm_ok=True, result=dict( - skipped=True, + changed=False, msg=("skipped, since %s does not exist" % removes) ) )