From b8ec7c407284f82335bcb8d250d40a2e0d2f35b8 Mon Sep 17 00:00:00 2001 From: Kevin Pavon <7450065+KaraokeKev@users.noreply.github.com> Date: Wed, 16 Aug 2023 15:10:31 -0400 Subject: [PATCH] Schedule rruleset fix related #13446 (#13611) Signed-off-by: Kevin Pavon <7450065+KaraokeKev@users.noreply.github.com> Co-authored-by: Jessica Steurer <70719005+jay-steurer@users.noreply.github.com> --- .../plugins/lookup/schedule_rruleset.py | 2 +- .../targets/lookup_rruleset/tasks/main.yml | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/awx_collection/plugins/lookup/schedule_rruleset.py b/awx_collection/plugins/lookup/schedule_rruleset.py index b45d861db36c..07e990800b20 100644 --- a/awx_collection/plugins/lookup/schedule_rruleset.py +++ b/awx_collection/plugins/lookup/schedule_rruleset.py @@ -214,7 +214,7 @@ def process_list(self, field_name, rule, valid_list, rule_number): if not isinstance(rule[field_name], list): rule[field_name] = rule[field_name].split(',') for value in rule[field_name]: - value = value.strip() + value = value.strip().lower() if value not in valid_list: raise AnsibleError('In rule {0} {1} must only contain values in {2}'.format(rule_number, field_name, ', '.join(valid_list.keys()))) return_values.append(valid_list[value]) diff --git a/awx_collection/tests/integration/targets/lookup_rruleset/tasks/main.yml b/awx_collection/tests/integration/targets/lookup_rruleset/tasks/main.yml index 7f9f0271b298..6ff771749e82 100644 --- a/awx_collection/tests/integration/targets/lookup_rruleset/tasks/main.yml +++ b/awx_collection/tests/integration/targets/lookup_rruleset/tasks/main.yml @@ -356,3 +356,19 @@ that: - results is success - "'DTSTART;TZID=UTC:20220430T103045 RRULE:FREQ=MONTHLY;BYMONTHDAY=12,13,14,15,16,17,18;BYDAY=SA;INTERVAL=1' == complex_rule" + +- name: mondays, Tuesdays, and WEDNESDAY with case-insensitivity + set_fact: + complex_rule: "{{ query(ruleset_plugin_name, '2022-04-30 10:30:45', rules=rrules, timezone='UTC' ) }}" + ignore_errors: True + register: results + vars: + rrules: + - frequency: 'day' + interval: 1 + byweekday: monday, Tuesday, WEDNESDAY + +- assert: + that: + - results is success + - "'DTSTART;TZID=UTC:20220430T103045 RRULE:FREQ=DAILY;BYDAY=MO,TU,WE;INTERVAL=1' == complex_rule"