Skip to content

Commit e8aeef5

Browse files
authored
Re-add ReportServerEdition enum to SqlRSSetup class (#2126)
1 parent b990bb0 commit e8aeef5

File tree

4 files changed

+23
-6
lines changed

4 files changed

+23
-6
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- `SqlAgentAlert`
1616
- Minor fix in `source/Classes/020.SqlAgentAlert.ps1` to correct `ExcludeDscProperties`
1717
formatting (added missing delimiter).
18+
- `SqlRSSetup`
19+
- Re-added `ReportServerEdition` enum and updated class to use enum instead of
20+
ValidateSet for the Edition property.
1821

1922
### Added
2023

source/Classes/020.SqlRSSetup.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,7 @@ class SqlRSSetup : ResourceBase
187187
$EditionUpgrade
188188

189189
[DscProperty()]
190-
[ValidateSet('Developer', 'Evaluation', 'ExpressAdvanced')]
191-
[System.String]
190+
[ReportServerEdition]
192191
$Edition
193192

194193
[DscProperty()]
@@ -402,8 +401,9 @@ class SqlRSSetup : ResourceBase
402401
hidden [void] Modify([System.Collections.Hashtable] $properties)
403402
{
404403
$getDscPropertyParameters = @{
405-
HasValue = $true
406-
Attribute = @(
404+
HasValue = $true
405+
IgnoreZeroEnumValue = $true
406+
Attribute = @(
407407
'Optional'
408408
'Mandatory'
409409
)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<#
2+
.SYNOPSIS
3+
The possible states for the commands and DSC resources that handles
4+
SQL Server Reporting Services or Power BI Report Server and uses the
5+
parameter Edition.
6+
#>
7+
enum ReportServerEdition
8+
{
9+
Developer = 1
10+
Evaluation
11+
ExpressAdvanced
12+
}

tests/Unit/Classes/SqlRSSetup.Tests.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ Describe 'SqlRSSetup\Get()' -Tag 'Get' {
129129
$currentState.MediaPath | Should -BeNullOrEmpty
130130
$currentState.ProductKey | Should -BeNullOrEmpty
131131
$currentState.EditionUpgrade | Should -BeNullOrEmpty
132-
$currentState.Edition | Should -BeNullOrEmpty
132+
# Returns 0, that means no value was set by GetCurrentState() from the enum ReportServerEdition
133+
$currentState.Edition | Should -Be 0
133134
$currentState.LogPath | Should -BeNullOrEmpty
134135
$currentState.InstallFolder | Should -BeNullOrEmpty
135136
$currentState.SuppressRestart | Should -BeFalse
@@ -187,7 +188,8 @@ Describe 'SqlRSSetup\Get()' -Tag 'Get' {
187188
$currentState.MediaPath | Should -BeNullOrEmpty
188189
$currentState.ProductKey | Should -BeNullOrEmpty
189190
$currentState.EditionUpgrade | Should -BeNullOrEmpty
190-
$currentState.Edition | Should -BeNullOrEmpty
191+
# Returns 0, that means no value was set by GetCurrentState() from the enum ReportServerEdition
192+
$currentState.Edition | Should -Be 0
191193
$currentState.LogPath | Should -BeNullOrEmpty
192194
$currentState.InstallFolder | Should -BeNullOrEmpty
193195
$currentState.SuppressRestart | Should -BeFalse

0 commit comments

Comments
 (0)