Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert to use DSCResource.Common Module #334

Merged
merged 9 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- ComputerManagementDsc
- Updated to use the common module _DscResource.Common_ - Fixes [Issue #327](https://github.com/dsccommunity/ComputerManagementDsc/issues/327).
- Fixed build failures caused by changes in `ModuleBuilder` module v1.7.0
by changing `CopyDirectories` to `CopyPaths` - Fixes [Issue #332](https://github.com/dsccommunity/ComputerManagementDsc/issues/332).

## [8.2.0] - 2020-05-05

### Changed
Expand Down
1 change: 1 addition & 0 deletions RequiredModules.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
'DscResource.Test' = 'latest'
'DscResource.AnalyzerRules' = 'latest'
'DscResource.DocGenerator' = 'latest'
'DscResource.Common' = 'latest'
xDscResourceDesigner = 'latest'
LoopbackAdapter = 'latest'
}
16 changes: 15 additions & 1 deletion 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 @@ -47,6 +58,7 @@ BuildWorkflow:
Pester:
OutputFormat: NUnitXML
ExcludeFromCodeCoverage:
- Modules/DscResource.Common
Script:
- tests/Unit
ExcludeTag:
Expand All @@ -59,6 +71,8 @@ DscTest:
- 'Common Tests - New Error-Level Script Analyzer Rules'
ExcludeSourceFile:
- output
ExcludeModuleFile:
- Modules/DscResource.Common

Resolve-Dependency:
Gallery: 'PSGallery'
Expand Down
6 changes: 4 additions & 2 deletions source/DSCResources/DSC_Computer/DSC_Computer.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_Computer'
$script:localizedData = Get-LocalizedData

$FailToRenameAfterJoinDomainErrorId = 'FailToRenameAfterJoinDomain,Microsoft.PowerShell.Commands.AddComputerCommand'

Expand Down Expand Up @@ -265,7 +267,7 @@ function Set-TargetResource
}
else
{
New-InvalidOperationException -ErrorRecord $_
New-InvalidOperationException -Message $_.Exception.Message -ErrorRecord $_
}
}
catch
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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_IEEnhancedSecurityConfiguration'
$script:localizedData = Get-LocalizedData

$script:registryKey_Administrators = 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}'
$script:registryKey_Users = 'HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_OfflineDomainJoin'
$script:localizedData = Get-LocalizedData

<#
.SYNOPSIS
Expand Down
10 changes: 6 additions & 4 deletions source/DSCResources/DSC_PendingReboot/DSC_PendingReboot.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_PendingReboot'
$script:localizedData = Get-LocalizedData

<#
This data file contains a list of reboot triggers that will be checked
when determining if reboot is required. This is stored in a separate
data file so that it can also be used in testing.
#>
$script:localizedResourceData = Get-LocalizedData `
-ResourceName 'DSC_PendingReboot' `
-Postfix 'data'
$script:localizedResourceData = Import-LocalizedData `
-BaseDirectory $PSScriptRoot `
-FileName 'DSC_PendingReboot.data.psd1'
$script:rebootTriggers = $script:localizedResourceData.RebootTriggers
<#
.SYNOPSIS
Expand Down
4 changes: 3 additions & 1 deletion source/DSCResources/DSC_PowerPlan/DSC_PowerPlan.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_PowerPlan'
$script:localizedData = Get-LocalizedData

<#
.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_PowershellExecutionPolicy'
$script:localizedData = Get-LocalizedData

<#
.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_RemoteDesktopAdmin'
$script:localizedData = Get-LocalizedData

$script:tSRegistryKey = 'HKLM:\System\CurrentControlSet\Control\Terminal Server'
$script:winStationsRegistryKey = 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp'
Expand Down
4 changes: 3 additions & 1 deletion source/DSCResources/DSC_ScheduledTask/DSC_ScheduledTask.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_ScheduledTask'
$script:localizedData = Get-LocalizedData

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

# Import the ComputerManagementDsc Resource Helper Module
Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_SmbServerConfiguration'
$script:localizedData = Get-LocalizedData

$resourceData = Import-LocalizedData `
-BaseDirectory $PSScriptRoot `
Expand Down
7 changes: 2 additions & 5 deletions source/DSCResources/DSC_SmbShare/DSC_SmbShare.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1')) -Force

# Import the ComputerManagementDsc Resource Helper Module
Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_SmbShare'
$script:localizedData = Get-LocalizedData

<#
.SYNOPSIS
Expand Down
7 changes: 2 additions & 5 deletions source/DSCResources/DSC_SystemLocale/DSC_SystemLocale.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1')) -Force

# Import the ComputerManagementDsc Resource Helper Module
Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))
Import-Module -Name (Join-Path -Path $modulePath -ChildPath 'DscResource.Common')

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_SystemLocale'
$script:localizedData = Get-LocalizedData

<#
.SYNOPSIS
Expand Down
4 changes: 3 additions & 1 deletion source/DSCResources/DSC_TimeZone/DSC_TimeZone.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings.
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_TimeZone'
$script:localizedData = Get-LocalizedData

<#
.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_UserAccountControl'
$script:localizedData = Get-LocalizedData

$script:registryKey = 'HKLM:\HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System'

Expand Down
4 changes: 3 additions & 1 deletion source/DSCResources/DSC_VirtualMemory/DSC_VirtualMemory.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_VirtualMemory'
$script:localizedData = Get-LocalizedData

<#
.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_WindowsCapability'
$script:localizedData = Get-LocalizedData

<#
.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 'ComputerManagementDsc.Common' `
-ChildPath 'ComputerManagementDsc.Common.psm1'))

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

# Import Localization Strings
$script:localizedData = Get-LocalizedData -ResourceName 'DSC_WindowsEventLog'
$script:localizedData = Get-LocalizedData

<#
.SYNOPSIS
Expand Down
Loading