puppetlabs / puppetlabs/ruby-pwsh

Missing invoke params for xprinterport

Open
#258 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Ruby
Stars
20
Forks
27
Avg merge
1d 7h
Merged PRs (30d)
4

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing construction of the $InvokeParams hash before Invoke-DscResource and compare the behavior described in issue 105. Reproduce with the xPrinterPort resource and confirm manifest properties, including Type, reach the DSC Get-TargetResource call. Done means required parameters are forwarded and a regression test covers this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, ruby
Domain
devops, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.