win_package: add support for arguments as list (#32024)

* win_package: add support for arguments as list

* re-added failure tests as they were accidentally commented out

* changed exit_code in failure messages to rc
This commit is contained in:
Jordan Borean
2017-11-02 09:39:21 +10:00
committed by GitHub
parent 56a7278256
commit 9dc9313c65
7 changed files with 152 additions and 120 deletions

View File

@@ -1,5 +1,6 @@
---
# spaces are tricky, let's have one by default
test_win_package_path_safe: C:\ansible\win_package
test_win_package_path: C:\ansible\win package
test_win_package_good_url: https://s3.amazonaws.com/ansible-ci-files/test/integration/roles/test_win_package/good.msi
test_win_package_reboot_url: https://s3.amazonaws.com/ansible-ci-files/test/integration/roles/test_win_package/reboot.msi

View File

@@ -38,7 +38,7 @@
that:
- install_local_exe|changed
- install_local_exe.reboot_required == False
- install_local_exe.exit_code == 0
- install_local_exe.rc == 0
- install_local_exe_actual.exists == True
- name: install local exe (idempotent)
@@ -93,7 +93,7 @@
that:
- uninstall_path_local_exe|changed
- uninstall_path_local_exe.reboot_required == False
- uninstall_path_local_exe.exit_code == 0
- uninstall_path_local_exe.rc == 0
- uninstall_path_local_exe_actual.exists == False
- name: uninstall local exe with path (idempotent)
@@ -148,7 +148,7 @@
that:
- install_url_exe|changed
- install_url_exe.reboot_required == False
- install_url_exe.exit_code == 0
- install_url_exe.rc == 0
- install_url_exe_actual.exists == True
- name: install url exe (idempotent)
@@ -201,7 +201,7 @@
that:
- uninstall_id_local_exe|changed
- uninstall_id_local_exe.reboot_required == False
- uninstall_id_local_exe.exit_code == 0
- uninstall_id_local_exe.rc == 0
- uninstall_id_local_exe_actual.exists == False
- name: uninstall local exe with product_id (idempotent)

View File

@@ -1,8 +1,11 @@
---
- name: ensure testing folder exists
- name: ensure testing folders exists
win_file:
path: '{{test_win_package_path}}'
path: '{{item}}'
state: directory
with_items:
- '{{test_win_package_path}}'
- '{{test_win_package_path_safe}}'
- name: download msi files from S3 bucket
win_get_url:
@@ -50,3 +53,11 @@
- { id: '{{test_win_package_good_id}}' }
- { id: '{{test_win_package_reboot_id}}' }
# - { id: '{{test_win_package_exe_id}}', args: '/S' }
- name: cleanup test artifacts
win_file:
path: '{{item}}'
state: absent
with_items:
- '{{test_win_package_path}}'
- '{{test_win_package_path_safe}}'

View File

@@ -42,7 +42,7 @@
that:
- install_local_msi|changed
- install_local_msi.reboot_required == False
- install_local_msi.exit_code == 0
- install_local_msi.rc == 0
- install_local_msi_actual.exists == True
- name: install local msi (idempotent)
@@ -91,7 +91,7 @@
that:
- uninstall_path_local_msi|changed
- uninstall_path_local_msi.reboot_required == False
- uninstall_path_local_msi.exit_code == 0
- uninstall_path_local_msi.rc == 0
- uninstall_path_local_msi_actual.exists == False
- name: uninstall local msi with path (idempotent)
@@ -142,7 +142,7 @@
that:
- install_url_msi|changed
- install_url_msi.reboot_required == False
- install_url_msi.exit_code == 0
- install_url_msi.rc == 0
- install_url_msi_actual.exists == True
- name: install url msi (idempotent)
@@ -192,7 +192,7 @@
that:
- uninstall_id_local_msi|changed
- uninstall_id_local_msi.reboot_required == False
- uninstall_id_local_msi.exit_code == 0
- uninstall_id_local_msi.rc == 0
- uninstall_id_local_msi_actual.exists == False
- name: uninstall local msi with product_id (idempotent)
@@ -241,7 +241,7 @@
that:
- install_local_reboot_msi|changed
- install_local_reboot_msi.reboot_required == True
- install_local_reboot_msi.exit_code == 3010
- install_local_reboot_msi.rc == 3010
- install_local_reboot_msi_actual.exists == True
- name: install local reboot msi (idempotent)
@@ -313,7 +313,7 @@
that:
- install_msi_argument|changed
- install_msi_argument.reboot_required == False
- install_msi_argument.exit_code == 0
- install_msi_argument.rc == 0
- install_msi_argument_moo.stat.exists == False
- install_msi_argument_cow.stat.exists == True
@@ -333,3 +333,72 @@
win_package:
path: '{{test_win_package_path}}\good.msi'
state: absent
- name: create custom install directory for msi install
win_file:
path: '{{test_win_package_path_safe}}\good'
state: directory
- name: install msi to custom path using string arguments
win_package:
path: '{{test_win_package_path}}\good.msi'
state: present
arguments: ADDLOCAL=Cow INSTALLDIR={{test_win_package_path_safe}}\install
register: install_msi_string_arguments
- name: get result of moo file after install local msi with string arguments
win_stat:
path: '{{test_win_package_path_safe}}\install\moo.exe'
register: install_msi_string_arguments_moo
- name: get result of cow file after install local msi with string arguments
win_stat:
path: '{{test_win_package_path_safe}}\install\cow.exe'
register: install_msi_string_arguments_cow
- name: assert results of install msi to custom path using string arguments
assert:
that:
- install_msi_string_arguments|changed
- install_msi_string_arguments.reboot_required == False
- install_msi_string_arguments.rc == 0
- install_msi_string_arguments_moo.stat.exists == False
- install_msi_string_arguments_cow.stat.exists == True
- name: uninstall good msi after string argument test
win_package:
path: '{{test_win_package_path}}\good.msi'
state: absent
- name: install msi to custom path using list arguments
win_package:
path: '{{test_win_package_path}}\good.msi'
state: present
arguments:
- ADDLOCAL=Moo
- INSTALLDIR={{test_win_package_path_safe}}\install
register: install_msi_list_arguments
- name: get result of moo file after install local msi with list arguments
win_stat:
path: '{{test_win_package_path_safe}}\install\moo.exe'
register: install_msi_list_arguments_moo
- name: get result of cow file after install local msi with list arguments
win_stat:
path: '{{test_win_package_path_safe}}\install\cow.exe'
register: install_msi_list_arguments_cow
- name: assert results of install msi to custom path using list arguments
assert:
that:
- install_msi_list_arguments|changed
- install_msi_list_arguments.reboot_required == False
- install_msi_list_arguments.rc == 0
- install_msi_list_arguments_moo.stat.exists == True
- install_msi_list_arguments_cow.stat.exists == False
- name: uninstall good msi after list argument test
win_package:
path: '{{test_win_package_path}}\good.msi'
state: absent

View File

@@ -40,7 +40,7 @@
that:
- install_network_msi|changed
- install_network_msi.reboot_required == False
- install_network_msi.exit_code == 0
- install_network_msi.rc == 0
- install_network_msi_actual.exists == True
- name: install network msi (idempotent)
@@ -98,7 +98,7 @@
that:
- uninstall_path_network_msi|changed
- uninstall_path_network_msi.reboot_required == False
- uninstall_path_network_msi.exit_code == 0
- uninstall_path_network_msi.rc == 0
- uninstall_path_network_msi_actual.exists == False
- name: uninstall network msi with path (idempotent)
@@ -156,7 +156,7 @@
that:
- install_network_reboot_msi|changed
- install_network_reboot_msi.reboot_required == True
- install_network_reboot_msi.exit_code == 3010
- install_network_reboot_msi.rc == 3010
- install_network_reboot_msi_actual.exists == True
- name: install network reboot msi (idempotent)
@@ -210,7 +210,7 @@
that:
- uninstall_id_network_msi|changed
- uninstall_id_network_msi.reboot_required == True
- uninstall_id_network_msi.exit_code == 3010
- uninstall_id_network_msi.rc == 3010
- uninstall_id_network_msi_actual.exists == False
- name: uninstall network msi with product_id (idempotent)
@@ -283,7 +283,7 @@
that:
- install_network_msi_argument|changed
- install_network_msi_argument.reboot_required == False
- install_network_msi_argument.exit_code == 0
- install_network_msi_argument.rc == 0
- install_network_msi_argument_moo.stat.exists == False
- install_network_msi_argument_cow.stat.exists == True
@@ -350,7 +350,7 @@
that:
- install_network_exe|changed
- install_network_exe.reboot_required == False
- install_network_exe.exit_code == 0
- install_network_exe.rc == 0
- install_network_exe_actual.exists == True
- name: install network exe (idempotent)
@@ -409,7 +409,7 @@
that:
- uninstall_network_exe|changed
- uninstall_network_exe.reboot_required == False
- uninstall_network_exe.exit_code == 0
- uninstall_network_exe.rc == 0
- uninstall_network_exe_actual.exists == False
- name: uninstall network exe (idempotent)