Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit bb9d54d

Browse files
committed
2 parents 2c492ef + cb0aa70 commit bb9d54d

27 files changed

+2590
-10
lines changed

DSC/DSCResources/MSFT_PSModule/MSFT_PSModule.psm1 renamed to DSC/DscResources/MSFT_PSModule/MSFT_PSModule.psm1

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ function Get-TargetResource {
146146
# Check if the repository matches.
147147
$repositoryName = Get-ModuleRepositoryName -Module $latestModule -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
148148

149-
$installationPolicy = Get-InstallationPolicy -RepositoryName $repositoryName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
149+
if ($repositoryName) {
150+
$installationPolicy = Get-InstallationPolicy -RepositoryName $repositoryName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
151+
}
152+
150153
if ($installationPolicy) {
151154
$installationPolicyReturnValue = 'Trusted'
152155
}
@@ -389,7 +392,7 @@ function Set-TargetResource {
389392
$extractedArguments = New-SplatParameterHashTable -FunctionBoundParameters $PSBoundParameters `
390393
-ArgumentNames ('MinimumVersion', 'MaximumVersion', 'RequiredVersion')
391394

392-
Test-VersionParameter @extractedArguments
395+
$null = Test-VersionParameter @extractedArguments
393396

394397
try {
395398
$extractedArguments = New-SplatParameterHashTable -FunctionBoundParameters $PSBoundParameters `
@@ -426,7 +429,7 @@ function Set-TargetResource {
426429
# Extract the installation options.
427430
$extractedSwitches = New-SplatParameterHashTable -FunctionBoundParameters $PSBoundParameters -ArgumentNames ('Force', 'AllowClobber', 'SkipPublisherCheck')
428431

429-
$moduleFound | Install-Module @extractedSwitches
432+
$moduleFound | Install-Module @extractedSwitches 2>&1 | out-string | Write-Verbose
430433
}
431434
# The repository is untrusted but user's installation policy is trusted, so we install it with a warning.
432435
elseif ($InstallationPolicy -ieq 'Trusted') {
@@ -436,7 +439,7 @@ function Set-TargetResource {
436439
$extractedSwitches = New-SplatParameterHashTable -FunctionBoundParameters $PSBoundParameters -ArgumentNames ('AllowClobber', 'SkipPublisherCheck')
437440

438441
# If all the repositories are untrusted, we choose the first one.
439-
$modules[0] | Install-Module @extractedSwitches -Force
442+
$modules[0] | Install-Module @extractedSwitches -Force 2>&1 | out-string | Write-Verbose
440443
}
441444
# Both user and repository is untrusted
442445
else {

Tests/PSGetFindModule.Tests.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,7 @@ Describe "Azure Artifacts Credential Provider Integration" -Tags 'BVT' {
613613
UnRegister-PSRepository -Name $repoName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
614614
}
615615

616-
it "Register-PackageSource using Visual Studio installed credential provider" -Skip:(!$VSinstalledCredProvider -or !$IsWindows) {
616+
it "Register-PackageSource using Visual Studio installed credential provider" -Skip:(!$VSinstalledCredProvider) {
617617
Register-PSRepository $repoName -SourceLocation $testLocation
618618

619619
(Get-PSRepository -Name $repoName).Name | should match $repoName

src/PowerShellGet/PowerShellGet.psd1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@{
22
RootModule = 'PSModule.psm1'
3-
ModuleVersion = '2.2'
3+
ModuleVersion = '2.2.1'
44
GUID = '1d73a601-4a6c-43c5-ba3f-619b18bbb404'
55
Author = 'Microsoft Corporation'
66
CompanyName = 'Microsoft Corporation'
@@ -41,7 +41,7 @@
4141
FileList = @('PSModule.psm1',
4242
'PSGet.Format.ps1xml',
4343
'PSGet.Resource.psd1')
44-
RequiredModules = @(@{ModuleName = 'PackageManagement'; ModuleVersion = '1.4' })
44+
RequiredModules = @(@{ModuleName = 'PackageManagement'; ModuleVersion = '1.4.4' })
4545
PrivateData = @{
4646
"PackageManagementProviders" = 'PSModule.psm1'
4747
"SupportedPowerShellGetFormatVersions" = @('1.x', '2.x')
@@ -55,6 +55,11 @@
5555
ProjectUri = 'https://go.microsoft.com/fwlink/?LinkId=828955'
5656
LicenseUri = 'https://go.microsoft.com/fwlink/?LinkId=829061'
5757
ReleaseNotes = @'
58+
### 2.2.1
59+
Bug Fix
60+
61+
- Allow DscResources to work on case sensitive platforms (#521)
62+
- Fix for failure to return credential provider when using private feeds (#521)
5863
5964
## 2.2
6065
Bug Fix

src/PowerShellGet/public/psgetfunctions/Get-CredsFromCredentialProvider.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ function Get-CredsFromCredentialProvider {
4343
}
4444
else {
4545
# Option 1b) Find User-location - The NuGet Home location - %UserProfile%/.nuget/plugins/
46-
$path = "`"$env:UserProfile/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll`"";
46+
$path = "$($env:UserProfile)/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll";
4747

4848
if ($script:IsLinux -or $script:IsMacOS) {
49-
$path = "`"$HOME/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll`"";
49+
$path = "$($HOME)/.nuget/plugins/netcore/CredentialProvider.Microsoft/CredentialProvider.Microsoft.dll";
5050
}
5151
if (Test-Path $path -PathType Leaf) {
5252
$credProviderPath = $path
@@ -68,7 +68,7 @@ function Get-CredsFromCredentialProvider {
6868
return $null
6969
}
7070

71-
$vswhereExePath = "`"$programFiles\\Microsoft Visual Studio\\Installer\\vswhere.exe`""
71+
$vswhereExePath = "$($programFiles)\\Microsoft Visual Studio\\Installer\\vswhere.exe"
7272
if (!(Test-Path $vswhereExePath -PathType Leaf)) {
7373
return $null
7474
}

v3prototype/Find-PSResource.ps1

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
# Replaces: Find-Command, Find-DscResource, Find-Module, Find-RoleCapability, Find-Script
2+
# Parameter Sets: ResourceParameterSet, PackageParameterSet, ScriptParameterSet
3+
4+
# Find-Command returns an object with properties: Name, Version, ModuleName, Repository
5+
# Find-DSCResource returns an object with properties: Name, Version, ModuleName, Repository
6+
# Find-RoleCapability returns an object with properties: Name, Version, ModuleName, Repository
7+
8+
# Find-Module returns an object with properties: Version, Name, Repository, Description
9+
# Find-Script returns an object with properties: Version, Name, Repository, Description
10+
11+
function Find-PSResource {
12+
[OutputType([PSCustomObject[]])]
13+
[Cmdletbinding(SupportsShouldProcess = $true)]
14+
Param
15+
(
16+
# Specifies the name of the resource to be searched for.
17+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
18+
[Parameter(ValueFromPipeline = $true,
19+
ValueFromPipelineByPropertyName = $true,
20+
Position = 0)]
21+
[ValidateNotNullOrEmpty()]
22+
[string[]]
23+
$Name,
24+
25+
# Specifies the type of the resource being searched.
26+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
27+
[Parameter(ValueFromPipelineByPropertyName = $true)]
28+
[ValidateSet('Module', 'Script', 'DscResource', 'RoleCapability', 'Command')]
29+
[string[]]
30+
$Type,
31+
32+
# Specifies the module name that contains the resource.
33+
# Resources that use this param: Command, DSCResource, RoleCapability.
34+
[Parameter(ParameterSetName = "ResourceParameterSet")]
35+
[ValidateNotNullOrEmpty()]
36+
[string]
37+
$ModuleName,
38+
39+
# Specifies the minimum version of the resource to include in results (cannot use this parameter with the RequiredVersion or AllVersions parameters).
40+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
41+
[Parameter(ValueFromPipelineByPropertyName = $true)]
42+
[ValidateNotNull()]
43+
[string]
44+
$MinimumVersion,
45+
46+
# Specifies the maximum version of the resource to include in results (cannot use this parameter with the RequiredVersion or AllVersions parameters).
47+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
48+
[Parameter(ValueFromPipelineByPropertyName = $true)]
49+
[ValidateNotNull()]
50+
[string]
51+
$MaximumVersion,
52+
53+
# Specifies the required version of the resource to include in results (cannot use this parameter with the MinimumVersion, MaximumVersion, or AllVersions parameters).
54+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
55+
[Parameter(ValueFromPipelineByPropertyName = $true)]
56+
[ValidateNotNull()]
57+
[string]
58+
$RequiredVersion,
59+
60+
# Displays each of a resource's available versions (cannot use this parameter with the MinimumVersion, MaximumVersion, or RequiredVersion parameters).
61+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
62+
[Parameter()]
63+
[switch]
64+
$AllVersions,
65+
66+
# Includes resources marked as a prerelease.
67+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
68+
[Parameter()]
69+
[switch]
70+
$Prerelease,
71+
72+
# Specifies tags that categorize modules in a repository.
73+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
74+
[Parameter()]
75+
[ValidateNotNull()]
76+
[string[]]
77+
$Tag,
78+
79+
# Finds resources based on ModuleName, Description, and Tag properties.
80+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
81+
[Parameter()]
82+
[ValidateNotNull()]
83+
[string]
84+
$Filter,
85+
86+
# Specifies a proxy server for the request, rather than a direct connection to the internet resource.
87+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
88+
[Parameter(ValueFromPipelineByPropertyName = $true)]
89+
[ValidateNotNullOrEmpty()]
90+
[Uri]
91+
$Proxy,
92+
93+
# Specifies a user account that has permission to use the proxy server that is specified by the Proxy parameter.
94+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
95+
[Parameter(ValueFromPipelineByPropertyName = $true)]
96+
[PSCredential]
97+
$ProxyCredential,
98+
99+
# Specifies the repository to search within (default is all repositories).
100+
# Resources that use this param: Command, DSCResource, RoleCapability, Package, Script.
101+
[Parameter()]
102+
[ValidateNotNullOrEmpty()]
103+
[string[]]
104+
$Repository,
105+
106+
# Specifies a user account that has rights to find a resource from a specific repository.
107+
# Resources that use this param: Package, Script.
108+
[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = "PackageParameterSet")]
109+
[Parameter(ValueFromPipelineByPropertyName = $true, ParameterSetName = "ScriptParameterSet")]
110+
[PSCredential]
111+
$Credential,
112+
113+
# Specifies to include all modules that are dependent upon the module specified in the Name parameter.
114+
# Resources that use this param: Package, Script.
115+
[Parameter(ParameterSetName = "PackageParameterSet")]
116+
[Parameter(ParameterSetName = "ScriptParameterSet")]
117+
[switch]
118+
$IncludeDependencies,
119+
120+
# Returns only those modules that include specific kinds of PowerShell functionality. For example, you might only want to find modules that include DSCResource.
121+
# The acceptable values for this parameter are as follows:
122+
# Module: DscResource, Cmdlet, Function, RoleCapability;
123+
# Scripts: Function, Workflow;
124+
# Resources that use this param: Package, Script.
125+
[Parameter(ParameterSetName = "PackageParameterSet")]
126+
[Parameter(ParameterSetName = "ScriptParameterSet")]
127+
[ValidateNotNull()]
128+
[ValidateSet('DscResource', 'Cmdlet', 'Function', 'RoleCapability', 'Workflow')]
129+
[string[]]
130+
$Includes,
131+
132+
# Specifies the name of the DSC resources contained within a module (per PowerShell conventions, performs an OR search when you provide multiple arguments).
133+
# Resources that use this param: Package.
134+
[Parameter(ParameterSetName = "PackageParameterSet")]
135+
[ValidateNotNull()]
136+
[string[]]
137+
$DscResource,
138+
139+
# Specifies the name of the role capabilities contained within a module (per PowerShell conventions, performs an OR search when you provide multiple arguments).
140+
# Resources that use this param: Package.
141+
[Parameter(ParameterSetName = "PackageParameterSet")]
142+
[ValidateNotNull()]
143+
[string[]]
144+
$RoleCapability,
145+
146+
# Specifies commands to find in modules (command can be a function or workflow).
147+
# Resources that use this param: Package, Script.
148+
[Parameter(ParameterSetName = "PackageParameterSet")]
149+
[Parameter(ParameterSetName = "ScriptParameterSet")]
150+
[ValidateNotNull()]
151+
[string[]]
152+
$Command
153+
154+
)
155+
156+
begin {
157+
# For each repository, if local cache does not exist then Update-PSResourceCache
158+
}
159+
process {
160+
161+
# Returning the array of resources
162+
$foundResources
163+
164+
foreach ($n in $name) {
165+
166+
if ($pscmdlet.ShouldProcess($n)) {
167+
168+
$PSResource = [PSCustomObject] @{
169+
Name = $Name
170+
Version = "placeholder-for-module-version"
171+
Type = $Type
172+
Description = "placeholder-for-description"
173+
}
174+
175+
$foundResources += $PSResource
176+
}
177+
}
178+
179+
return $foundResources
180+
}
181+
end { }
182+
}

0 commit comments

Comments
 (0)