win_scheduled_task: Fix start/end boundry triggers to allow for timezone sync (#57282)

* Fix 49327

* Add a test

* Join test

* Test issue

* Fix missed assertion
This commit is contained in:
ShachafGoldstein 2019-06-11 22:27:51 +03:00 committed by Jordan Borean
parent 1b5975f17e
commit d2909d5ef0
3 changed files with 7 additions and 5 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- "win_scheduled_task - Fix start/end bountry triggers to allow for timezone sync (https://github.com/ansible/ansible/issues/49327)"

View file

@ -746,7 +746,7 @@ for ($i = 0; $i -lt $triggers.Count; $i++) {
if ($trigger.ContainsKey($property_name)) {
$date_value = $trigger.$property_name
try {
$date = Get-Date -Date $date_value -Format s
$date = Get-Date -Date $date_value -Format "yyyy-MM-dd'T'HH:mm:ssK"
# make sure we convert it to the full string format
$trigger.$property_name = $date.ToString()
} catch [System.Management.Automation.ParameterBindingException] {

View file

@ -246,7 +246,7 @@
- path: cmd.exe
triggers:
- type: monthlydow
start_boundary: '2000-01-01T00:00:01'
start_boundary: '2000-01-01T00:00:01+03:00'
weeks_of_month: 1,2
days_of_week: [ "monday", "wednesday" ]
register: trigger_monthlydow
@ -265,7 +265,7 @@
- trigger_monthlydow_result.triggers|count == 1
- trigger_monthlydow_result.triggers[0].type == "TASK_TRIGGER_MONTHLYDOW"
- trigger_monthlydow_result.triggers[0].enabled == True
- trigger_monthlydow_result.triggers[0].start_boundary == "2000-01-01T00:00:01"
- trigger_monthlydow_result.triggers[0].start_boundary == "1999-12-31T21:00:01+00:00"
- trigger_monthlydow_result.triggers[0].end_boundary == None
- trigger_monthlydow_result.triggers[0].weeks_of_month == "1,2"
- trigger_monthlydow_result.triggers[0].days_of_week == "monday,wednesday"
@ -278,7 +278,7 @@
- path: cmd.exe
triggers:
- type: monthlydow
start_boundary: '2000-01-01T00:00:01'
start_boundary: '2000-01-01T00:00:01+03:00'
weeks_of_month: 1,2
days_of_week: [ "monday", "wednesday" ]
register: trigger_monthlydow_again
@ -321,7 +321,7 @@
- create_trigger_repetition_result_check.triggers|count == 1
- create_trigger_repetition_result_check.triggers[0].type == "TASK_TRIGGER_MONTHLYDOW"
- create_trigger_repetition_result_check.triggers[0].enabled == True
- create_trigger_repetition_result_check.triggers[0].start_boundary == "2000-01-01T00:00:01"
- create_trigger_repetition_result_check.triggers[0].start_boundary == "1999-12-31T21:00:01+00:00"
- create_trigger_repetition_result_check.triggers[0].end_boundary == None
- create_trigger_repetition_result_check.triggers[0].weeks_of_month == "1,2"
- create_trigger_repetition_result_check.triggers[0].days_of_week == "monday,wednesday"