@@ -39,6 +39,7 @@ pub struct Configurator {
39
39
discovery : Discovery ,
40
40
statement_parser : Statement ,
41
41
progress_format : ProgressFormat ,
42
+ pub process_expressions : bool ,
42
43
}
43
44
44
45
/// Add the results of an export operation to a configuration.
@@ -274,6 +275,7 @@ impl Configurator {
274
275
discovery : discovery. clone ( ) ,
275
276
statement_parser : Statement :: new ( ) ?,
276
277
progress_format,
278
+ process_expressions : true ,
277
279
} ;
278
280
config. validate_config ( ) ?;
279
281
for extension in discovery. extensions . values ( ) {
@@ -670,7 +672,7 @@ impl Configurator {
670
672
671
673
fn skip_resource ( & mut self , resource : & Resource ) -> Result < bool , DscError > {
672
674
if let Some ( condition) = & resource. condition {
673
- let condition_result = self . statement_parser . parse_and_execute ( condition, & self . context ) ?;
675
+ let condition_result = self . statement_parser . parse_and_execute ( condition, & self . context , self . process_expressions ) ?;
674
676
if condition_result != Value :: Bool ( true ) {
675
677
info ! ( "{}" , t!( "configure.config_doc.skippingResource" , name = resource. name, condition = condition, result = condition_result) ) ;
676
678
return Ok ( true ) ;
@@ -722,7 +724,7 @@ impl Configurator {
722
724
// default values can be expressions
723
725
let value = if default_value. is_string ( ) {
724
726
if let Some ( value) = default_value. as_str ( ) {
725
- self . statement_parser . parse_and_execute ( value, & self . context ) ?
727
+ self . statement_parser . parse_and_execute ( value, & self . context , self . process_expressions ) ?
726
728
} else {
727
729
return Err ( DscError :: Parser ( t ! ( "configure.mod.defaultStringNotDefined" ) . to_string ( ) ) ) ;
728
730
}
@@ -783,7 +785,7 @@ impl Configurator {
783
785
784
786
for ( name, value) in variables {
785
787
let new_value = if let Some ( string) = value. as_str ( ) {
786
- self . statement_parser . parse_and_execute ( string, & self . context ) ?
788
+ self . statement_parser . parse_and_execute ( string, & self . context , self . process_expressions ) ?
787
789
}
788
790
else {
789
791
value. clone ( )
@@ -887,7 +889,7 @@ impl Configurator {
887
889
let Some ( statement) = element. as_str ( ) else {
888
890
return Err ( DscError :: Parser ( t ! ( "configure.mod.arrayElementCouldNotTransformAsString" ) . to_string ( ) ) ) ;
889
891
} ;
890
- let statement_result = self . statement_parser . parse_and_execute ( statement, & self . context ) ?;
892
+ let statement_result = self . statement_parser . parse_and_execute ( statement, & self . context , self . process_expressions ) ?;
891
893
let Some ( string_result) = statement_result. as_str ( ) else {
892
894
return Err ( DscError :: Parser ( t ! ( "configure.mod.arrayElementCouldNotTransformAsString" ) . to_string ( ) ) ) ;
893
895
} ;
@@ -905,7 +907,7 @@ impl Configurator {
905
907
let Some ( statement) = value. as_str ( ) else {
906
908
return Err ( DscError :: Parser ( t ! ( "configure.mod.valueCouldNotBeTransformedAsString" , value = value) . to_string ( ) ) ) ;
907
909
} ;
908
- let statement_result = self . statement_parser . parse_and_execute ( statement, & self . context ) ?;
910
+ let statement_result = self . statement_parser . parse_and_execute ( statement, & self . context , self . process_expressions ) ?;
909
911
if let Some ( string_result) = statement_result. as_str ( ) {
910
912
result. insert ( name. clone ( ) , Value :: String ( string_result. to_string ( ) ) ) ;
911
913
} else {
0 commit comments