Skip to content

Commit 4f02f3c

Browse files
committed
Fix metadata returning semantic versioning
1 parent 5b9d420 commit 4f02f3c

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
@@ -800,10 +800,15 @@ impl Configurator {
800800

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

0 commit comments

Comments
 (0)