-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xScheduledTask - Fix deletion of scheduled task with unknown or empty task trigger #142
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #142 +/- ##
===================================
+ Coverage 89% 89% +<1%
===================================
Files 5 5
Lines 638 638
===================================
+ Hits 568 570 +2
+ Misses 70 68 -2 |
Great job @matt6697- thank you for submitting this. Just a minor suggestion to help with issue diagnosis in future. Reviewed 1 of 2 files at r1, 1 of 1 files at r2. Modules/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 441 at r2 (raw file):
Could you also add a verbose log entry to this to state that the trigger type was not specifically handled? I think this info might be useful in diagnosing issues. Comments from Reviewable |
Just added the verbose log entry as well as the unit test to avoid regression on this feature. |
Modules/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 441 at r2 (raw file): Previously, PlagueHO (Daniel Scott-Raynsford) wrote…
Done. Comments from Reviewable |
Awesome stuff @matt6697! Reviewed 3 of 3 files at r3. Comments from Reviewable |
Pull Request (PR) description
Fixes deletion of scheduled task with unknown or empty task trigger. Get-TargetResource now returns an empty ScheduleType string if the task trigger is empty or unknown instead of throwing an error.
Tasks like Microsoft\Windows\Application Experience\ProgramDataUpdater don't have a valid ScheduleType for the xScheduledTask DSC resource.
Throwing an error in the Get function is not needed in this case as results of the Get function will be compared with desired state values in the Test function. The empty ScheduledType string will be compared to one the
[ValidateSet('Once', 'Daily', 'Weekly', 'AtStartup', 'AtLogOn')]
mandatory values of the ScheduledType parameter. The result of the Test function will then be$false
and the Set function called to either correct the missing/bad ScheduledType if$ensure='present'
or to delete the scheduled task if$ensure='absent'
This Pull Request (PR) fixes the following issues:
Fixes issue #137
Task list:
This change is