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

Use common module DscResource.Common #453

Merged
merged 14 commits into from
May 4, 2020

Conversation

johlju
Copy link
Member

@johlju johlju commented May 2, 2020

Pull Request (PR) description

  • NetworkingDsc
    • Updated to use the common module DscResource.Common.

This Pull Request (PR) fixes the following issues

None.

Task list

  • Added an entry under the Unreleased section of the change log in the CHANGELOG.md.
    Entry should say what was changed, and how that affects users (if applicable).
  • Resource documentation added/updated in README.md in resource folder.
  • Resource parameter descriptions added/updated in schema.mof
    and comment-based help.
  • Comment-based help added/updated.
  • Localization strings added/updated in all localization files as appropriate.
  • Examples appropriately added/updated.
  • Unit tests added/updated. See DSC Resource Testing Guidelines.
  • Integration tests added/updated (where possible). See DSC Resource Testing Guidelines.
  • New/changed code adheres to DSC Resource Style Guidelines and Best Practices.

This change is Reviewable

@johlju johlju added the needs review The pull request needs a code review. label May 2, 2020
@johlju johlju force-pushed the fix/use-dscresource-common branch from e10d450 to a3c522a Compare May 2, 2020 17:19
@johlju johlju requested a review from PlagueHO May 2, 2020 17:43
@johlju
Copy link
Member Author

johlju commented May 2, 2020

@PlagueHO this one is ready for review now.

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great @johlju ! Just some minor tweaks. I'll replicate into other repos when I have a change (have created issues to track).

Reviewed 37 of 37 files at r1.
Reviewable status: all files reviewed, 27 unresolved discussions (waiting on @johlju)


source/DSCResources/DSC_DefaultGatewayAddress/DSC_DefaultGatewayAddress.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

Can you use the $modulePath variable defined above?

Also, is there a need to use a script scoped variable here?

Finally, you could just use the same code pattern as the line above:

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

source/DSCResources/DSC_DnsClientGlobalSetting/DSC_DnsClientGlobalSetting.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_DnsConnectionSuffix/DSC_DnsConnectionSuffix.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_DnsServerAddress/DSC_DnsServerAddress.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_Firewall/DSC_Firewall.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_FirewallProfile/DSC_FirewallProfile.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_HostsFile/DSC_HostsFile.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_IPAddress/DSC_IPAddress.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_IPAddressOption/DSC_IPAddressOption.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterAdvancedProperty/DSC_NetAdapterAdvancedProperty.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterBinding/DSC_NetAdapterBinding.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterLso/DSC_NetAdapterLso.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterName/DSC_NetAdapterName.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterRdma/DSC_NetAdapterRdma.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterRsc/DSC_NetAdapterRsc.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterRss/DSC_NetAdapterRss.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetAdapterState/DSC_NetAdapterState.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetBios/DSC_NetBios.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetConnectionProfile/DSC_NetConnectionProfile.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetIPInterface/DSC_NetIPInterface.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetworkTeam/DSC_NetworkTeam.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_NetworkTeamInterface/DSC_NetworkTeamInterface.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_ProxySettings/DSC_ProxySettings.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_Route/DSC_Route.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_WaitForNetworkTeam/DSC_WaitForNetworkTeam.psm1, line 13 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_WinsServerAddress/DSC_WinsServerAddress.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.


source/DSCResources/DSC_WinsSetting/DSC_WinsSetting.psm1, line 8 at r1 (raw file):

            -ChildPath 'NetworkingDsc.Common.psm1'))

$script:resourceHelperModulePath = Join-Path -Path $PSScriptRoot -ChildPath '..\..\Modules\DscResource.Common'

See previous comments.

@johlju johlju requested a review from PlagueHO May 3, 2020 09:22
Copy link
Member Author

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 9 of 37 files reviewed, 27 unresolved discussions (waiting on @PlagueHO)


source/DSCResources/DSC_DefaultGatewayAddress/DSC_DefaultGatewayAddress.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Can you use the $modulePath variable defined above?

Also, is there a need to use a script scoped variable here?

Finally, you could just use the same code pattern as the line above:

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

Done.


source/DSCResources/DSC_DnsClientGlobalSetting/DSC_DnsClientGlobalSetting.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_DnsConnectionSuffix/DSC_DnsConnectionSuffix.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_DnsServerAddress/DSC_DnsServerAddress.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_Firewall/DSC_Firewall.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_FirewallProfile/DSC_FirewallProfile.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_HostsFile/DSC_HostsFile.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_IPAddress/DSC_IPAddress.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_IPAddressOption/DSC_IPAddressOption.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterAdvancedProperty/DSC_NetAdapterAdvancedProperty.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterBinding/DSC_NetAdapterBinding.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterLso/DSC_NetAdapterLso.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterName/DSC_NetAdapterName.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterRdma/DSC_NetAdapterRdma.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterRsc/DSC_NetAdapterRsc.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterRss/DSC_NetAdapterRss.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetAdapterState/DSC_NetAdapterState.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetBios/DSC_NetBios.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetConnectionProfile/DSC_NetConnectionProfile.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetIPInterface/DSC_NetIPInterface.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetworkTeam/DSC_NetworkTeam.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_NetworkTeamInterface/DSC_NetworkTeamInterface.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_ProxySettings/DSC_ProxySettings.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_Route/DSC_Route.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_WaitForNetworkTeam/DSC_WaitForNetworkTeam.psm1, line 13 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_WinsServerAddress/DSC_WinsServerAddress.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.


source/DSCResources/DSC_WinsSetting/DSC_WinsSetting.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

See previous comments.

Done.

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 9 of 37 files reviewed, 27 unresolved discussions (waiting on @johlju and @PlagueHO)


source/DSCResources/DSC_DefaultGatewayAddress/DSC_DefaultGatewayAddress.psm1, line 8 at r1 (raw file):

Previously, johlju (Johan Ljunggren) wrote…

Done.

Sorry @johlju - I didn't check my example (just freehanded into comment). It should be:

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

This is causing the tests to fail. Sorry about that - my bad.

@johlju johlju requested a review from PlagueHO May 4, 2020 05:16
Copy link
Member Author

@johlju johlju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 9 of 37 files reviewed, 27 unresolved discussions (waiting on @PlagueHO)


source/DSCResources/DSC_DefaultGatewayAddress/DSC_DefaultGatewayAddress.psm1, line 8 at r1 (raw file):

Previously, PlagueHO (Daniel Scott-Raynsford) wrote…

Sorry @johlju - I didn't check my example (just freehanded into comment). It should be:

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

This is causing the tests to fail. Sorry about that - my bad.

Not your fault 😄 I was sitting in front of the TV and just did a search and replace, and didn't even read the code, I just assumed it was correct. 😉 Then pushed and forgot to look at the status checks because was working with stuff in SqlServerDsc at the same time. 🙂

Hopefully it passes now. I will keep an eye on it.

Copy link
Member

@PlagueHO PlagueHO left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Just need to wait for the tests to pass. It looks like they failed because of a problem creating the loopback adapters on the agent.... a bit strange.

Reviewed 28 of 28 files at r2.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@PlagueHO PlagueHO merged commit e260d74 into dsccommunity:master May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs review The pull request needs a code review.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants