xScheduledTask: Added multiple parameters (Fixes #34 and #41) BREAKING CHANGE#69
xScheduledTask: Added multiple parameters (Fixes #34 and #41) BREAKING CHANGE#69PlagueHO merged 47 commits intodsccommunity:devfrom nyanhp:feature/ScheduledTaskOptions
Conversation
…e PowerShell cmdlets.
Exceptions added to Set-TargetResource Initial values for DaysInterval and WeeksInterval removed StartTime added to return values from Get-TargetResource
…t (no need to check other parameters)
…for DisallowDemandStart, DisallowHardTerminate and AllowStartIfOnBatteries
… otherwise be updated to overcome issues with a malformed task XML (due to unsupported value combinations)
…seen in resource module xNetworking) with minor addition to allow credentials to be compared based on the username.
|
@nyanhp, It will cover your contributions to all Microsoft-managed open source projects. |
|
@nyanhp, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
Awesome work @nyanhp ! Just some minor tweaks left - hopefully nothing too tricky. Thanks again and sorry this took so long. Reviewed 1 of 2 files at r2, 2 of 3 files at r3. Tests/Integration/MSFT_xScheduledTask.Config.ps1, line 4 at r8 (raw file):
Please convert to single quotes - same for all Configurations. Node, TaskName, TaskPath and ActionExecutable. Tests/Integration/MSFT_xScheduledTask.Config.ps1, line 61 at r8 (raw file):
Nitpick: Remove extra spacing between = and $true Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 30 at r8 (raw file):
Not a requirement here at all, just a suggestion, but there does seem to be a lot duplicated code here that could be made into a simple loop. E.g. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 31 at r8 (raw file):
Please convert to single quotes (repeat for all $CurrentConfig) Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 32 at r8 (raw file):
Convert from positional parameters to named parameters (and next line) - repeat for all. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 33 at r8 (raw file):
Please convert to single quotes Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 35 at r8 (raw file):
Please change to single quotes (repeat for all) and also use this text (it is the updated one from the template): Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 37 at r8 (raw file):
I could be wrong, but this doesn't look right. The usual pattern to compile a MOF from a dot sourced Config is to use: Dot sourcing the file doesn't seem like it should work. But I could be wrong 😁 Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 41 at r8 (raw file):
Please convert to single quotes (repeat for all) Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 47 at r8 (raw file):
Please convert to single quotes (repeat for all) Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 375 at r8 (raw file):
It looks like these tests are destructive (e.g. will change the system) - which is OK for integration tests - but it doesn't seem to be cleaning up afterwards if anything fails. Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 41 at r8 (raw file):
Please convert to single quotes (and following lines). Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 50 at r8 (raw file):
Please convert to single quotes (and all following It blocks) - sorry, I know this isn't code you created, but we're trying to get all resource modules up to meet minimum standards (which is a big job) 😁 Comments from Reviewable |
|
Review status: all files reviewed at latest revision, 13 unresolved discussions. Tests/Integration/MSFT_xScheduledTask.Config.ps1, line 4 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Config.ps1, line 61 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 30 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
I am still growing accustomed to Pester, thanks for the hint. Will consider it! Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 31 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 32 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 33 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 35 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 37 at r8 (raw file):
Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 41 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 47 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 375 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Will try to add some cleanup for it, thanks for the reminder! Comments from Reviewable |
Cleans up any leftover tasks and removes the task folder that will invariably be created
and verbose switch removed
|
Review status: 5 of 8 files reviewed at latest revision, 13 unresolved discussions. Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 41 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 50 at r8 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Comments from Reviewable |
|
Really great job @nyanhp! Excellent work on the integration tests! Reviewed 3 of 3 files at r9. Tests/Integration/MSFT_xScheduledTask.Integration.Tests.ps1, line 37 at r8 (raw file): Previously, nyanhp (Jan-Hendrik Peters [MSFT]) wrote…
Cool! All good - just wasn't familiar with the syntax. Comments from Reviewable |
|
@zjalexander or @mbreakey3 - this one Could one of you confirm and merge when/if you have the time? |
|
Just to confirm, is this a breaking change? I know a lot was added, but was anything changed that will invalidate old configurations of this resource? If so, could you just add (BREAKING CHANGE) to the title of your PR |
|
Hi @mbreakey3 , it is a breaking change. The ScheduleType 'Minutes' did not make sense any longer. The interval in minutes or hours can be specified for each ScheduleType. Before my change, the only task type that could be created was of the type Once. |
|
@nyanhp - no problem - can you jst add (BREAKING CHANGE) to the title of this PR so we know to update the version when we publish? |
|
@nyanhp, thanks for signing the contribution license agreement. We will now validate the agreement and then the pull request. |
|
Hi @nyanhp - this PR has some merge conflicts that need to be fixed. |
|
Hi @PlagueHO , resolved the conflicts, thanks! |
|
Reviewed 1 of 1 files at r10. README.md, line 123 at r10 (raw file):
Are you able to add BREAKING CHANGE: to the beginning of this line? Comments from Reviewable |
|
Hi @nyanhp - I think there is just one last tweak to be made and this can be merged. |
Added info about breaking change to README:md
|
Review status: 7 of 8 files reviewed at latest revision, 1 unresolved discussion. README.md, line 123 at r10 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Comments from Reviewable |
|
Reviewed 1 of 1 files at r11. Comments from Reviewable |
|
@kwirkykat , @zjalexander - are you able to merge this one? I'm not yet a maintainer of this repo 😁 |
|
@PlagueHO Just sent the invite. You should be able to merge now 🙂 |
|
Thanks @kwirkykat ! Really appreciate it 😁 |
|
Great job @nyanhp - all merged! |
This pull request describes a major overhaul of the resource xScheduledTask. It is now possible to create all usual trigger types: Once, Daily, Weekly, AtLogon, AtStartup with their respective parameter sets. Additionally it is now possible to set a random interval for all trigger types.
All possible task settings apart from the maintenance settings have been implemented and can be set for all schedule types.
The Test-TargetResource function now implements a function from the module CommonResourceHelper called Test-DscParameterState, to make testing the 30+ properties easier. For this purpose, the module CommonResourceHelper has been added the functions Remove-CommonParameter, Test-DscParameterState and Test-DSCObjectHasProperty.
I realise that this PR introduces some major changes, but it was necessary since the old resource only provided a bare minimum of task settings.
This change is