Skip to content

Commit

Permalink
SqlSetup: Fixes issue #1254 (#1299)
Browse files Browse the repository at this point in the history
- Changes to SqlSetup
  - Changed the logic of 'Build the argument string to be passed to setup' to
    not quote the value if root directory is specified
    ([issue #1254](#1254)).
  • Loading branch information
nesith authored and johlju committed Mar 3, 2019
1 parent c139e99 commit befa13f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@
- Added a new helper function `Get-InstalledSharedFeatures` to move out
some of the code from the `Get-TargetResource` to make unit testing
easier and faster.
- Changed the logic of 'Build the argument string to be passed to setup' to
not quote the value if root directory is specified
([issue #1254](https://github.com/PowerShell/SqlServerDsc/issues/1254)).

## 12.3.0.0

Expand Down
11 changes: 10 additions & 1 deletion DSCResources/MSFT_SqlSetup/MSFT_SqlSetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1574,7 +1574,16 @@ function Set-TargetResource
}
else
{
$setupArgumentValue = '"{0}"' -f $currentSetupArgument.Value
# Logic added as a fix for Issue#1254 SqlSetup:Fails when a root directory is specified
if($currentSetupArgument.Value -match '^[a-zA-Z]:\\$')
{
$setupArgumentValue = $currentSetupArgument.Value
}
else
{
$setupArgumentValue = '"{0}"' -f $currentSetupArgument.Value
}

}
}

Expand Down
1 change: 1 addition & 0 deletions Tests/Unit/MSFT_SqlSetup.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3348,6 +3348,7 @@ try

It 'Should set the system in the desired state when feature is SQLENGINE' {
$testParameters = $mockDefaultParameters.Clone()
# This is also used to regression test issue #1254, SqlSetup fails when root directory is specified.
$testParameters += @{
SQLSysAdminAccounts = 'COMPANY\User1','COMPANY\SQLAdmins'
ASSysAdminAccounts = 'COMPANY\User1','COMPANY\SQLAdmins'
Expand Down

0 comments on commit befa13f

Please sign in to comment.