ruby-pwsh icon indicating copy to clipboard operation
ruby-pwsh copied to clipboard

Missing invoke params for xprinterport

Open unkinected opened this issue 1 year ago • 0 comments

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

  • Puppet Version: 7.26.0
  • Platform: Windows Server 2022

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.

unkinected avatar Oct 13 '23 15:10 unkinected