Skip to content

Module does not work with powershell 5.0 and below #23

@kiprasn

Description

@kiprasn

flush_command = "Set-PSRepository #{@resource[:name]}"

(Probably another file, this is initial investigation)

Because of how the source code is written, it always executes a command with first parameter being the name of the resource.

In the working example you provide it says it should work with powershell 5 and 6 (https://github.com/hbuckle/puppet-powershellmodule/blob/master/README.md), however, it only works with powershell 5.1, with 5.0 it doesn't.

The issue is that the command "Set-PSRepository" doesn't take the first string as a parameter in powershell 5.0. Also, there would be an issue if you were to set a 'name' parameter inside puppet, it errors, because there are 2 name parameters.

Command's Set-PSRepository' required parameter 'name as positional parameter '0' is only introduced in 5.1 as seen here:

https://docs.microsoft.com/en-us/powershell/module/powershellget/set-psrepository?view=powershell-5.0

https://docs.microsoft.com/en-us/powershell/module/powershellget/set-psrepository?view=powershell-5.1

Possible solution is not to include resource name in the flush command, so you would always have to explicitly say the name of the PSRepository and it would work with powershell 5.0 and below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions