Windows: Add backup parameter to modules (#50033)

* Windows: Add backup parameter to modules

This PR adds a backup infrastructure for modules.

* Fixes based on review feedback

* Various fixes to check-mode and backup

* Add integration tests

* Fix win_xml integration test

* Add backup support to copy action plugin

* Added integration tests

* Improve test efficiencies and other minor impv
This commit is contained in:
Dag Wieers
2019-02-25 02:37:25 +01:00
committed by Jordan Borean
parent 76b5a9fb52
commit 3d1dd0e599
15 changed files with 365 additions and 95 deletions

View File

@@ -70,7 +70,7 @@
- name: check attribute change result
assert:
that:
- not attribute_changed_result is changed
- attribute_changed_result is not changed
# This testing is for https://github.com/ansible/ansible/issues/48471
# The issue was that an .xml with no encoding declaration, but a UTF8 BOM
@@ -105,6 +105,26 @@
that:
- sha1_checksum.stat.checksum == 'e3e18c3066e1bfce9a5cf87c81353fa174440944'
- name: change a text value in a file with UTF8 BOM and armenian characters in the description
win_xml:
path: "{{ win_output_dir }}\\plane-utf8-bom-armenian-characters.xml"
xpath: '/plane/year'
type: text
fragment: '1989'
backup: yes
register: test_backup
- name: check backup_file
win_stat:
path: '{{ test_backup.backup_file }}'
register: backup_file
- name: Check backup_file
assert:
that:
- test_backup is changed
- backup_file.stat.exists == true
- name: change a text value in a file with UTF-16 BE BOM and Chinese characters in the description
win_xml:
path: "{{ win_output_dir }}\\plane-utf16be-bom-chinese-characters.xml"