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

Fix mismatch between user and builtinaccount #387

Merged
merged 26 commits into from
Nov 23, 2022

Conversation

nickgw
Copy link
Contributor

@nickgw nickgw commented May 21, 2022

Currently ScheduledTask conflates the param BuiltInAccount and *-ScheduledTask cmdlet's user parameter. This fixes that.

Pull Request (PR) description

Currently ScheduledTask conflates the param BuiltInAccount and *-ScheduledTask cmdlet's user parameter. This fixes that.

This Pull Request (PR) fixes the following issues

Task list

  • Added an entry to the change log under the Unreleased section of the
    file CHANGELOG.md. Entry should say what was changed and how that
    affects users (if applicable), and reference the issue being resolved
    (if applicable).
  • Resource documentation added/updated in README.md.
  • Resource parameter descriptions added/updated in README.md, schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Community Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Community Testing Guidelines.
  • New/changed code adheres to DSC Community Style Guidelines.

This change is Reviewable

@PlagueHO PlagueHO added the waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. label May 23, 2022
@codecov
Copy link

codecov bot commented Jun 3, 2022

Codecov Report

Merging #387 (73dce2d) into main (3aea926) will increase coverage by 0%.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           main   #387   +/-   ##
===================================
  Coverage    90%    90%           
===================================
  Files        17     17           
  Lines      1716   1726   +10     
===================================
+ Hits       1554   1564   +10     
  Misses      162    162           
Impacted Files Coverage Δ
...Resources/DSC_ScheduledTask/DSC_ScheduledTask.psm1 87% <100%> (+<1%) ⬆️

@nickgw
Copy link
Contributor Author

nickgw commented Jun 3, 2022

@PlagueHO This should be good to go now, when you get a chance to check it out!

@ShawnHardwick
Copy link
Contributor

@nickgw
Copy link
Contributor Author

nickgw commented Jun 20, 2022

Should the MOF schema be updated to match this as well?

https://github.com/dsccommunity/ComputerManagementDsc/blob/main/source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.schema.mof#L16

The inputs don't actually change. The code was comparing the wrong properties.

@PlagueHO PlagueHO added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Jun 21, 2022
@PlagueHO
Copy link
Member

Hi @nickgw - sorry was tied up on other things. I'll get onto this close to the end of the week. Just need to try and avoid breaking Windows Server 2016 (unfortunately we can't test on it at the moment unless we get something like TK going in Azure).

@nickgw
Copy link
Contributor Author

nickgw commented Jul 8, 2022

Hey @PlagueHO just bumping this (and my related comments in the issue) when you get a chance!

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @nickgw)


CHANGELOG.md line 7 at r1 (raw file):

## [Unreleased]
### Fixed

Can you add a blank line above this line?


source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.psm1 line 832 at r1 (raw file):

                instead?
            #>
            $username = Set-DomainNameInAccountName -AccountName SYSTEM -DomainName 'NT AUTHORITY'

Nit: Just for consistency, can you put single quotes around SYSTEM?


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1784 at r1 (raw file):

                }

                # It 'Should Disregard ExecuteAsCredential and Set User to the BuiltInAccount' {

If a test isn't verifying the correct thing, we should remove it rather than commenting. However, in this case, I think the test should be adjusted to reflect the actual function.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1791 at r1 (raw file):

                # }

                $testParameters.Add('LogonType', 'Password')

Can you also add some additional tests here to verify the changed functionallity?

@johlju johlju added waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. and removed needs review The pull request needs a code review. labels Oct 5, 2022
@nickgw
Copy link
Contributor Author

nickgw commented Oct 29, 2022

@PlagueHO Do you mind taking another look at this? I've added another test.

Copy link
Contributor Author

@nickgw nickgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 3 files reviewed, 3 unresolved discussions (waiting on @PlagueHO)


CHANGELOG.md line 7 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Can you add a blank line above this line?

Done.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1784 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

If a test isn't verifying the correct thing, we should remove it rather than commenting. However, in this case, I think the test should be adjusted to reflect the actual function.

Done.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1791 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Can you also add some additional tests here to verify the changed functionallity?

Done.

@nickgw nickgw requested a review from PlagueHO November 6, 2022 00:20
@nickgw
Copy link
Contributor Author

nickgw commented Nov 19, 2022

@PlagueHO do you mind taking another look at this? I'd love to close this off my list.

@PlagueHO
Copy link
Member

Cool! Thanks @nickgw - I'll review tonight.

@PlagueHO PlagueHO added needs review The pull request needs a code review. and removed waiting for code fix A review left open comments, and the pull request is waiting for changes to be pushed by the author. labels Nov 22, 2022
Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor tweaks and we can merge!

Reviewed 2 of 2 files at r3, 1 of 1 files at r4, all commit messages.
Reviewable status: all files reviewed, 3 unresolved discussions (waiting on @nickgw)


CHANGELOG.md line 7 at r1 (raw file):

Previously, nickgw (Nick G) wrote…

Done.

There is an extra f at the beginning of this line.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1774 at r4 (raw file):

            Context 'When a scheduled task is created using a Built In Service Account' {
                #

I think this # can be removed.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1809 at r4 (raw file):

                    }
                }
                #

I think this has can be removed.

Copy link
Contributor Author

@nickgw nickgw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 1 of 3 files reviewed, 3 unresolved discussions (waiting on @PlagueHO)


CHANGELOG.md line 7 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

There is an extra f at the beginning of this line.

Done.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1774 at r4 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

I think this # can be removed.

Done.


tests/Unit/DSC_ScheduledTask.Tests.ps1 line 1809 at r4 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

I think this has can be removed.

Done.

Code quote:

When a scheduled task is created using a Built In Service Accoun

@nickgw
Copy link
Contributor Author

nickgw commented Nov 22, 2022

@PlagueHO I think I hit all your comments!

@nickgw nickgw requested a review from PlagueHO November 22, 2022 18:53
Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r5, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @nickgw)

@PlagueHO PlagueHO merged commit 6c3f2fd into dsccommunity:main Nov 23, 2022
@nickgw nickgw deleted the ngermany_fixuservsbuiltinaccount branch November 23, 2022 14:47
@johlju johlju removed the needs review The pull request needs a code review. label Feb 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ScheduledTask: Get-TargetResource returns wrong account for BuiltInAccount parameter
4 participants