Skip to content

Commit 4e22f07

Browse files
committed
Fix metadata returning semantic versioning
1 parent bdc62b1 commit 4e22f07

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

dsc/src/subcommand.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,6 +319,8 @@ pub fn config(subcommand: &ConfigSubCommand, parameters: &Option<String>, parame
319319
}
320320
};
321321

322+
configurator.context.dsc_version = Some(env!("CARGO_PKG_VERSION").to_string());
323+
322324
if let ConfigSubCommand::Set { what_if , .. } = subcommand {
323325
if *what_if {
324326
configurator.context.execution_type = ExecutionKind::WhatIf;

dsc_lib/src/configure/context.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub struct Context {
2121
pub restart_required: Option<Vec<RestartRequired>>,
2222
pub process_expressions: bool,
2323
pub processing_parameter_defaults: bool,
24+
pub dsc_version: Option<String>,
2425
}
2526

2627
impl Context {
@@ -41,6 +42,7 @@ impl Context {
4142
restart_required: None,
4243
process_expressions: true,
4344
processing_parameter_defaults: false,
45+
dsc_version: None,
4446
}
4547
}
4648
}

dsc_lib/src/configure/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,10 +799,15 @@ impl Configurator {
799799

800800
fn get_result_metadata(&self, operation: Operation) -> Metadata {
801801
let end_datetime = chrono::Local::now();
802+
let version = self
803+
.context
804+
.dsc_version
805+
.clone()
806+
.unwrap_or_else(|| env!("CARGO_PKG_VERSION").to_string());
802807
Metadata {
803808
microsoft: Some(
804809
MicrosoftDscMetadata {
805-
version: Some(env!("CARGO_PKG_VERSION").to_string()),
810+
version: Some(version),
806811
operation: Some(operation),
807812
execution_type: Some(self.context.execution_type.clone()),
808813
start_datetime: Some(self.context.start_datetime.to_rfc3339()),

0 commit comments

Comments
 (0)