Partial Configuration Bug – module imported twice error

Welcome Forums DSC (Desired State Configuration) Partial Configuration Bug – module imported twice error

Viewing 12 reply threads
  • Author
    Posts
    • #29449
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      I’ve started testing WMF 5 Production Preview against my DSC config that works perfectly with WMF 5 April Preview. To cut a long story short I can no longer apply partial DSC config to a node. Any one of the following errors can appear:

      The resource PSDesiredStateConfiguration from module MSFT_FileDirectoryConfiguration is imported twice using
      version 1.0 and version 0.0. Using more than one version of a resource is not supported. Remove one of the
      versions to correct the problem.

      The resource PSDesiredStateConfiguration from module MSFT_RoleResource is imported twice using version 0.0 and version 1.0. Using more than one version of a resource is not supported. Remove one of the versions to correct the problem.

      The resource PSDesiredStateConfiguration from module MSFT_ScriptResource is imported twice using version 0.0 and version 1.0. Using more than one
      version of a resource is not supported. Remove one of the versions to correct the problem.

      I’ve created some proof of concept code to show how the error can be generated.

      ——— LCMConfig.ps1 snip ————-

      [DSCLocalConfigurationManager()]
      Configuration LCMConfig
      {
      param
      (
      [Parameter(Mandatory = $True)]
      [string]$ComputerName,

      [Parameter(Mandatory = $True)]
      [string]$PullServer,

      [Parameter(Mandatory = $True)]
      [string]$GUID
      )

      Node $ComputerName {

      Settings {
      RefreshMode = “Pull”
      ConfigurationID = $GUID
      RebootNodeIfNeeded = $True
      }

      ConfigurationRepositoryWeb DSCHTTP {
      ServerURL = “http://$($PullServer):8080/PSDSCPullServer.svc”
      AllowUnsecureConnection = $True
      }

      PartialConfiguration PartConfig1
      {
      Description = ‘Test description’
      ConfigurationSource = ‘[ConfigurationRepositoryWeb]DSCHTTP’
      }

      PartialConfiguration PartConfig2
      {
      Description = ‘Test description’
      ConfigurationSource = ‘[ConfigurationRepositoryWeb]DSCHTTP’
      DependsOn = ‘[PartialConfiguration]PartConfig1’
      }
      }
      }

      ——— LCMConfig.ps1 snip ————-

      ——— PartConfig.ps1 snip ————-

      configuration PartConfig1
      {
      Import-DscResource –ModuleName PSDesiredStateConfiguration

      node (“PartConfig1.$GUID”)
      {
      File FriendlyName1
      {
      Ensure = ‘Present’
      DestinationPath = ‘C:\PartConfig1.txt’
      Type = ‘File’
      }
      }
      }

      configuration PartConfig2
      {
      Import-DscResource –ModuleName PSDesiredStateConfiguration

      node (“PartConfig2.$GUID”)
      {
      File FriendlyName2
      {
      Ensure = ‘Present’
      DestinationPath = ‘C:\PartConfig2.txt’
      Type = ‘File’
      }

      Script WDSAnswerPolicy {
      PsDscRunAsCredential = $Credential
      GetScript = {
      @{
      GetScript = $GetScript
      SetScript = $SetScript
      TestScript = $TestScript
      Result = $True
      }
      }

      SetScript = {
      # Do nothing
      }

      TestScript = {
      $True
      }
      }
      }
      }

      ——— PartConfig.ps1 snip ————-

      ——— Run.ps1 snip ————-

      $Node = ‘MyTestNode’
      $PullServer = ‘MyTestPullServer’
      $GUID = ‘b32e5e76-fe9f-4fef-8d58-9ff9d3a268d3’
      $MOFDestPath = ‘C:\Program Files\WindowsPowerShell\DscService\Configuration’

      # Import Functions
      . “$PSScriptRoot\LCMConfig.ps1”
      . “$PSScriptRoot\PartConfig.ps1”

      # Generate MOF files
      $MOFFile = PartConfig1 -OutputPath $MOFDestPath
      New-DscChecksum -Path “$MOFDestPath\$MODFile” -Force

      $MOFFile = PartConfig2 -OutputPath $MOFDestPath
      New-DscChecksum -Path “$MOFDestPath\$MODFile” -Force

      # Generate Meta MOF file
      LCMConfig -ComputerName $Node -PullServer $PullServer -GUID $GUID -OutputPath “$PSScriptRoot\Temp”

      # Send Meta MOF config to Node
      Set-DscLocalConfigurationManager -ComputerName $Node -Path “$PSScriptRoot\Temp” -Verbose

      # Update Configuation
      Update-DscConfiguration -ComputerName $Node -Wait -Verbose

      ——— Run.ps1 snip ————-

    • #29450
      Keymaster
      Topics: 18
      Replies: 4872
      Points: 1,903
      Helping HandTeam Member
      Rank: Community Hero

      Have you reported this to Microsoft?

    • #29451
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      Hi Don, thanks for the quick response. Not yet, but if someone else can confirm they are seeing the same thing in their environment, I’ll post it on Connect.

      This is bug number 3 for me. Hopefully MS can fix the issues before full production is released. This particular bug massive show stopper for me. I haven’t come across anyone else having this issue so I’m hoping it’s just something weird with my environment and the proof of concept example runs perfectly on someone elses environment.

      Partial Conf Bug 1:
      https://connect.microsoft.com/PowerShell/feedback/details/1624273/dsc-partial-configuration-bug-8-config-limit

      Partial Conf Bug 2:
      https://connect.microsoft.com/PowerShell/feedback/details/1515243/if-rebootnodeifneeded-false-and-a-reboot-is-required-partial-configurations-do-not-complete

    • #29452
      Member
      Topics: 9
      Replies: 2322
      Points: 0
      Rank: Member

      What’s in your two partial configuration MOF files? Do they both reference version 0.0?

      We’ve seen some stuff going back and forth about this new “0.0” functionality in the MVP mailing list, and Microsoft has said that DSC is supposed to just import the latest available version of a module when it sees that. However, if a module is already loaded and then it errors out (even though it should just be importing the same, latest available version), then this is a bug that they need to fix.

    • #29453
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      Dave, you’re onto something. The partial config mof files reference different module versions. That has to be bug. Please could you kindly keep us posted on any updates with this from the MVP mailing. It would be much appreciated!

      —–PartConfig1 snip——
      ModuleVersion = “1.0”;
      ConfigurationName = “PartConfig1”;
      };
      —–PartConfig1 snip——

      —–PartConfig2 snip——
      ModuleVersion = “0.0”;
      ConfigurationName = “PartConfig2”;
      };
      —–PartConfig2 snip——

    • #29455
      Member
      Topics: 9
      Replies: 2322
      Points: 0
      Rank: Member

      Hmm, that’s odd. You compiled the MOFs from the same computer, but for some reason they produced different versions in the output. I’ll send a message to the mailing list referencing this thread, and see what comes up.

    • #29456
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      Yeah very strange.

      I modified PartConfig2.mof and changed 0.0 to 1.0, which produced the following error.

      Cannot find module PSDesiredStateConfiguration_1.0 from the server http://s12aumdc01tst01:8080/PSDSCPullServe
      r.svc/Module(ConfigurationId=’b32e5e76-fe9f-4fef-8d58-9ff9d3a268d3′,ModuleName=’PSDesiredStateConfiguration’,
      ModuleVersion=’1.0′)/ModuleContent.
      + CategoryInfo : ResourceUnavailable: (root/Microsoft/…gurationManager:String)

    • #29457
      Member
      Topics: 9
      Replies: 2322
      Points: 0
      Rank: Member

      Try going the other way; change them both to 0.0.

    • #29458
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      Dave, you rock! The DSC configuration continued and the error didn’t appear with the example code in the post.

      I then did a “search and replace” on my production (preview) MOF files (83 hits) and changed all occurrences of ModuleVersion = “1.0”; to ModuleVersion = “0.0”; The DSC partial config is now applying to the node. Dirty as hell but hey it’s a work around.

      Lets hope Microsoft can fix this ASAP. I’ll post the bug up on Connect tomorrow.

    • #29506
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member
    • #29514
      Keymaster
      Topics: 18
      Replies: 4872
      Points: 1,903
      Helping HandTeam Member
      Rank: Community Hero

    • #29516
      Participant
      Topics: 24
      Replies: 111
      Points: 0
      Rank: Member

      Fantastic! Thanks Don. MS are onto it.

    • #31472
      Participant
      Topics: 0
      Replies: 1
      Points: 0
      Rank: Member

      A workaround to problem is import “PSDesiredStateConfiguration” module with version number on all of partial configs.

      Example on my environment Get-DscResouce told that actually right version number is 1.1 and problem disappeared after I forced version number like this:
      Import-DscResource -ModuleName @{ModuleName=”PSDesiredStateConfiguration”;ModuleVersion=”1.1″}

Viewing 12 reply threads
  • The topic ‘Partial Configuration Bug – module imported twice error’ is closed to new replies.