From 375bc1113970be25315dc0db5f4693e0b0a3f776 Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 15 Feb 2018 06:14:06 +1000 Subject: [PATCH] win_updates: fix regression when using string cat names (#36015) (cherry picked from commit 8fb66c18de22fab32529e1a923789a88fd52a8fa) --- lib/ansible/plugins/action/win_updates.py | 4 ++++ test/integration/targets/win_updates/tasks/tests.yml | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/plugins/action/win_updates.py b/lib/ansible/plugins/action/win_updates.py index ad6d1ad0012..a3a0a050ece 100644 --- a/lib/ansible/plugins/action/win_updates.py +++ b/lib/ansible/plugins/action/win_updates.py @@ -6,6 +6,7 @@ import json from ansible.errors import AnsibleError from ansible.module_utils._text import to_text from ansible.module_utils.parsing.convert_bool import boolean +from ansible.parsing.yaml.objects import AnsibleUnicode from ansible.plugins.action import ActionBase try: @@ -140,6 +141,9 @@ class ActionModule(ActionBase): 'SecurityUpdates', 'UpdateRollups', ]) + if isinstance(category_names, AnsibleUnicode): + category_names = [cat.strip() for cat in category_names.split(",")] + state = self._task.args.get('state', 'installed') reboot = self._task.args.get('reboot', False) reboot_timeout = self._task.args.get('reboot_timeout', diff --git a/test/integration/targets/win_updates/tasks/tests.yml b/test/integration/targets/win_updates/tasks/tests.yml index 330c99cc01a..da03c3f0c08 100644 --- a/test/integration/targets/win_updates/tasks/tests.yml +++ b/test/integration/targets/win_updates/tasks/tests.yml @@ -43,8 +43,7 @@ - name: search for updates with log output (check) win_updates: state: searched - category_names: - - CriticalUpdates + category_names: CriticalUpdates log_path: '{{win_updates_dir}}/update.log' register: update_search_with_log_check check_mode: yes