puppetlabs / ruby-pwsh

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

Missing invoke params for xprinterport #258

Open unkinected opened 10 months ago

unkinected commented 10 months ago

Describe the Bug

Very similar to issue 105 here, it seems I'm missing some parameters in the @InvokeParams hash that gets passed to Invoke-DscResource. One of these missing parameters is mandatory for the get method of the DSC module and thus my puppet run is failing.

Specifically, here is my invokeparams hash when running puppet in debug mode:

$InvokeParams = @{Name = 'xPrinterPort'; Method = 'get'; Property = @{name = '192.168.252.101'}; ModuleName = @{ModuleName = 'C:/ProgramData/PuppetLabs/puppet/cache/lib/puppet_x/xprintermanagement/dsc_resources/xPrinterManagement/xPrinterManagement.psd1'; RequiredVersion = '1.0.0.2'}}

Here's my manifest (values are made up):

dsc_xprinterport { "192.168.1.1": dsc_name => "192.168.1.1", dsc_ensure => "Present", dsc_printerhostaddress => "192.168.1.1", dsc_type => 'TCP/IP', }

And here are the Get-TargetResource parameters for the xPrinterPort.ps1 file:

` param (

Specifies the name of the printer

    [Parameter(Mandatory)]
    [System.String] $Name,

    ## Specifies the name of the printer driver for the printer
    [Parameter(Mandatory)] [ValidateSet('Local','TCP/IP')]
    [System.String] $Type, 

    ## Specifies whether or not the printer is published in the network directory service
    [Parameter()]
    [System.String] $PrinterHostAddress,       

    [Parameter()] [ValidateSet('Present','Absent')]
    [System.String] $Ensure = 'Present'
)

`

You can see that $Type is mandatory, but it's not being passed into the InvokeParams hash.

Expected Behavior

I would expect the parameters that I specify in my puppet manifest to be passed to the DSC module as necessary.

Environment

I'm hoping this is a simple fix since a very similar issue was also reported, identified, and fixed here: https://github.com/puppetlabs/ruby-pwsh/issues/105.