Skip to content

Commit

Permalink
Convert to DSCResource.Common - Fixes #117 (#120)
Browse files Browse the repository at this point in the history
* Convert to DscResource.Common

* Fix conversion to DscResource.Common
  • Loading branch information
PlagueHO authored Jun 20, 2020
1 parent 1b8534d commit 5e2daad
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 2,097 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Change Azure DevOps Pipeline definition to include `source/*` - Fixes [Issue #114](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/114).
- Updated pipeline to use `latest` version of `ModuleBuilder` - Fixes [Issue #115](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/115).
- Merge `HISTORIC_CHANGELOG.md` into `CHANGELOG.md` - Fixes [Issue #115](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/115).
- Fixed build failures caused by changes in `ModuleBuilder` module v1.7.0
by changing `CopyDirectories` to `CopyPaths` - Fixes [Issue #119](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/119).
- Updated to use the common module _DscResource.Common_ - Fixes [Issue #117](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/117).
- Pin `Pester` module to 4.10.1 because Pester 5.0 is missing code
coverage - Fixes [Issue #118](https://github.com/dsccommunity/ActiveDirectoryCSDsc/issues/118).

### Added

Expand Down
5 changes: 3 additions & 2 deletions RequiredModules.psd1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@{
PSDependOptions = @{
PSDependOptions = @{
AddToPath = $true
Target = 'output\RequiredModules'
Parameters = @{
Expand All @@ -9,7 +9,7 @@

InvokeBuild = 'latest'
PSScriptAnalyzer = 'latest'
Pester = 'latest'
Pester = '4.10.1'
Plaster = 'latest'
ModuleBuilder = 'latest'
ChangelogManagement = 'latest'
Expand All @@ -18,5 +18,6 @@
'DscResource.Test' = 'latest'
'DscResource.AnalyzerRules' = 'latest'
'DscResource.DocGenerator' = 'latest'
'DscResource.Common' = 'latest'
xDscResourceDesigner = 'latest'
}
17 changes: 15 additions & 2 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,24 @@
####################################################
# ModuleBuilder Configuration #
####################################################
CopyDirectories:
CopyPaths:
- en-US
- DSCResources
- Modules
Encoding: UTF8
VersionedOutputDirectory: true

####################################################
# ModuleBuilder Dependent Modules Configuration #
####################################################

NestedModule:
DscResource.Common:
CopyOnly: true
Path: ./output/RequiredModules/DscResource.Common
AddToManifest: false
Exclude: PSGetModuleInfo.xml

####################################################
# Pipeline Configuration #
####################################################
Expand Down Expand Up @@ -40,14 +51,14 @@ BuildWorkflow:
- Publish_release_to_GitHub
- publish_module_to_gallery


####################################################
# PESTER Configuration #
####################################################

Pester:
OutputFormat: NUnitXML
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
Script:
- tests/Unit
- tests/Integration
Expand All @@ -61,6 +72,8 @@ DscTest:
- 'Common Tests - New Error-Level Script Analyzer Rules'
ExcludeSourceFile:
- output
ExcludeModuleFile:
- Modules/DscResource.Common

Resolve-Dependency:
Gallery: 'PSGallery'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsAuthorityInformationAccess'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsCertificationAuthority'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsCertificationAuthoritySettings'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
This is an array of all the parameters used by this resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsEnrollmentPolicyWebService'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down Expand Up @@ -152,7 +154,7 @@ function Set-TargetResource
$($script:localizedData.SettingAdcsEnrollmentPolicyWebServiceStatusMessage -f $AuthenticationType)
) -join '' )

$adcsEnrollmentPolicyWebServiceParameters = @{} + $PSBoundParameters
$adcsEnrollmentPolicyWebServiceParameters = @{ } + $PSBoundParameters
$null = $adcsEnrollmentPolicyWebServiceParameters.Remove('Ensure')
$null = $adcsEnrollmentPolicyWebServiceParameters.Remove('Debug')
$null = $adcsEnrollmentPolicyWebServiceParameters.Remove('ErrorAction')
Expand Down Expand Up @@ -191,9 +193,9 @@ function Set-TargetResource
if (-not [System.String]::IsNullOrEmpty($errorMessage))
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceErrorMessage -f $errorMessage)
) -join '' )
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceErrorMessage -f $errorMessage)
) -join '' )
New-InvalidOperationException -Message $errorMessage
}
} # function Set-TargetResource
Expand Down Expand Up @@ -383,18 +385,18 @@ function Test-AdcsEnrollmentPolicyWebServiceInstallState
if ($null -eq $enrollmentPolicyWebServiceWebApp)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceInstallIsNotInstalledMessage -f $AuthenticationType, $KeyBasedRenewal)
) -join '' )
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceInstallIsNotInstalledMessage -f $AuthenticationType, $KeyBasedRenewal)
) -join '' )

return $false
}
else
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceInstallIsInstalledMessage -f $AuthenticationType, $KeyBasedRenewal)
) -join '' )
"$($MyInvocation.MyCommand): "
$($script:localizedData.AdcsEnrollmentPolicyWebServiceInstallIsInstalledMessage -f $AuthenticationType, $KeyBasedRenewal)
) -join '' )

return $true
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsOnlineResponder'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down Expand Up @@ -54,7 +56,7 @@ function Get-TargetResource
$($script:localizedData.GettingAdcsOnlineResponderStatusMessage)
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand Down Expand Up @@ -125,7 +127,7 @@ function Set-TargetResource
$($script:localizedData.SettingAdcsOnlineResponderStatusMessage)
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand All @@ -144,7 +146,7 @@ function Set-TargetResource
}
else
{
Write-Verbose -Message ( @(
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($script:localizedData.UninstallingAdcsOnlineResponderMessage)
) -join '' )
Expand Down Expand Up @@ -204,7 +206,7 @@ function Test-TargetResource
$script:localizedData.TestingAdcsOnlineResponderStatusMessage
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand Down
4 changes: 3 additions & 1 deletion source/DSCResources/DSC_AdcsTemplate/DSC_AdcsTemplate.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsTemplate'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ActiveDirectoryCSDsc.Common' `
-ChildPath 'ActiveDirectoryCSDsc.Common.psm1'))

Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_AdcsWebEnrollment'
$script:localizedData = Get-LocalizedData -DefaultUICulture 'en-US'

<#
.SYNOPSIS
Expand Down Expand Up @@ -61,7 +63,7 @@ function Get-TargetResource
$($script:localizedData.GettingAdcsWebEnrollmentStatusMessage)
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand Down Expand Up @@ -140,7 +142,7 @@ function Set-TargetResource
$($script:localizedData.SettingAdcsWebEnrollmentStatusMessage)
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand Down Expand Up @@ -227,7 +229,7 @@ function Test-TargetResource
$($script:localizedData.TestingAdcsWebEnrollmentStatusMessage -f $CAConfig)
) -join '' )

$adcsParameters = @{} + $PSBoundParameters
$adcsParameters = @{ } + $PSBoundParameters
$null = $adcsParameters.Remove('IsSingleInstance')
$null = $adcsParameters.Remove('Ensure')
$null = $adcsParameters.Remove('Debug')
Expand Down
Loading

0 comments on commit 5e2daad

Please sign in to comment.