This repository was archived by the owner on Jun 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 133
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
Errors with Get/Set-PSRepository on Windows Subsystem for Linux (WSL) #197
Copy link
Copy link
Closed
Description
Expected Behavior
Getting / setting PowerShell repositories should behave the same in WSL as they do in Windows.
Current Behavior
We're getting odd errors getting and setting PowerShell repositories here psake/psake#237 where we are setting the PSGallery repository installation policy to Trusted if needed. This works fine on Windows but in WSL (Ubuntu) it is throwing errors.
In WSL, run Get-PSRepository with no parameters. Works as expected.
PS /> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Untrusted https://www.powershellgallery.com/api/v2/Run Get-PSRepostory -Name PSGallery throws an error.
PS /> Get-PSRepository -Name PSGallery Exception calling "GetIsNetworkAvailable" with "0" argument(s): "An error was encountered while querying information from the operating system."
At /opt/microsoft/powershell/6.0.0-rc/Modules/PowerShellGet/1.5.0.0/PSModule.psm1:6264 char:9
+ $connected = [System.Net.NetworkInformation.NetworkInterface] ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NetworkInformationExceptionRunning Set-PSRepository throws an error but still appears to set the repository to trusted.
PS /> Set-PSRepository -Name PSGallery -InstallationPolicy Trusted Exception calling "GetIsNetworkAvailable" with "0" argument(s): "An error was encountered while querying information from the operating system."
At /opt/microsoft/powershell/6.0.0-rc/Modules/PowerShellGet/1.5.0.0/PSModule.psm1:6264 char:9
+ $connected = [System.Net.NetworkInformation.NetworkInterface] ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : NetworkInformationException
PS /> Get-PSRepository
Name InstallationPolicy SourceLocation
---- ------------------ --------------
PSGallery Trusted https://www.powershellgallery.com/api/v2/Possible Solution
Steps to Reproduce (for bugs)
- Setup WSL and install PowerShell 6.0.0-rc.
- Run
Get-PSRepositorywith no parameters. Works as expected - Run
Get-PSRepository -Name PSGallery. Observe errors - Run
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted. Observe errors
Context
As part of developing and testing the psake project, it would be great if this process worked in WSL as well.
Your Environment
> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-rc
PSEdition Core
GitCommitId v6.0.0-rc
OS Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
> Get-Module -ListAvailable PowerShellGet,PackageManagement
ModuleType Version Name
---------- ------- ----
Script 1.1.7.0 PackageManagement
Script 1.5.0.0 PowerShellGet
> Get-PackageProvider
Name Version
---- -------
NuGet 2.8.5.210
PowerShellGet 1.5.0.0
> Get-PackageProvider -ListAvailable
Name Version
---- -------
NuGet 2.8.5.210
PowerShellGet 1.5.0.0Reactions are currently unavailable