Skip to content

Commit 66081c6

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
address copilot feedback
1 parent 4ecd78e commit 66081c6

3 files changed

Lines changed: 12 additions & 21 deletions

File tree

dsc/tests/dsc_resource_list.tests.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Describe 'Tests for listing resources' {
3838
) {
3939
param($tags, $description, $expectedCount, $expectedType)
4040

41+
$oldPath = $env:DSC_RESOURCE_PATH
4142
try {
4243
# Need to restrict the search as more resources are being added like from PS7
4344
$env:DSC_RESOURCE_PATH = Split-Path (Get-Command dsc).Source -Parent
@@ -58,7 +59,7 @@ Describe 'Tests for listing resources' {
5859
$resources.type | Should -BeExactly $expectedType
5960
}
6061
} finally {
61-
$env:DSC_RESOURCE_PATH = $null
62+
$env:DSC_RESOURCE_PATH = $oldPath
6263
}
6364
}
6465

@@ -142,8 +143,8 @@ Describe 'Tests for listing resources' {
142143
}
143144
}
144145
'@
145-
$manifestPath = Join-Path $TestDrive "echoDupeManifest.json"
146-
$manifestDupePath = Join-Path $TestDrive "echoDupeManifestDuplicate.json"
146+
$manifestPath = Join-Path $TestDrive "echoDupeManifest.dsc.resource.json"
147+
$manifestDupePath = Join-Path $TestDrive "echoDupeManifestDuplicate.dsc.resource.json"
147148
Set-Content -Path $manifestPath -Value $resource_manifest
148149
Set-Content -Path $manifestDupePath -Value $resource_manifest
149150

extensions/appx/appx.dsc.extension.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"type": "Microsoft.Windows.Appx/Discover",
44
"version": "0.1.0",
55
"description": "Discovers DSC resources packaged as Appx packages.",
6-
"condition": "[not(equals(tryWhich('pwsh'), null()))]",
76
"discover": {
87
"executable": "powershell",
98
"args": [

lib/dsc-lib/src/discovery/mod.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,25 +81,16 @@ impl Discovery {
8181
};
8282

8383
for (_resource_name, found_resources) in discovered_resources {
84-
'manifests: for manifest in found_resources {
85-
match manifest {
86-
ImportedManifest::Resource(ref resource) => {
87-
let key = format!("{}@{}", resource.type_name, resource.version);
88-
if resources.contains_key(&key) {
89-
continue 'manifests; // if we already have this resource, we can skip it
90-
} else {
91-
resources.insert(key, manifest.clone());
92-
}
84+
for manifest in found_resources {
85+
let key = match &manifest {
86+
ImportedManifest::Resource(resource) => {
87+
format!("{}@{}", resource.type_name.to_lowercase(), resource.version)
9388
},
94-
ImportedManifest::Extension(ref extension) => {
95-
let key = format!("{}@{}", extension.type_name, extension.version);
96-
if resources.contains_key(&key) {
97-
continue 'manifests; // if we already have this extension, we can skip it
98-
} else {
99-
resources.insert(key, manifest.clone());
100-
}
89+
ImportedManifest::Extension(extension) => {
90+
format!("{}@{}", extension.type_name.to_lowercase(), extension.version)
10191
}
102-
}
92+
};
93+
resources.insert(key, manifest);
10394
}
10495
};
10596

0 commit comments

Comments
 (0)