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

install_options proxy not working #25

Open
TomG83 opened this issue Nov 5, 2020 · 0 comments
Open

install_options proxy not working #25

TomG83 opened this issue Nov 5, 2020 · 0 comments

Comments

@TomG83
Copy link

TomG83 commented Nov 5, 2020

I'm using the parameter on a node that has nog direct internet access but can use our proxy server

package { 'Posh-ACME':
	ensure          => latest,
	provider        => 'windowspowershell',
	source          => 'PSGallery',
	install_options => [ '-AllowClobber',
			{ '-proxy' => 'http://myproxy.mydomain.be:8080' } ]
}

which returns the error:

Error: Could not prefetch package provider 'windowspowershell': 751: unexpected token at 'WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»'
Error: Failed to apply catalog: 751: unexpected token at 'WARNING: MSG:UnableToDownload «https://go.microsoft.com/fwlink/?LinkID=627338&clcid=0x409» «»'

When I install the module by hand:

Install-Module -Proxy "http://myproxy.mydomain.be:8080" -Name Posh-ACME

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install
the modules from 'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): y

Everything works well. Upon consecutive Puppet agent run's after the module was installed by hand as in example above:

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'; $mod = Find-Module Posh-ACME; $mod.Version.ToString()' returned 1: WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'Posh-ACME'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1397 char:3
+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage
Error: /Stage[main]/Base_software_win::Manage_ps_modules/Package[Posh-ACME]/ensure: change from ['3.17.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'; $mod = Find-Module Posh-ACME; $mod.Version.ToString()' returned 1: WARNING: Unable to resolve package source 'https://www.powershellgallery.com/api/v2'.
PackageManagement\Find-Package : No match was found for the specified search criteria and module name 'Posh-ACME'. Try Get-PSRepository to see all available registered module repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1397 char:3
+         PackageManagement\Find-Package @PSBoundParameters | Microsoft ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power...ets.FindPackage:FindPackage) [Find-Package], Exception
    + FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageManagement.Cmdlets.FindPackage

When using same resource without install_options on a node that has direct internet access, installation works just fine.

Am I missing something here?

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

No branches or pull requests

1 participant