@@ -39,6 +39,7 @@ pub struct Configurator {
3939 discovery : Discovery ,
4040 statement_parser : Statement ,
4141 progress_format : ProgressFormat ,
42+ pub process_expressions : bool ,
4243}
4344
4445/// Add the results of an export operation to a configuration.
@@ -274,6 +275,7 @@ impl Configurator {
274275 discovery : discovery. clone ( ) ,
275276 statement_parser : Statement :: new ( ) ?,
276277 progress_format,
278+ process_expressions : true ,
277279 } ;
278280 config. validate_config ( ) ?;
279281 for extension in discovery. extensions . values ( ) {
@@ -670,7 +672,7 @@ impl Configurator {
670672
671673 fn skip_resource ( & mut self , resource : & Resource ) -> Result < bool , DscError > {
672674 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 ) ?;
674676 if condition_result != Value :: Bool ( true ) {
675677 info ! ( "{}" , t!( "configure.config_doc.skippingResource" , name = resource. name, condition = condition, result = condition_result) ) ;
676678 return Ok ( true ) ;
@@ -722,7 +724,7 @@ impl Configurator {
722724 // default values can be expressions
723725 let value = if default_value. is_string ( ) {
724726 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 ) ?
726728 } else {
727729 return Err ( DscError :: Parser ( t ! ( "configure.mod.defaultStringNotDefined" ) . to_string ( ) ) ) ;
728730 }
@@ -783,7 +785,7 @@ impl Configurator {
783785
784786 for ( name, value) in variables {
785787 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 ) ?
787789 }
788790 else {
789791 value. clone ( )
@@ -887,7 +889,7 @@ impl Configurator {
887889 let Some ( statement) = element. as_str ( ) else {
888890 return Err ( DscError :: Parser ( t ! ( "configure.mod.arrayElementCouldNotTransformAsString" ) . to_string ( ) ) ) ;
889891 } ;
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 ) ?;
891893 let Some ( string_result) = statement_result. as_str ( ) else {
892894 return Err ( DscError :: Parser ( t ! ( "configure.mod.arrayElementCouldNotTransformAsString" ) . to_string ( ) ) ) ;
893895 } ;
@@ -905,7 +907,7 @@ impl Configurator {
905907 let Some ( statement) = value. as_str ( ) else {
906908 return Err ( DscError :: Parser ( t ! ( "configure.mod.valueCouldNotBeTransformedAsString" , value = value) . to_string ( ) ) ) ;
907909 } ;
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 ) ?;
909911 if let Some ( string_result) = statement_result. as_str ( ) {
910912 result. insert ( name. clone ( ) , Value :: String ( string_result. to_string ( ) ) ) ;
911913 } else {
0 commit comments