From 83292c6b46c504fe63b5efe15ca2af62aab3edd6 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 20:21:17 +1200 Subject: [PATCH 1/7] Add module conflict tests --- Tests/Integration/ModuleConflict.Tests.ps1 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Tests/Integration/ModuleConflict.Tests.ps1 diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 new file mode 100644 index 00000000..52919774 --- /dev/null +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -0,0 +1,18 @@ +$script:DSCModuleName = 'xNetworking' +$script:ModulesToTest = @( 'xStorage','xCertificate','xComputerManagement' ) +<# + These integration tests ensure that cmdlets names are not conflicting with any other + names that are exposed by the modules. +#> + +Describe "$($script:DSCModuleName)_ModuleConflict" { + + foreach ($moduleToTest in $script:ModulesToTest) + { + It "Should not contain any conlficting cmdlet names with '$moduleToTest'" { + { + Install-Module -Name $moduleToTest -Force + } | Should not throw + } + } +} From 7ae7acd474d94d4e8bdd7204503cb454e5c4b738 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 20:41:55 +1200 Subject: [PATCH 2/7] Added integration test to test for conflicts with other common resource kit modules. --- CHANGELOG.md | 2 + Tests/Integration/ModuleConflict.Tests.ps1 | 51 +++++++++++++++++----- 2 files changed, 42 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e444641..c2b1caa5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +- Added integration test to test for conflicts with other common resource kit modules. + ## 4.0.0.0 - Converted to use AppVeyor.psm1 in DSCResource.Tests repository. diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 index 52919774..ac1848cd 100644 --- a/Tests/Integration/ModuleConflict.Tests.ps1 +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -1,18 +1,47 @@ $script:DSCModuleName = 'xNetworking' -$script:ModulesToTest = @( 'xStorage','xCertificate','xComputerManagement' ) <# - These integration tests ensure that cmdlets names are not conflicting with any other - names that are exposed by the modules. + These integration tests ensure that exported cmdlets names do not conflict + with any other names that are exposed by other common resource kit modules. #> +$script:ModulesToTest = @( 'xStorage','xCertificate','xComputerManagement','xDFS' ) -Describe "$($script:DSCModuleName)_ModuleConflict" { - - foreach ($moduleToTest in $script:ModulesToTest) - { - It "Should not contain any conlficting cmdlet names with '$moduleToTest'" { - { - Install-Module -Name $moduleToTest -Force - } | Should not throw +#region HEADER +# Integration Test Template Version: 1.1.0 +[string] $script:moduleRoot = Join-Path -Path $(Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $Script:MyInvocation.MyCommand.Path))) -ChildPath 'Modules\xNetworking' + +if ( (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests'))) -or ` + (-not (Test-Path -Path (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1'))) ) +{ + & git @('clone','https://github.com/PowerShell/DscResource.Tests.git',(Join-Path -Path $script:moduleRoot -ChildPath '\DSCResource.Tests\')) +} + +Import-Module (Join-Path -Path $script:moduleRoot -ChildPath 'DSCResource.Tests\TestHelper.psm1') -Force +Import-Module (Join-Path -Path $script:moduleRoot -ChildPath "$($script:DSCModuleName).psd1") -Force +$TestEnvironment = Initialize-TestEnvironment ` + -DSCModuleName $script:DSCModuleName ` + -DSCResourceName 'All' ` + -TestType Integration + +#endregion + +# Using try/finally to always cleanup even if something awful happens. +try +{ + Describe "$($script:DSCModuleName)_CommonModuleConflict" { + + foreach ($moduleToTest in $script:ModulesToTest) + { + It "Should not contain any conlficting cmdlet names with '$moduleToTest'" { + { + Install-Module -Name $moduleToTest -Force -ErrorAction Stop + } | Should not throw + } } } } +finally +{ + #region FOOTER + Restore-TestEnvironment -TestEnvironment $TestEnvironment + #endregion +} From a82faced919b962dc8977575983f7513ee3af5ea Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 20:47:25 +1200 Subject: [PATCH 3/7] Attempt to fix new tests --- Tests/Integration/ModuleConflict.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 index ac1848cd..bdda12e0 100644 --- a/Tests/Integration/ModuleConflict.Tests.ps1 +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -33,7 +33,7 @@ try { It "Should not contain any conlficting cmdlet names with '$moduleToTest'" { { - Install-Module -Name $moduleToTest -Force -ErrorAction Stop + Install-Module -Name $moduleToTest -ErrorAction Stop } | Should not throw } } From bbf8b1a7ddbd26c93b61cff7fbbb1fd515e0b127 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 20:57:09 +1200 Subject: [PATCH 4/7] Try to get the tests working --- Tests/Integration/ModuleConflict.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 index bdda12e0..14900e42 100644 --- a/Tests/Integration/ModuleConflict.Tests.ps1 +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -1,7 +1,7 @@ $script:DSCModuleName = 'xNetworking' <# These integration tests ensure that exported cmdlets names do not conflict - with any other names that are exposed by other common resource kit modules. + with any other names that are exposed by other common resource kit modules. #> $script:ModulesToTest = @( 'xStorage','xCertificate','xComputerManagement','xDFS' ) @@ -31,9 +31,9 @@ try foreach ($moduleToTest in $script:ModulesToTest) { - It "Should not contain any conlficting cmdlet names with '$moduleToTest'" { + It "Should be able to install DSC Resource module '$moduleToTest'" { { - Install-Module -Name $moduleToTest -ErrorAction Stop + Install-Module -Name $moduleToTest -Verbose -ErrorAction Stop } | Should not throw } } From d5add0ff731d48320cb9bf638623c463e9ef671f Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 21:20:47 +1200 Subject: [PATCH 5/7] Prevented ResourceHelper and Common module cmdlets from being exported to resolve conflicts with other resource modules. --- CHANGELOG.md | 2 ++ .../MSFT_xDNSServerAddress.psm1 | 13 +++++++++---- .../MSFT_xDefaultGatewayAddress.psm1 | 13 +++++++++---- .../MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 | 13 +++++++++---- .../MSFT_xDnsClientGlobalSetting.psm1 | 13 +++++++++---- .../MSFT_xDnsConnectionSuffix.psm1 | 13 +++++++++---- .../DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 | 13 +++++++++---- .../MSFT_xHostsFile/MSFT_xHostsFile.psm1 | 13 +++++++++---- .../MSFT_xIPAddress/MSFT_xIPAddress.psm1 | 13 +++++++++---- .../MSFT_xNetAdapterBinding.psm1 | 13 +++++++++---- .../MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 | 13 +++++++++---- .../MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 | 13 +++++++++---- .../MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 | 13 +++++++++---- .../DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 | 13 +++++++++---- .../MSFT_xNetConnectionProfile.psm1 | 13 +++++++++---- .../MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 | 13 +++++++++---- .../MSFT_xNetworkTeamInterface.psm1 | 13 +++++++++---- .../DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 | 13 +++++++++---- Modules/xNetworking/xNetworking.psd1 | 2 +- Tests/Integration/ModuleConflict.Tests.ps1 | 4 ++-- 20 files changed, 158 insertions(+), 71 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2b1caa5..42b56db5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ ## Unreleased - Added integration test to test for conflicts with other common resource kit modules. +- Prevented ResourceHelper and Common module cmdlets from being exported to resolve + conflicts with other resource modules. ## 4.0.0.0 diff --git a/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 index 8c0410cf..52cf3c7c 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 index 1c45bb81..ad17afc8 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 index 90f1cae5..c430dcec 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 index 03ef7220..6da58a70 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 index af9dd172..3d2cbc2c 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 b/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 index d1947d3e..9d314923 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 b/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 index ec1c4824..f314317a 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 index 56451fe0..1c6618a7 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 index 7ae18c78..f976c5ac 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 index ab73dff3..7120d4c4 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 index 46708f41..7aca53d3 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 index 5a43fcbf..ce24676c 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 index 7ff2c07a..5016908e 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 index d33a782b..9f188cd0 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 index 00704d41..1fd3ab01 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 index a6cf4a01..74a2680a 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 b/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 index 2ae12fc7..72ff7dd6 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 @@ -1,7 +1,12 @@ -$script:ResourceRootPath = Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) - -# Import the xNetworking Resource Module (to import the common modules) -Import-Module -Name (Join-Path -Path $script:ResourceRootPath -ChildPath 'xNetworking.psd1') +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` + -ChildPath 'NetworkingDsc.Common.psm1')) + +# Import the Networking Resource Helper Module +Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` + -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` + -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) # Import Localization Strings $localizedData = Get-LocalizedData ` diff --git a/Modules/xNetworking/xNetworking.psd1 b/Modules/xNetworking/xNetworking.psd1 index e5294f6a..3502b283 100644 --- a/Modules/xNetworking/xNetworking.psd1 +++ b/Modules/xNetworking/xNetworking.psd1 @@ -29,7 +29,7 @@ FunctionsToExport = '*' # Cmdlets to export from this module CmdletsToExport = '*' -NestedModules = @('Modules\NetworkingDsc.Common\NetworkingDsc.Common.psm1','Modules\NetworkingDsc.ResourceHelper\NetworkingDsc.ResourceHelper.psm1') +# NestedModules = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. PrivateData = @{ diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 index 14900e42..39e25c09 100644 --- a/Tests/Integration/ModuleConflict.Tests.ps1 +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -3,7 +3,7 @@ $script:DSCModuleName = 'xNetworking' These integration tests ensure that exported cmdlets names do not conflict with any other names that are exposed by other common resource kit modules. #> -$script:ModulesToTest = @( 'xStorage','xCertificate','xComputerManagement','xDFS' ) +$script:ModulesToTest = @( 'xStorage','xComputerManagement','xDFS' ) #region HEADER # Integration Test Template Version: 1.1.0 @@ -33,7 +33,7 @@ try { It "Should be able to install DSC Resource module '$moduleToTest'" { { - Install-Module -Name $moduleToTest -Verbose -ErrorAction Stop + Install-Module -Name $moduleToTest -ErrorAction Stop } | Should not throw } } From 475af6c0098911fe5939f58e07e3d5ab6f362b76 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Thu, 1 Jun 2017 21:43:23 +1200 Subject: [PATCH 6/7] Correct path to modules --- .../MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 | 6 ++++-- .../MSFT_xDefaultGatewayAddress.psm1 | 6 ++++-- .../DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 | 6 ++++-- .../MSFT_xDnsClientGlobalSetting.psm1 | 6 ++++-- .../MSFT_xDnsConnectionSuffix.psm1 | 6 ++++-- .../DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 | 6 ++++-- .../DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 | 6 ++++-- .../DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 | 6 ++++-- .../MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 | 6 ++++-- .../MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 | 6 ++++-- .../MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 | 6 ++++-- .../MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 | 8 +++++--- .../DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 | 6 ++++-- .../MSFT_xNetConnectionProfile.psm1 | 6 ++++-- .../DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 | 8 +++++--- .../MSFT_xNetworkTeamInterface.psm1 | 6 ++++-- .../xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 | 6 ++++-- Modules/xNetworking/xNetworking.psd1 | 1 + 18 files changed, 71 insertions(+), 36 deletions(-) diff --git a/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 index 52cf3c7c..770782c6 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDNSServerAddress/MSFT_xDNSServerAddress.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 index ad17afc8..0e1f6e45 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDefaultGatewayAddress/MSFT_xDefaultGatewayAddress.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 index c430dcec..ec6caa9e 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDhcpClient/MSFT_xDhcpClient.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 index 6da58a70..5c69f45c 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDnsClientGlobalSetting/MSFT_xDnsClientGlobalSetting.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 b/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 index 3d2cbc2c..f1ff8323 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xDnsConnectionSuffix/MSFT_xDnsConnectionSuffix.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 b/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 index 9d314923..67cf7762 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xFirewall/MSFT_xFirewall.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 b/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 index f314317a..38acb9e7 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xHostsFile/MSFT_xHostsFile.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 b/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 index 1c6618a7..dfdce215 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xIPAddress/MSFT_xIPAddress.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 index f976c5ac..daf7beae 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterBinding/MSFT_xNetAdapterBinding.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 index 7120d4c4..73ee69b7 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterLso/MSFT_xNetAdapterLso.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 index 7aca53d3..b0b5d6a4 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterName/MSFT_xNetAdapterName.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 index ce24676c..22764593 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetAdapterRDMA/MSFT_xNetAdapterRDMA.psm1 @@ -1,10 +1,12 @@ -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 index 5016908e..290716ee 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetBIOS/MSFT_xNetBIOS.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 index 9f188cd0..c0a4b300 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetConnectionProfile/MSFT_xNetConnectionProfile.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 index 1fd3ab01..5fd611ed 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeam/MSFT_xNetworkTeam.psm1 @@ -1,10 +1,12 @@ -# Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + +# Import the Networking Common Modules +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 index 74a2680a..4a681dda 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xNetworkTeamInterface/MSFT_xNetworkTeamInterface.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 b/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 index 72ff7dd6..0dedecd8 100644 --- a/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 +++ b/Modules/xNetworking/DSCResources/MSFT_xRoute/MSFT_xRoute.psm1 @@ -1,10 +1,12 @@ +$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules' + # Import the Networking Common Modules -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.Common' ` -ChildPath 'NetworkingDsc.Common.psm1')) # Import the Networking Resource Helper Module -Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) ` +Import-Module -Name (Join-Path -Path $modulePath ` -ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' ` -ChildPath 'NetworkingDsc.ResourceHelper.psm1')) diff --git a/Modules/xNetworking/xNetworking.psd1 b/Modules/xNetworking/xNetworking.psd1 index 3502b283..79b048aa 100644 --- a/Modules/xNetworking/xNetworking.psd1 +++ b/Modules/xNetworking/xNetworking.psd1 @@ -29,6 +29,7 @@ FunctionsToExport = '*' # Cmdlets to export from this module CmdletsToExport = '*' +# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess # NestedModules = @() # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. From e7d5f9aaf3859a383ec663e7702295ae6b66cdf2 Mon Sep 17 00:00:00 2001 From: Daniel Scott-Raynsford Date: Fri, 2 Jun 2017 08:09:13 +1200 Subject: [PATCH 7/7] Changes as per PR comments --- Tests/Integration/ModuleConflict.Tests.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/Integration/ModuleConflict.Tests.ps1 b/Tests/Integration/ModuleConflict.Tests.ps1 index 39e25c09..3ca997c1 100644 --- a/Tests/Integration/ModuleConflict.Tests.ps1 +++ b/Tests/Integration/ModuleConflict.Tests.ps1 @@ -34,7 +34,7 @@ try It "Should be able to install DSC Resource module '$moduleToTest'" { { Install-Module -Name $moduleToTest -ErrorAction Stop - } | Should not throw + } | Should Not Throw } } }