Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found when 'Source' is not specified #13

Closed
pauby opened this issue Jun 4, 2020 · 1 comment · Fixed by #18
Closed

Module not found when 'Source' is not specified #13

pauby opened this issue Jun 4, 2020 · 1 comment · Fixed by #18

Comments

@pauby
Copy link

pauby commented Jun 4, 2020

When using this in the Puppet file:

pspackageprovider { 'Nuget':
  ensure   => 'present',
  provider => 'windowspowershell',
}

psrepository { 'PSGallery':
  ensure              => present,
  source_location     => 'https://www.powershellgallery.com/api/v2',
  installation_policy => 'trusted',
}

package { 'NexusManagement':
  ensure   => latest,
  provider => 'windowspowershell',
}

I get this error:

Error: Could not get latest version: Execution of 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.EXE -NoProfile -ExecutionPolicy Bypass -NonInteractive -NoLogo -Command $ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $mod = Find-Module NexusManagement -Repository ; $mod.Version.ToString()' returned 1: Find-Module : Missing an argument for parameter 'Repository'. Specify a parameter of type 'System.String[]' and try
again.
At line:1 char:241
+ ... lType]::Tls12; $mod = Find-Module NexusManagement -Repository ; $mod. ...
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Find-Module], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument,Find-Module
Error: /Stage[main]/Main/Package[NexusManagement]/ensure: change from ['0.2.0'] to 'latest' failed: Could not get latest version: Execution of 'C:/Windows/System32/WindowsPowerShell/v1.0/powershell.EXE -NoProfile -ExecutionPolicy Bypass -NonInteractive -NoLogo -Command $ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; $mod = Find-Module NexusManagement -Repository ; $mod.Version.ToString()' returned 1: Find-Module : Missing an argument for parameter 'Repository'. Specify a parameter of type 'System.String[]' and try
again.
At line:1 char:241
+ ... lType]::Tls12; $mod = Find-Module NexusManagement -Repository ; $mod. ...
+                                                       ~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Find-Module], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : MissingArgument,Find-Module

The instructions indicate that You do not need to specify the PSGallery with the psrepository type but this doesn't appear to be the case.

If I add 'Source' then it works as it should:

package { 'NexusManagement':
  ensure   => latest,
  source => 'PSGallery',
  provider => 'windowspowershell',
}

I haven't dug into the code but it's clear from the errors that the default source 'PSGallery' is not being passed through.

@nmaludy
Copy link
Member

nmaludy commented Oct 28, 2020

@gsperry2011 can you look into this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants