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

Proxy Support #8

Closed
sebastianzolg opened this issue May 25, 2017 · 5 comments · Fixed by #15
Closed

Proxy Support #8

sebastianzolg opened this issue May 25, 2017 · 5 comments · Fixed by #15

Comments

@sebastianzolg
Copy link

sebastianzolg commented May 25, 2017

When using ChocolateyGet behind a proxy server, in some situations its not working.
While choco.exe can be easily configured to use a proxy https://github.com/chocolatey/choco/wiki/Proxy-Settings-for-Chocolatey#explicit-proxy-settings, the ChocolateyGet Module can't.

Function Install-ChocoBinaries uses Invoke-WebRequest at some point, which doesn't work behind a proxy server per default. While this is not a big deal when using ChocolateyGet in normal PS1 Scripts, as we can set the proxy using [system.net.webrequest]::defaultwebproxy globally, this is not possible when using ChocolateyGet within a PowerShell DSC Configuration as LCM has no option to set a proxy, as far as I know.

That means, there is no way to make it work within a DSC Configuration behind a proxy.

Recommendation: Allow the ChocolateyGet Module to receive AdditionalParameters, so it can be set using the same approach as other package providers, e.g. NuGet https://github.com/PowerShell/PackageManagementProviderResource/blob/master/Examples/Sample_Install_Package_Using_NuGet.ps1 > Note the AdditionalParameters Dictionary, that can be passed.

thanks

@sebastianzolg
Copy link
Author

What do you think ?

@jianyunt
Copy link
Owner

@BenAffleckIsBatman thanks for your suggestions. Your are right, the PackageManagement DSC takes additionalparameters that can be passed down to its providers. And the providers need to implement to take these parameters in install-package, save-package etc. In the ChocolateyGet case, are you thinking to add proxyurl, proxy url, proxyCredential?

Also I am open to take PR. Do you have any bandwidth to do so?

@sebastianzolg
Copy link
Author

@jianyunt I would love to help. Put that on my list. I struggled with a good debug setup for these situations. I asked on StackOverflow a while ago. Could you answer it and tell something about the best way to debug & unit test? Specially how to construct the PackageManagement object passed down to the implementation. Any advise ?

@jianyunt
Copy link
Owner

Just posted it in StackOverflow. I created it a while back using ISE.
Also there are some information that may be useful to you in the wiki in oneget.org

ethanbergstrom added a commit to ethanbergstrom/ChocolateyGet that referenced this issue Jan 2, 2020
Make builds and tests more robus to previous failures/kills
@ethanbergstrom
Copy link
Collaborator

@sebastianzolg my pull request (#15) introduces default behavior that invokes Chocolatey's native API that's bundled into the provider, so it no longer tries to install / upgrade choco.exe unless API support is expressly disabled or used with PowerShell 7+, which should alleviate the need to pass in proxy settings for downloading Choco.exe through DSC arguments.

@ethanbergstrom ethanbergstrom linked a pull request Oct 6, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants