Skip to content

Commit 39382b4

Browse files
committed
tests: Ensure backup/restore preserves file attributes
I noticed some test failures in tests that check ownership/permissions of config files. The tests were recently changed to reuse the same VM, so I suspect config files were not being backed up/restored with the correct file attributes. Use `cp -a` to preserve all file attributes. Signed-off-by: Rich Megginson <[email protected]>
1 parent 0858fbf commit 39382b4

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/tasks/backup.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
shell: >
1515
if test -f {{ item }}; then
1616
mkdir -p {{ __ssh_test_backup.path }}/$(dirname {{ item }});
17-
cp {{ item }} {{ __ssh_test_backup.path }}/$(dirname {{ item }})
17+
cp -a {{ item }} {{ __ssh_test_backup.path }}/$(dirname {{ item }})
1818
fi
1919
changed_when: false
2020
loop: "{{ __ssh_test_backup_files | d([]) }}"

tests/tasks/restore.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
- name: Restore backed up files and remove what was not present
33
shell: >
44
if test -f {{ __ssh_test_backup.path }}/{{ item }}; then
5-
cp {{ __ssh_test_backup.path }}/{{ item }} $(dirname {{ item }})
5+
cp -a {{ __ssh_test_backup.path }}/{{ item }} $(dirname {{ item }})
66
elif test -f {{ item }}; then
77
rm {{ item }}
88
fi

0 commit comments

Comments
 (0)