Skip to content
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

BREAKING CHANGE: xScheduledTask: Add support for disabling built-in tasks - Fixes #74 #132

Merged
merged 7 commits into from
Jan 14, 2018

Conversation

PlagueHO
Copy link
Member

@PlagueHO PlagueHO commented Jan 13, 2018

Pull Request (PR) description

  • xScheduledTask:
    • Add support to disable built-in scheduled tasks - See Issue #74.
    • Fix unit test mocked schedule task object structure.
  • BREAKING CHANGE: xScheduledTask:
    • Breaking change because Get-TargetResource no longer outputs
      ActionExecutable and ScheduleType properties when the scheduled
      task does not exist. It will also include TaskPath in output when
      scheduled task does not exist.

This Pull Request (PR) fixes the following issues:

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?

@johlju - as always would you be able to review for me? I cleaned up the unit tests hashtable layouts because I figured you'd pick up on the incorrect style 😁 - so sorry about the large number of style corrections in the unit tests file.


This change is Reviewable

@PlagueHO PlagueHO added the needs review The pull request needs a code review. label Jan 13, 2018
@PlagueHO PlagueHO self-assigned this Jan 13, 2018
@codecov-io
Copy link

codecov-io commented Jan 13, 2018

Codecov Report

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

Impacted file tree graph

@@         Coverage Diff         @@
##           dev   #132    +/-   ##
===================================
+ Coverage   88%    89%   +<1%     
===================================
  Files        5      5            
  Lines      630    638     +8     
===================================
+ Hits       560    568     +8     
  Misses      70     70

@johlju
Copy link
Member

johlju commented Jan 14, 2018

Reviewed 8 of 9 files at r1, 1 of 1 files at r2.
Review status: all files reviewed at latest revision, 6 unresolved discussions.


DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 1627 at r2 (raw file):

    Write-Verbose -Message ($script:localizedData.TestingDscParameterStateMessage)

    return Test-DscParameterState -CurrentValues $currentValues -DesiredValues $desiredValues -Verbose

Should this always output verbose messages even when user has not asked for it?


Examples/xScheduledTask/11-DisableABuiltInTask.ps1, line 17 at r2 (raw file):

        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential

This parameter is not used.


Examples/xScheduledTask/12-DeleteABuiltInTask.ps1, line 17 at r2 (raw file):

        [ValidateNotNullorEmpty()]
        [System.Management.Automation.PSCredential]
        $Credential

This parameter is not used.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 40 at r2 (raw file):

        function Register-ScheduledTask
        {
            param (

Parenthesis on the next row.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 41 at r2 (raw file):

        {
            param (
                [switch]

Should have [Parameter()] on this too.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 154 at r2 (raw file):

                }

                Mock -CommandName Get-ScheduledTask { return @{

Should have -MockWith. Throughout.


Comments from Reviewable

@PlagueHO
Copy link
Member Author

All done @johlju - plus I found a couple of other style issues in the Unit tests - so fixed those.


Review status: 5 of 9 files reviewed at latest revision, 6 unresolved discussions.


DSCResources/MSFT_xScheduledTask/MSFT_xScheduledTask.psm1, line 1627 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Should this always output verbose messages even when user has not asked for it?

Doh! Good catch - I enabled this while doing some debugging.


Examples/xScheduledTask/11-DisableABuiltInTask.ps1, line 17 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

This parameter is not used.

Done.


Examples/xScheduledTask/12-DeleteABuiltInTask.ps1, line 17 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

This parameter is not used.

Done.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 40 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Parenthesis on the next row.

Done.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 41 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Should have [Parameter()] on this too.

Done.


Tests/Unit/MSFT_xScheduledTask.Tests.ps1, line 154 at r2 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Should have -MockWith. Throughout.

Done.


Comments from Reviewable

@johlju
Copy link
Member

johlju commented Jan 14, 2018

:lgtm:


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


Comments from Reviewable

@PlagueHO PlagueHO merged commit 8cc11cf into dsccommunity:dev Jan 14, 2018
@PlagueHO PlagueHO deleted the Issue-74 branch January 14, 2018 20:02
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.

xScheduleTask: Cannot disable already present tasks
3 participants