datum icon indicating copy to clipboard operation
datum copied to clipboard

Using an environment variable in the Datum.yml throws an error

Open raandree opened this issue 3 years ago • 0 comments

For certain scenarios it is required to access an environment variable to create the ResolutionPrecedence:

ResolutionPrecedence:
  - AllNodes\$($Node.Environment)\$($Node.NodeName)
  - ...
  - LCM\LCM_$($env:BuildLcmMode)
  - ...

This results in the following error when creating the RSOP:

Generating RSOP output for 13 nodes.
Join-Path : Cannot find drive. A drive with the name 'LCM\LCM_$($env' does not exist.
At D:\Git\DatumTest\DSC\BuildOutput\Modules\Datum\0.40.0\datum.psm1:1418 char:26
+         $CurrentSearch = Join-Path $SearchPrefix $PropertyPath
+                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (LCM\LCM_$($env:String) [Join-Path], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.JoinPathCommand

ERROR: Exception calling "Replace" with "4" argument(s): "Value cannot be null.
Parameter name: input"
At D:\Git\DatumTest\DSC\BuildOutput\Modules\Datum\0.40.0\ScriptsToProcess\Resolve-NodeProperty.ps1:58 char:18

raandree avatar Mar 11 '21 11:03 raandree