Commit 7039ecf
committed
(MODULES-10893) Fix Last Day Of Month Trigger
Prior to this change, attempting to create a trigger that will run on
the last day of each selected month will fail. The error claims that a
a value is out of range
```
OLE error code:0 in <Unknown>
<No Description>
HRESULT error code:0x8002000a
Out of present range.
```
Microsoft [documentation] claims in one place that the correct way to
specify the last day of a month is to effectively translate a bitmask
value of day 32 and pass that into the `{get:set}_DaysOfMonth` method
on the trigger object. The module was previously coded to do exactly
this. The provider and it's helpers would catch the string value 'last'
in the `on` property of a `monthly` trigger and translate it into the
bit mask. This is what resulted in the error, because it turns out that
the position for day 32 in the bit mast is outside the acceptable range
of values for this property.
This PR changes strategy and instead relies on a different section
of the documentation in which an entirely different property on the
trigger object called [RunOnLastDayOfMonth] is set.
The code now catches the string value 'last' in the `on` property of
the trigger, and sets this boolean on the trigger object.
Testing has shown this to be an effective method of managing this
property of a trigger.
[documentation]: https://docs.microsoft.com/en-gb/windows/win32/api/taskschd/nf-taskschd-imonthlytrigger-get_daysofmonth
[RunOnLastDayOfMonth]: https://docs.microsoft.com/en-gb/windows/win32/api/taskschd/nf-taskschd-imonthlytrigger-put_runonlastdayofmonth1 parent 106d092 commit 7039ecf
File tree
6 files changed
+400
-344
lines changed- lib
- puppet_x/puppetlabs/scheduled_task
- puppet/type
- spec
- acceptance
- unit/puppet_x/puppetlabs/scheduled_task
6 files changed
+400
-344
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
301 | 301 | | |
302 | 302 | | |
303 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
304 | 307 | | |
305 | 308 | | |
306 | 309 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
166 | 167 | | |
167 | 168 | | |
168 | 169 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
389 | 390 | | |
390 | 391 | | |
391 | 392 | | |
392 | | - | |
393 | | - | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
394 | 402 | | |
395 | 403 | | |
396 | 404 | | |
397 | 405 | | |
398 | 406 | | |
399 | 407 | | |
400 | | - | |
401 | | - | |
402 | | - | |
403 | | - | |
404 | | - | |
405 | | - | |
| 408 | + | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | | - | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
409 | 415 | | |
410 | | - | |
| 416 | + | |
411 | 417 | | |
412 | | - | |
413 | | - | |
| 418 | + | |
414 | 419 | | |
415 | 420 | | |
416 | 421 | | |
417 | | - | |
| 422 | + | |
418 | 423 | | |
419 | 424 | | |
420 | 425 | | |
421 | 426 | | |
422 | 427 | | |
423 | | - | |
424 | | - | |
425 | | - | |
426 | | - | |
427 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
428 | 433 | | |
429 | 434 | | |
430 | 435 | | |
| |||
435 | 440 | | |
436 | 441 | | |
437 | 442 | | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
438 | 451 | | |
439 | 452 | | |
440 | 453 | | |
| |||
705 | 718 | | |
706 | 719 | | |
707 | 720 | | |
708 | | - | |
| 721 | + | |
709 | 722 | | |
710 | 723 | | |
711 | 724 | | |
712 | 725 | | |
713 | 726 | | |
714 | | - | |
| 727 | + | |
715 | 728 | | |
716 | 729 | | |
717 | | - | |
| 730 | + | |
718 | 731 | | |
719 | 732 | | |
720 | 733 | | |
| |||
783 | 796 | | |
784 | 797 | | |
785 | 798 | | |
| 799 | + | |
786 | 800 | | |
787 | 801 | | |
788 | 802 | | |
| |||
0 commit comments