Skip to content

Commit 63b253f

Browse files
committed
Fix progress display when using JSON, add None option; exhance progress schema
1 parent 905608a commit 63b253f

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

dsc/Cargo.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dsc_lib/src/configure/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ impl Configurator {
254254
match &get_result {
255255
GetResult::Resource(resource_result) => {
256256
self.context.references.insert(format!("{}:{}", resource.resource_type, resource.name), serde_json::to_value(&resource_result.actual_state)?);
257+
progress.set_resource(&resource.name, &resource.resource_type, Some(&resource_result.actual_state));
257258
},
258259
GetResult::Group(group) => {
259260
let mut results = Vec::<Value>::new();
@@ -402,6 +403,7 @@ impl Configurator {
402403
match &set_result {
403404
SetResult::Resource(resource_result) => {
404405
self.context.references.insert(format!("{}:{}", resource.resource_type, resource.name), serde_json::to_value(&resource_result.after_state)?);
406+
progress.set_resource(&resource.name, &resource.resource_type, Some(&resource_result.after_state));
405407
},
406408
SetResult::Group(group) => {
407409
let mut results = Vec::<Value>::new();
@@ -473,6 +475,7 @@ impl Configurator {
473475
match &test_result {
474476
TestResult::Resource(resource_test_result) => {
475477
self.context.references.insert(format!("{}:{}", resource.resource_type, resource.name), serde_json::to_value(&resource_test_result.actual_state)?);
478+
progress.set_resource(&resource.name, &resource.resource_type, Some(&resource_test_result.actual_state));
476479
},
477480
TestResult::Group(group) => {
478481
let mut results = Vec::<Value>::new();

dsc_lib/src/discovery/command_discovery.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl Default for CommandDiscovery {
169169

170170
impl ResourceDiscovery for CommandDiscovery {
171171

172-
fn discover_resources(&mut self, filter: &str) -> Result<(), DscError> {
172+
fn discover_resources(&mut self, filter: &str, progress_format: ProgressFormat) -> Result<(), DscError> {
173173
info!("{}", t!("discovery.commandDiscovery.discoverResources", filter = filter));
174174

175175
let regex_str = convert_wildcard_to_regex(filter);
@@ -246,7 +246,7 @@ impl ResourceDiscovery for CommandDiscovery {
246246

247247
fn discover_adapted_resources(&mut self, name_filter: &str, adapter_filter: &str) -> Result<(), DscError> {
248248
if self.resources.is_empty() && self.adapters.is_empty() {
249-
self.discover_resources("*")?;
249+
self.discover_resources("*", progress_format)?;
250250
}
251251

252252
if self.adapters.is_empty() {
@@ -358,7 +358,7 @@ impl ResourceDiscovery for CommandDiscovery {
358358
let mut resources = BTreeMap::<String, Vec<DscResource>>::new();
359359

360360
if adapter_name_filter.is_empty() {
361-
self.discover_resources(type_name_filter)?;
361+
self.discover_resources(type_name_filter, progress_format)?;
362362
resources.append(&mut self.resources);
363363
resources.append(&mut self.adapters);
364364
} else {
@@ -379,7 +379,7 @@ impl ResourceDiscovery for CommandDiscovery {
379379
fn find_resources(&mut self, required_resource_types: &[String]) -> Result<BTreeMap<String, DscResource>, DscError>
380380
{
381381
debug!("Searching for resources: {:?}", required_resource_types);
382-
self.discover_resources("*")?;
382+
self.discover_resources("*", progress_format)?;
383383

384384
// convert required_resource_types to lowercase to handle case-insentiive search
385385
let mut remaining_required_resource_types = required_resource_types.iter().map(|x| x.to_lowercase()).collect::<Vec<String>>();

0 commit comments

Comments
 (0)