Open JonasRied opened 1 year ago
What I see in the logs is an expected warning. Datum handlers are called after tests. How does the RSOP for this node looks like? Does the correct environment show up in the RSOP file? The datum handlers are called in the RSOP task.
The correct environment show up in the RSOP file. But Description: '[x= "$($Node.Role) in $($Node.Environment)" =]' becomes 'Description: server1.dev.de in '. The value of $Node.Environment is missing.
If i use no datum expression like Environment: 'Prod' in node yml file the test fails:
[-] Environment of 'Server1.dev.de' is 'Prod' and does exist 19ms (18ms|1ms)
at $node.Environment -in $Environments | Should -BeTrue, C:\Users\Admin\Documents\Code\DSC Workshop\tests\ConfigData\ConfigData.Tests.ps1:165
at
I see the issue but I am not sure why it happens. There was a problem with calculated values being used in other calculated values but I don't remember the details.
Interestingly, this works which uses two layers of calculated values for the description.
NodeName: '[x={ $Node.Name }=]'
Environment: '[x={ $File.Directory.BaseName } =]'
Role: FileServer
Description: '[x= "$($Node.Role) in $($Node.Var3)" =]'
Location: Frankfurt
Baseline: Server
Var1: fixedValue
Var2: '[x={ "dynamicValue" }=]'
Var3: '[x={ "$($Node.Var1) $($Node.Var2)" }=]'
I will debug this. For now, please assign a static value to the environment
Environment: Dev #'[x={ $File.Directory.BaseName } =]'
Problem description
The expression
[x={ $File.Directory.BaseName } =]
does not determine node environment.Verbose logs
How to reproduce
Expected behavior
ParentFolderName of node yml file is set as node environment.
Current behavior
Suggested solution
null
Operating system the target node is running
PowerShell version and build the target node is running
Module version used