puppetlabs / ruby-pwsh

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

dsc-sqlserverdsc v 16.4.0-0-0 error #262

Open Hvid opened 1 year ago

Hvid commented 1 year ago

I updated to v16.4.0-0-0 from v16.0.0-0-0 and now i get these errors: Error: dsc_sqlmemory: The term 'Import-SqlDscPreferredModule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Error: dsc_sqlmemory: The term 'Import-SqlDscPreferredModule' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Error: /Stage[main]/Sqlhosting::Server/Dsc_sqlmemory[max_memory]: Could not evaluate: undefined method `[]' for nil:NilClass

Seems that function is not included in the module.

Hvid commented 1 year ago

Correction, it's in SqlServerDsc.psm1. Maybe that file is just not imported?

Hvid commented 1 year ago

Seems this thing broke it: https://github.com/dsccommunity/SqlServerDsc/pull/1826

pmcmaw commented 1 year ago

Hey @Hvid, in this case the only own the wrapper. We currently use Puppet.Dsc to wrap the code on the PowerShell Gallery therefore we have no control over the actual code that we wrap. My suggestion would be to downgrade the module to v16.0.0-0-0 until this is fixed in the Powershell Gallery. When it is fixed in the Powershell Gallery if you request us to republish the module containing the fix from the Powershell Gallery we will have no issues doing this.

Hvid commented 1 year ago

Okay, but this works in powershell, without puppet. Is there any info i can pass on to the owners of the module to make it compatible?

ic248 commented 1 year ago

I'm having exactly the same issue, with dsc-sqlserverdsc v 16.4.0-0-4 and Puppet 8

rismoney commented 12 months ago

So the break-fix for this was to put C:\ProgramData\PuppetLabs\puppet\cache\lib\puppet_x\sqlserverdsc\dsc_resources into the PsmodulesPath environment variable.

I am not sure if this project is setup to include that particular path or not.

jordanbreen28 commented 11 months ago

transferring as fix will go into ruby-pwsh.

jordanbreen28 commented 11 months ago

Released in v1.0.1 of puppetlabs-pwshlib. Running puppet module upgrade puppetlabs-pwshlib will allow you to consume the change. Thanks everyone!

rismoney commented 11 months ago

I don't think the fix is working. I believe I am still getting the error:

dsc_sqllogin: PowerShell DSC resource DSC_SqlLogin failed to execute Get-TargetResource functionality with error message: Failed to find a dependent module.  

The above breakfix seems to still be required for it to function

ic248 commented 11 months ago

I agree @rismoney I get the same error

jordanbreen28 commented 11 months ago

Thanks for the update @rismoney and @ic248 - I'll re-open the issue! This is open-source so happy to accept and collaborate on PRs in the meantime if anyone thinks of a nice way to manipulate the load PSModulePath in ruby-pwsh! Hope to get a proper look at this again shortly.