From 6326daa34e94bd39eb8a0012210dd88ae9cc186a Mon Sep 17 00:00:00 2001 From: Toshio Kuratomi Date: Wed, 14 Jan 2015 19:23:12 -0800 Subject: [PATCH] Update modules for unarchive handling user,group,mode and add integration test for the same --- lib/ansible/modules/core | 2 +- lib/ansible/modules/extras | 2 +- .../roles/test_unarchive/tasks/main.yml | 47 +++++++++++++++++-- v2/ansible/modules/core | 2 +- v2/ansible/modules/extras | 2 +- 5 files changed, 47 insertions(+), 8 deletions(-) diff --git a/lib/ansible/modules/core b/lib/ansible/modules/core index 8c8be0e48c..e3759bd0d3 160000 --- a/lib/ansible/modules/core +++ b/lib/ansible/modules/core @@ -1 +1 @@ -Subproject commit 8c8be0e48c70d2aa830bf5d55cab5d13018ca831 +Subproject commit e3759bd0d396d63b869732a63ecae5ca7a2a9641 diff --git a/lib/ansible/modules/extras b/lib/ansible/modules/extras index ffa8abf979..86f2124c0d 160000 --- a/lib/ansible/modules/extras +++ b/lib/ansible/modules/extras @@ -1 +1 @@ -Subproject commit ffa8abf9793a92bff6708d1f9a2a45475177f834 +Subproject commit 86f2124c0d62359a0672fa0a81f85c0850c05dd1 diff --git a/test/integration/roles/test_unarchive/tasks/main.yml b/test/integration/roles/test_unarchive/tasks/main.yml index f9e8fac120..5128b1ca3b 100644 --- a/test/integration/roles/test_unarchive/tasks/main.yml +++ b/test/integration/roles/test_unarchive/tasks/main.yml @@ -95,13 +95,13 @@ dest: "{{output_dir | expanduser}}/test-unarchive-tar-gz" copy: no creates: "{{output_dir}}/test-unarchive-tar-gz/foo-unarchive.txt" - register: unarchive02c + register: unarchive02d - name: verify that the file was not marked as changed assert: that: - - "unarchive02c.changed == false" - - "unarchive02c.skipped == true" + - "unarchive02d.changed == false" + - "unarchive02d.skipped == true" - name: remove our tar.gz unarchive destination file: path={{output_dir}}/test-unarchive-tar-gz state=absent @@ -121,7 +121,7 @@ - name: verify that the file was unarchived file: path={{output_dir}}/test-unarchive-zip/foo-unarchive.txt state=file -- name: remove our tar unarchive destination +- name: remove our zip unarchive destination file: path={{output_dir}}/test-unarchive-zip state=absent - name: remove our test file for the archive @@ -150,3 +150,42 @@ - name: remove our unarchive destination file: path=/tmp/foo-unarchive.txt state=absent + +- name: create our unarchive destination + file: path={{output_dir}}/test-unarchive-tar-gz state=directory + +- name: unarchive and set mode + unarchive: + src: "{{ output_dir }}/test-unarchive.tar.gz" + dest: "{{ output_dir | expanduser }}/test-unarchive-tar-gz" + copy: no + mode: "u+rwX,g-rwx,o-rwx" + register: unarchive06 + +- name: Test that the file modes were changed + stat: + path: "{{ output_dir | expanduser }}/test-unarchive-tar-gz/foo-unarchive.txt" + register: unarchive06_stat + +- name: Test that the file modes were changed + assert: + that: + - "unarchive06.changed == true" + - "unarchive06_stat.stat.mode == '0600'" + +- name: unarchive and set mode + unarchive: + src: "{{ output_dir }}/test-unarchive.tar.gz" + dest: "{{ output_dir | expanduser }}/test-unarchive-tar-gz" + copy: no + mode: "u+rwX,g-rwx,o-rwx" + register: unarchive07 + +- name: Test that the files were not changed + assert: + that: + - "unarchive07.changed == false" + +- name: remove our tar.gz unarchive destination + file: path={{output_dir}}/test-unarchive-tar-gz state=absent + diff --git a/v2/ansible/modules/core b/v2/ansible/modules/core index b34075ecb9..e3759bd0d3 160000 --- a/v2/ansible/modules/core +++ b/v2/ansible/modules/core @@ -1 +1 @@ -Subproject commit b34075ecb9a85f913b2a59edc0fac243570c5fe0 +Subproject commit e3759bd0d396d63b869732a63ecae5ca7a2a9641 diff --git a/v2/ansible/modules/extras b/v2/ansible/modules/extras index 8a4f07eecd..86f2124c0d 160000 --- a/v2/ansible/modules/extras +++ b/v2/ansible/modules/extras @@ -1 +1 @@ -Subproject commit 8a4f07eecd2bb877f51b7b04b5352efa6076cce5 +Subproject commit 86f2124c0d62359a0672fa0a81f85c0850c05dd1