Skip to content

Commit

Permalink
Changes to SqlScriptQuery
Browse files Browse the repository at this point in the history
- Added en-US localization (issue dsccommunity#624).
  • Loading branch information
johlju committed Apr 23, 2019
1 parent 9e65d21 commit 65e25a1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
`Invoke-SqlScript` so that `PRINT` statements is outputted correctly
when verbose output is requested, e.g
`Start-DscConfiguration -Verbose`.
- Added en-US localization.
- Changes to SqlSetup
- Concatenated Robocopy localization strings ([issue #694](https://github.com/PowerShell/SqlServerDsc/issues/694)).
- Changes to SqlWaitForAG
Expand Down
26 changes: 26 additions & 0 deletions DSCResources/MSFT_SqlScriptQuery/MSFT_SqlScriptQuery.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Import-Module -Name (Join-Path -Path $script:localizationModulePath -ChildPath '
$script:resourceHelperModulePath = Join-Path -Path $script:modulesFolderPath -ChildPath 'DscResource.Common'
Import-Module -Name (Join-Path -Path $script:resourceHelperModulePath -ChildPath 'DscResource.Common.psm1')

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlScriptQuery'

<#
.SYNOPSIS
Returns the current state of the SQL Server features.
Expand Down Expand Up @@ -80,6 +82,10 @@ function Get-TargetResource
$Variable
)

Write-Verbose -Message (
$script:localizedData.ExecutingGetQuery -f $ServerInstance
)

$invokeParameters = @{
Query = $GetQuery
ServerInstance = $ServerInstance
Expand Down Expand Up @@ -177,6 +183,10 @@ function Set-TargetResource
$Variable
)

Write-Verbose -Message (
$script:localizedData.ExecutingSetQuery -f $ServerInstance
)

$invokeParameters = @{
Query = $SetQuery
ServerInstance = $ServerInstance
Expand Down Expand Up @@ -261,8 +271,16 @@ function Test-TargetResource
$Variable
)

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

try
{
Write-Verbose -Message (
$script:localizedData.ExecutingTestQuery -f $ServerInstance
)

$invokeParameters = @{
Query = $TestQuery
ServerInstance = $ServerInstance
Expand All @@ -277,10 +295,18 @@ function Test-TargetResource

if ($null -eq $result)
{
Write-Verbose -Message (
$script:localizedData.InDesiredState
)

return $true
}
else
{
Write-Verbose -Message (
$script:localizedData.NotInDesiredState
)

return $false
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Localized resources for SqlSetup

ConvertFrom-StringData @'
ExecutingGetQuery = Executing the Get query on the instance '{0}'.
ExecutingSetQuery = Executing the Set query on the instance '{0}'.
ExecutingTestQuery = Executing the Test query on the instance '{0}'.
TestingConfiguration = Determines if the configuration in the Set query is in desired state.
InDesiredState = The configuration is in desired state.
NotInDesiredState = The configuration is not in desired state.
'@

0 comments on commit 65e25a1

Please sign in to comment.