Skip to content

Commit 96d865f

Browse files
committed
Change generated export name to only use right side of typename
1 parent ec8fd50 commit 96d865f

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

dsc/tests/dsc_export.tests.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ Describe 'resource export tests' {
4242
$config_with_process_list.metadata.'Microsoft.DSC'.operation | Should -BeExactly 'export'
4343
# contentVersion on export is always 1.0.0
4444
$config_with_process_list.contentVersion | Should -BeExactly '1.0.0'
45+
$config_with_process_list.resources.name | Should -BeLike 'Process-*'
4546
}
4647

4748
It 'Configuration Export can be piped to configuration Set' -Skip:(!$IsWindows) {
@@ -74,7 +75,7 @@ Describe 'resource export tests' {
7475
properties:
7576
pid: 0
7677
'@
77-
$out = $yaml | dsc config export -f - 2>&1
78+
$null = $yaml | dsc config export -f - 2>&1
7879
$LASTEXITCODE | Should -Be 0
7980
}
8081

dsc_lib/src/configure/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,12 @@ pub fn add_resource_export_results_to_configuration(resource: &DscResource, conf
8181
.map(std::string::ToString::to_string)
8282
.ok_or_else(|| DscError::Parser(t!("configure.mod.propertyNotString", name = "_name", value = name).to_string()))?
8383
} else {
84-
format!("{}-{i}", r.resource_type)
84+
let resource_type_short = if let Some(pos) = resource.type_name.rfind('/') {
85+
&resource.type_name[pos + 1..]
86+
} else {
87+
&resource.type_name
88+
};
89+
format!("{}-{i}", resource_type_short)
8590
};
8691
let mut metadata = Metadata {
8792
microsoft: None,

0 commit comments

Comments
 (0)