Skip to content

xScheduledTask - Fix deletion of scheduled task with unknown or empty task trigger#142

Merged
PlagueHO merged 4 commits intodsccommunity:devfrom
matt6697:dev
Feb 20, 2018
Merged

xScheduledTask - Fix deletion of scheduled task with unknown or empty task trigger#142
PlagueHO merged 4 commits intodsccommunity:devfrom
matt6697:dev

Conversation

@matt6697
Copy link
Copy Markdown
Contributor

@matt6697 matt6697 commented Feb 15, 2018

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:

  • Change details added to Unreleased section of CHANGELOG.md?
  • Added/updated documentation, comment-based help and descriptions in .schema.mof files where appropriate?
  • Examples appropriately updated?
  • New/changed code adheres to Style Guidelines?
  • Unit and (optional) Integration tests created/updated where possible?

This change is Reviewable

@msftclas
Copy link
Copy Markdown

msftclas commented Feb 15, 2018

CLA assistant check
All CLA requirements met.

@codecov-io
Copy link
Copy Markdown

codecov-io commented Feb 15, 2018

Codecov Report

Merging #142 into dev will increase coverage by <1%.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           dev   #142    +/-   ##
===================================
+ Coverage   89%    89%   +<1%     
===================================
  Files        5      5            
  Lines      638    638            
===================================
+ Hits       568    570     +2     
+ Misses      70     68     -2

@PlagueHO
Copy link
Copy Markdown
Member

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.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.


Modules/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 441 at r2 (raw file):

            default
            {
                $returnScheduleType = ''

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

@PlagueHO PlagueHO self-assigned this Feb 16, 2018
@PlagueHO PlagueHO self-requested a review February 16, 2018 19:09
@PlagueHO PlagueHO added the needs review The pull request needs a code review. label Feb 16, 2018
@matt6697
Copy link
Copy Markdown
Contributor Author

Just added the verbose log entry as well as the unit test to avoid regression on this feature.

@matt6697
Copy link
Copy Markdown
Contributor Author

Modules/xComputerManagement/DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 441 at r2 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

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.

Done.


Comments from Reviewable

@PlagueHO
Copy link
Copy Markdown
Member

Awesome stuff @matt6697!

:lgtm:


Reviewed 3 of 3 files at r3.
Review status: all files reviewed at latest revision, all discussions resolved.


Comments from Reviewable

@PlagueHO PlagueHO merged commit af8d9eb into dsccommunity:dev Feb 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review The pull request needs a code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants