-
Notifications
You must be signed in to change notification settings - Fork 225
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
SqlDatabaseUser: Pass parameter ServerName to Assert-SqlLogin #1681
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1681 +/- ##
====================================
Coverage 97% 97%
====================================
Files 38 38
Lines 6260 6268 +8
====================================
+ Hits 6103 6112 +9
+ Misses 157 156 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 2 of 2 files at r1, 1 of 1 files at r2.
Reviewable status: complete! all files reviewed, all discussions resolved
@bschapendonk great work finding this issue! Thank you very much! 🙇 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r3.
Reviewable status: complete! all files reviewed, all discussions resolved
The integration test are failing with the following error: Cannot bind parameter because parameter 'ServerName' is specified more than once.
|
@bschapendonk running this example works on PowerShell 7, but does not work in Windows PowerShell. The unit tests runs in PowerShell 7 that way the above issue is not caught, but caught in integration tests as those are run in Windows PowerShell.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions (waiting on @bschapendonk and @johlju)
source/DSCResources/DSC_SqlDatabaseUser/DSC_SqlDatabaseUser.psm1, line 246 at r4 (raw file):
Assert-SqlLogin -ServerName $ServerName @PSBoundParameters
I think we need to to do this instead as the change is not supported by Windows PoweerShell. What do you think?
$assertSqlLoginParameters = @{} + $PSBoundParameter
$assertSqlLoginParameters['ServerName'] = $ServerName
Assert-SqlLogin @assertSqlLoginParameters
Alternative is to just pass the required values.
$assertSqlLoginParameters = @{
ServerName = $ServerName
InstanceName = $InstanceName
LoginName = $LoginName
}
Assert-SqlLogin @assertSqlLoginParameters
source/DSCResources/DSC_SqlDatabaseUser/DSC_SqlDatabaseUser.psm1, line 363 at r4 (raw file):
Assert-SqlLogin -ServerName $ServerName @PSBoundParameters
Same as previous comment.
@bschapendonk I will push a change for my comment so we can get this fix into the new release today. |
… commands in an interactive mode dsccommunity#1647 $servername is not passed thru @PSBoundParameters because the default is used and it is not explicitly set by the caller
aee57b3
to
d67f18c
Compare
There was a problem hiding this 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 r6.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @bschapendonk)
@bschapendonk awesome work finding this issue and providing a fix! Much appreciated! |
Added -ServerName to Assert-SqlLogin. @PSBoundParameters doesn't capture $ServerName when it is not explicitly set by the caller.
Fixes #1647
This change is