puppetlabs / ruby-pwsh

A ruby gem for interacting with PowerShell
MIT License
15 stars 23 forks source link

Error when applying dsc_certificateimport and dsc_xhotfix in the same run #203

Closed cpiment closed 1 year ago

cpiment commented 1 year ago

Hi team,

I'm not sure if I have to open this ticket here or on the DSC resources Github repo, so if I should open it on other project please let me know.

I'm trying to apply this puppet file in a Windows Server box:

dsc_certificateimport { "Remove cert from Root":
      dsc_ensure     => 'Absent',
      dsc_thumbprint => '00112233445566778899aabbccddeeff00112233',
      dsc_store      => 'Root',
      dsc_location   => 'LocalMachine',
    }

dsc_xhotfix { 'Powershell 5.1':
      dsc_ensure => 'Present',
      dsc_path   => 'f:/win8.1andw2k12r2-kb3191564-x64.msu',
      dsc_id     => 'KB3191564',
      validation_mode => 'resource',
    }

But it fails with this error:

"Could not find mandatory property Id. Add this property and try again."

However, if I make a file with only the dsc_xhotfix resource, it runs OK. I'm attaching two debug logs, one trying to apply the file with the two resources, and one trying to apply the file with onlye the dsc_xhotfix resource.

ok.log error.log

Thanks in advance for your help.

Versions: OS: Win Server 2012 R2 Powershell version: 5.1 Puppet agent version: 7.21.0 Modules: mod 'puppetlabs-pwshlib', '0.10.3' mod 'dsc-xwindowsupdate', '2.8.0-0-4' mod 'dsc-certificatedsc', '5.1.0-0-2'

cpiment commented 1 year ago

I have been reviewing closed issues and this looks similar to #97

Hvid commented 1 year ago

There is a workaround here: https://github.com/puppetlabs/Puppet.Dsc/issues/242

cpiment commented 1 year ago

Hi @Hvid

Thanks for your suggestion. I have updated my Puppetfile with this content:

mod 'puppetlabs-pwshlib',
  git: 'https://github.com/ShawnHardwick/ruby-pwsh',
  commit: '451de92ef9160277f68112371ab2fa171129ec4c'

and now it does not fail. I'm going to follow the PR you opened to see if this is the definitive solution or something else is needed.