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

@@ -119,6 +119,39 @@
that:
- '"FC: no differences encountered" in diff_result.stdout'
# TEST BACKUP
- name: test backup (check_mode)
win_template:
src: foo.j2
dest: '{{ win_output_dir }}/foo.unix.templated'
backup: yes
register: cm_backup_result
check_mode: yes
- name: verify that a backup_file was returned
assert:
that:
- cm_backup_result is changed
- cm_backup_result.backup_file is not none
- name: test backup (normal mode)
win_template:
src: foo.j2
dest: '{{ win_output_dir }}/foo.unix.templated'
backup: yes
register: nm_backup_result
- name: check backup_file
win_stat:
path: '{{ nm_backup_result.backup_file }}'
register: backup_file
- name: verify that a backup_file was returned
assert:
that:
- nm_backup_result is changed
- backup_file.stat.exists == true
- name: create template dest directory
win_file:
path: '{{win_output_dir}}\directory'