Skip to content

Commit

Permalink
Merge pull request #1429 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 13.2.0.0 of SqlServerDsc
  • Loading branch information
mgreenegit authored Sep 19, 2019
2 parents 596ff25 + da8ebe4 commit f71cdc4
Show file tree
Hide file tree
Showing 14 changed files with 52 additions and 93 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## Unreleased

## 13.2.0.0

- Changes to SqlServerDsc
- Fix keywords to lower-case to align with guideline.
- Fix keywords to have space before a parenthesis to align with guideline.

## 13.1.0.0

- Changes to SqlServerDsc
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlAG/MSFT_SqlAG.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ function Get-TargetResource
function Set-TargetResource
{
[CmdletBinding()]
Param
param
(
[Parameter(Mandatory = $true)]
[System.String]
Expand Down Expand Up @@ -560,7 +560,7 @@ function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
Param
param
(
[Parameter(Mandatory = $true)]
[System.String]
Expand Down
4 changes: 2 additions & 2 deletions DSCResources/MSFT_SqlAGReplica/MSFT_SqlAGReplica.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ function Get-TargetResource
function Set-TargetResource
{
[CmdletBinding()]
Param
param
(
[Parameter(Mandatory = $true)]
[System.String]
Expand Down Expand Up @@ -552,7 +552,7 @@ function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
Param
param
(
[Parameter(Mandatory = $true)]
[System.String]
Expand Down
2 changes: 1 addition & 1 deletion DSCResources/MSFT_SqlAlias/MSFT_SqlAlias.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ function Test-TargetResource

if ($Ensure -eq $currentValues.Ensure)
{
if( $Ensure -eq 'Absent' )
if ($Ensure -eq 'Absent')
{
Write-Verbose -Message (
$script:localizedData.ClientAliasMissing -f $Name
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ $script:localizedData = Get-LocalizedData -ResourceName 'MSFT_SqlDatabaseDefault
The path to the default directory to be configured.
Not used in Get-TargetResource
#>
Function Get-TargetResource
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
Expand Down Expand Up @@ -110,7 +110,7 @@ Function Get-TargetResource
Specifies that the resource will only determine if a change is needed if the target node is the active host of the SQL Server Instance.
Not used in Set-TargetResource.
#>
Function Set-TargetResource
function Set-TargetResource
{
[CmdletBinding()]
param
Expand Down
33 changes: 18 additions & 15 deletions DSCResources/MSFT_SqlRS/MSFT_SqlRS.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -827,19 +827,19 @@ function Test-TargetResource

$currentConfig = Get-TargetResource @getTargetResourceParameters

if ( -not $currentConfig.IsInitialized )
if (-not $currentConfig.IsInitialized)
{
Write-Verbose -Message "Reporting services $DatabaseServerName\$DatabaseInstanceName are not initialized."
$result = $false
}

if ( -not [System.String]::IsNullOrEmpty($ReportServerVirtualDirectory) -and ($ReportServerVirtualDirectory -ne $currentConfig.ReportServerVirtualDirectory) )
if (-not [System.String]::IsNullOrEmpty($ReportServerVirtualDirectory) -and ($ReportServerVirtualDirectory -ne $currentConfig.ReportServerVirtualDirectory))
{
Write-Verbose -Message "Report server virtual directory on $DatabaseServerName\$DatabaseInstanceName is $($currentConfig.ReportServerVirtualDir), should be $ReportServerVirtualDirectory."
$result = $false
}

if ( -not [System.String]::IsNullOrEmpty($ReportsVirtualDirectory) -and ($ReportsVirtualDirectory -ne $currentConfig.ReportsVirtualDirectory) )
if (-not [System.String]::IsNullOrEmpty($ReportsVirtualDirectory) -and ($ReportsVirtualDirectory -ne $currentConfig.ReportsVirtualDirectory))
{
Write-Verbose -Message "Reports virtual directory on $DatabaseServerName\$DatabaseInstanceName is $($currentConfig.ReportsVirtualDir), should be $ReportsVirtualDirectory."
$result = $false
Expand All @@ -850,7 +850,7 @@ function Test-TargetResource
DifferenceObject = $ReportServerReservedUrl
}

if ( ($null -ne $ReportServerReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
if (($null -ne $ReportServerReservedUrl) -and ($null -ne (Compare-Object @compareParameters)))
{
Write-Verbose -Message "Report server reserved URLs on $DatabaseServerName\$DatabaseInstanceName are $($currentConfig.ReportServerReservedUrl -join ', '), should be $($ReportServerReservedUrl -join ', ')."
$result = $false
Expand All @@ -861,13 +861,13 @@ function Test-TargetResource
DifferenceObject = $ReportsReservedUrl
}

if ( ($null -ne $ReportsReservedUrl) -and ($null -ne (Compare-Object @compareParameters)) )
if (($null -ne $ReportsReservedUrl) -and ($null -ne (Compare-Object @compareParameters)))
{
Write-Verbose -Message "Reports reserved URLs on $DatabaseServerName\$DatabaseInstanceName are $($currentConfig.ReportsReservedUrl -join ', ')), should be $($ReportsReservedUrl -join ', ')."
$result = $false
}

if ( $PSBoundParameters.ContainsKey('UseSsl') -and $UseSsl -ne $currentConfig.UseSsl )
if ($PSBoundParameters.ContainsKey('UseSsl') -and $UseSsl -ne $currentConfig.UseSsl)
{
Write-Verbose -Message "The value for using SSL are not in desired state. Should be '$UseSsl', but was '$($currentConfig.UseSsl)'."
$result = $false
Expand Down Expand Up @@ -897,28 +897,31 @@ function Get-ReportingServicesData

$instanceNamesRegistryKey = 'HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS'

if ( Get-ItemProperty -Path $instanceNamesRegistryKey -Name $InstanceName -ErrorAction SilentlyContinue )
if (Get-ItemProperty -Path $instanceNamesRegistryKey -Name $InstanceName -ErrorAction SilentlyContinue)
{
$instanceId = (Get-ItemProperty -Path $instanceNamesRegistryKey -Name $InstanceName).$InstanceName

if( Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\MSSQLServer\CurrentVersion" )
if (Test-Path -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\MSSQLServer\CurrentVersion")
{
# SQL Server 2017 SSRS stores current SQL Server version to a different Registry path.
$sqlVersion = [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceId\MSSQLServer\CurrentVersion" -Name "CurrentVersion").CurrentVersion).Split(".")[0]
$sqlVersion = [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$InstanceId\MSSQLServer\CurrentVersion" -Name 'CurrentVersion').CurrentVersion).Split('.')[0]
}
else {
$sqlVersion = [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup" -Name "Version").Version).Split(".")[0]
else
{
$sqlVersion = [int]((Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\$instanceId\Setup" -Name 'Version').Version).Split('.')[0]
}

$reportingServicesConfiguration = Get-CimInstance -ClassName MSReportServer_ConfigurationSetting -Namespace "root\Microsoft\SQLServer\ReportServer\RS_$InstanceName\v$sqlVersion\Admin"
$reportingServicesConfiguration = $reportingServicesConfiguration | Where-Object -FilterScript {
$_.InstanceName -eq $InstanceName
}

<#
SQL Server Reporting Services Web Portal application name changed
in SQL Server 2016.
https://docs.microsoft.com/en-us/sql/reporting-services/breaking-changes-in-sql-server-reporting-services-in-sql-server-2016
#>
if ( $sqlVersion -ge 13 )
if ($sqlVersion -ge 13)
{
$reportsApplicationName = 'ReportServerWebApp'
}
Expand Down Expand Up @@ -973,7 +976,7 @@ function Invoke-RsCimMethod
ErrorAction = 'Stop'
}

if ( $PSBoundParameters.ContainsKey('Arguments') )
if ($PSBoundParameters.ContainsKey('Arguments'))
{
$invokeCimMethodParameters['Arguments'] = $Arguments
}
Expand All @@ -984,9 +987,9 @@ function Invoke-RsCimMethod
If an general error occur in the Invoke-CimMethod, like calling a method
that does not exist, returns $null in $invokeCimMethodResult.
#>
if ( $invokeCimMethodResult -and $invokeCimMethodResult.HRESULT -ne 0 )
if ($invokeCimMethodResult -and $invokeCimMethodResult.HRESULT -ne 0)
{
if ( $invokeCimMethodResult | Get-Member -Name 'ExtendedErrors' )
if ($invokeCimMethodResult | Get-Member -Name 'ExtendedErrors')
{
<#
The returned object property ExtendedErrors is an array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param(
param
(
[Parameter(Mandatory = $true)]
[System.String]
$ServerName,
Expand Down Expand Up @@ -115,7 +116,8 @@ function Get-TargetResource
function Set-TargetResource
{
[CmdletBinding()]
param(
param
(
[Parameter(Mandatory = $true)]
[System.String]
$ServerName,
Expand Down Expand Up @@ -212,7 +214,8 @@ function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
param
(
[Parameter(Mandatory = $true)]
[System.String]
$ServerName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param(
param
(
[Parameter()]
[ValidateNotNullOrEmpty()]
[System.String]
Expand Down
62 changes: 4 additions & 58 deletions SqlServerDsc.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
# Version number of this module.
moduleVersion = '13.1.0.0'
moduleVersion = '13.2.0.0'

# ID used to uniquely identify this module
GUID = '693ee082-ed36-45a7-b490-88b07c86b42f'
Expand Down Expand Up @@ -50,63 +50,8 @@

# ReleaseNotes of this module
ReleaseNotes = '- Changes to SqlServerDsc
- New DSC resource SqlAgentFailsafe
- New DSC resource SqlDatabaseUser ([issue 846](https://github.com/PowerShell/SqlServerDsc/issues/846)).
- Adds ability to create database users with more fine-grained control,
e.g. re-mapping of orphaned logins or a different login. Supports
creating a user with or without login name, and database users mapped
to a certificate or asymmetric key.
- Changes to helper function Invoke-Query
- Fixes issues in [issue 1355](https://github.com/PowerShell/SqlServerDsc/issues/1355).
- Works together with Connect-SQL now.
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Can now pass in credentials.
- Can now pass in "Microsoft.SqlServer.Management.Smo.Server" object.
- Can also pipe in "Microsoft.SqlServer.Management.Smo.Server" object.
- Can pipe Connect-SQL | Invoke-Query.
- Added default values to Invoke-Query.
- Now it will output verbose messages of the query that is run, so it
not as quiet of what it is doing when a user asks for verbose output
([issue 1404](https://github.com/PowerShell/SqlServerDsc/issues/1404)).
- It is possible to redact text in the verbose output by providing
strings in the new parameter `RedactText`.
- Minor style fixes in unit tests.
- Changes to helper function Connect-SQL
- When impersonating WindowsUser credential use the NetworkCredential UserName.
- Added additional verbose logging.
- Connect-SQL now uses parameter sets to more intuitive evaluate that
the correct parameters are used in different scenarios
([issue 1403](https://github.com/PowerShell/SqlServerDsc/issues/1403)).
- Changes to helper function Connect-SQLAnalysis
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Restart-SqlService
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Restart-ReportingServicesService
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Split-FullSqlInstanceName
- Parameters and function name changed to use correct casing.
- Changes to helper function Get-SqlInstanceMajorVersion
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Test-LoginEffectivePermissions
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to helper function Test-AvailabilityReplicaSeedingModeAutomatic
- Parameters now match that of Connect-SQL ([issue 1392](https://github.com/PowerShell/SqlServerDsc/issues/1392)).
- Changes to SqlServerSecureConnection
- Forced $Thumbprint to lowercase to fix [issue 1350](https://github.com/PowerShell/SqlServerDsc/issues/1350).
- Add parameter SuppressRestart with default value false.
This allows users to suppress restarts after changes have been made.
Changes will not take effect until the service has been restarted.
- Changes to SqlSetup
- Correct minor style violation [issue 1387](https://github.com/PowerShell/SqlServerDsc/issues/1387).
- Changes to SqlDatabase
- Get-TargetResource now correctly return `$null` for the collation property
when the database does not exist ([issue 1395](https://github.com/PowerShell/SqlServerDsc/issues/1395)).
- No longer enforces the collation property if the Collation parameter
is not part of the configuration ([issue 1396](https://github.com/PowerShell/SqlServerDsc/issues/1396)).
- Updated resource description in README.md
- Fix examples to use `PsDscRunAsCredential` ([issue 760](https://github.com/PowerShell/SqlServerDsc/issues/760)).
- Added integration tests ([issue 739](https://github.com/PowerShell/SqlServerDsc/issues/739)).
- Updated unit tests to the latest template ([issue 1068](https://github.com/PowerShell/SqlServerDsc/issues/1068)).
- Fix keywords to lower-case to align with guideline.
- Fix keywords to have space before a parenthesis to align with guideline.
'

Expand Down Expand Up @@ -136,5 +81,6 @@






2 changes: 1 addition & 1 deletion Tests/TestHelpers/CommonTestHelper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function Remove-IntegrationLoopbackAdapter
#>
function Get-NetIPAddressNetwork
{
Param
param
(
[Parameter(Mandatory = $true)]
[IPAddress]
Expand Down
8 changes: 4 additions & 4 deletions Tests/Unit/MSFT_SqlAGReplica.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ try
#region Function mocks

$mockConnectSqlServer1 = {
Param
param
(
[Parameter()]
[System.String]
Expand Down Expand Up @@ -290,7 +290,7 @@ try
}

$mockConnectSqlServer2 = {
Param
param
(
[Parameter()]
[System.String]
Expand Down Expand Up @@ -410,7 +410,7 @@ try
}

$mockConnectSqlServer3 = {
Param
param
(
[Parameter()]
[System.String]
Expand Down Expand Up @@ -533,7 +533,7 @@ try
$mockAvailabilityGroupReplicaPropertyValue = '' # Set dynamically during runtime

$mockUpdateAvailabilityGroupReplica = {
Param
param
(
[Parameter()]
[Microsoft.SqlServer.Management.Smo.AvailabilityReplica]
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/MSFT_SqlScriptQuery.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

# Suppression of this PSSA rule allowed in tests.
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingConvertToSecureStringWithPlainText', '')]
Param()
param ()

Import-Module -Name (Join-Path -Path $PSScriptRoot -ChildPath '..\TestHelpers\CommonTestHelper.psm1')

Expand Down
4 changes: 2 additions & 2 deletions Tests/Unit/SqlServerDsc.Common.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2128,7 +2128,7 @@ InModuleScope 'SqlServerDsc.Common' {
}

$mockConnectSql = {
Param
param
(
[Parameter()]
[System.String]
Expand Down Expand Up @@ -2195,7 +2195,7 @@ InModuleScope 'SqlServerDsc.Common' {
BeforeEach {
$mockSqlVersion = 13
$mockConnectSql = {
Param
param
(
[Parameter()]
[System.String]
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/Stubs/Write-ModuleStubFile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ function Write-ModuleStubFile
$endOfParameter = $true
}

# Format Param line
# Format param line
'param\($'
{
$line = $line -replace 'param\(','param'
Expand Down

0 comments on commit f71cdc4

Please sign in to comment.