summaryrefslogtreecommitdiffstats
path: root/test/integration/targets/file
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2019-06-05 15:25:43 +0200
committerGitHub <noreply@github.com>2019-06-05 15:25:43 +0200
commit705d0201cf9c4eeb32084b3da92b831dddff5efe (patch)
tree162d535ea856de76788656567864fc2f48ec7231 /test/integration/targets/file
parentUpdate azure_rm_mysqlserver related document (#57382) (diff)
downloadansible-705d0201cf9c4eeb32084b3da92b831dddff5efe.tar.xz
ansible-705d0201cf9c4eeb32084b3da92b831dddff5efe.zip
file: fix setting attributes for symlinked file (#57217)
Diffstat (limited to 'test/integration/targets/file')
-rw-r--r--test/integration/targets/file/tasks/state_link.yml39
1 files changed, 38 insertions, 1 deletions
diff --git a/test/integration/targets/file/tasks/state_link.yml b/test/integration/targets/file/tasks/state_link.yml
index 60ea54542c..f4338ec7eb 100644
--- a/test/integration/targets/file/tasks/state_link.yml
+++ b/test/integration/targets/file/tasks/state_link.yml
@@ -5,7 +5,7 @@
#
# Basic absolute symlink to a file
-#
+#
- name: create soft link to file
file: src={{output_file}} dest={{output_dir}}/soft.txt state=link
register: file1_result
@@ -308,3 +308,40 @@
that:
- 'file10_result is changed'
- 'file10_target_stat["stat"]["mode"] == "0644"'
+
+
+# https://github.com/ansible/ansible/issues/56928
+- block:
+
+ - name: Create a testing file
+ file:
+ path: "{{ output_dir }}/test_follow1"
+ state: touch
+
+ - name: Create a symlink and change mode of the original file, since follow == yes by default
+ file:
+ src: "{{ output_dir }}/test_follow1"
+ dest: "{{ output_dir }}/test_follow1_link"
+ state: link
+ mode: 0700
+
+ - name: stat the original file
+ stat:
+ path: "{{ output_dir }}/test_follow1"
+ register: stat_out
+
+ - name: Check if the mode of the original file was set
+ assert:
+ that:
+ - 'stat_out.stat.mode == "0700"'
+
+ always:
+ - name: Clean up
+ file:
+ path: "{{ item }}"
+ state: absent
+ loop:
+ - "{{ output_dir }}/test_follow1"
+ - "{{ output_dir }}/test_follow1_link"
+
+# END #56928