Skip to content

Commit

Permalink
SqlServerDsc: Fix keywords to have space before a parenthesis (#1426)
Browse files Browse the repository at this point in the history
- Changes to SqlServerDsc
  - Fix keywords to have space before a parenthesis to align with guideline
  • Loading branch information
johlju authored Sep 15, 2019
1 parent 7a70c03 commit b0f092d
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 20 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- 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

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
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

0 comments on commit b0f092d

Please sign in to comment.