No Datum store found for DSC Resource error

I watched Gael Colas’ presentations which can be found on Youtube,
and I am very convinced that it is a very usefull module when working with DSC.
However, I am not able to use Datum correctly.

I’ve created a little structure with 2 nodes and 2 roles just to play arround and be able to manage the basics.

PS> (Get-ChildItem -Recurse).FullName
E:\dsc\ConfigurationData\AllNodes
E:\dsc\ConfigurationData\Roles
E:\dsc\ConfigurationData\Datum.yml
E:\dsc\ConfigurationData\AllNodes\v-Computer1.yml
E:\dsc\ConfigurationData\AllNodes\v-Computer2.yml
E:\dsc\ConfigurationData\Roles\FileServer.yml
E:\dsc\ConfigurationData\Roles\WebServer.yml

Based on what I found on the Datum’s Github page, I’ve filled the files and here is the content

PS> Get-ChildItem *.yml -Recurse | ForEach-Object {"`n`r$($_.FullName)"; Get-Content -Path $_.FullName}

E:\dsc\ConfigurationData\AllNodes\v-Computer1.yml
Name: v-Computer1
IP: '10.0.0.11'
Role: FileServer

E:\dsc\ConfigurationData\AllNodes\v-Computer2.yml
Name: v-Computer2
IP: '10.0.0.12'
Role: WebServer

E:\dsc\ConfigurationData\Roles\FileServer.yml
WindowsFeatureList:
  - FS-FileServer
  - FS-Data-Deduplication

E:\dsc\ConfigurationData\Roles\WebServer.yml
WindowsFeatureList:
  - Web-WebServer

E:\dsc\ConfigurationData\Datum.yml
ResolutionPrecedence:
  - AllNodes\$($Node.Name)
  - Roles\$($Node.Role)

Now creating the Datum variable

$datum = New-DatumStructure -DefinitionFile .\Datum.yml

Looking inside the variable

PS> $datum

Name                           Value                                                                                                                                                                                                   
----                           -----                                                                                                                                                                                                   
__Definition                   {ResolutionPrecedence, DatumStructure}                                                                                                                                                                  
Roles                          FileProvider                                                                                                                                                                                            
AllNodes                       FileProvider

PS> $datum.Roles

FileServer           WebServer           
----------           ---------           
{WindowsFeatureList} {WindowsFeatureList}

PS> $datum.AllNodes

v-Computer1      v-Computer2     
-----------      -----------     
{Name, IP, Role} {Name, IP, Role}

PS> $datum.AllNodes.'v-Computer1'

Name                           Value                                                                                                                                                                                                   
----                           -----                                                                                                                                                                                                   
Name                           v-Computer1                                                                                                                                                                                             
IP                             10.0.0.11                                                                                                                                                                                               
Role                           FileServer

So far so good!

However, I am not able to make the lookup working…

PS> Lookup WindowsFeatureList
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
	

PS> Lookup -DatumTree $datum -Node v-Computer1 -PropertyPath WindowsFeatureList
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.

PS> Lookup -DatumTree $datum -Node v-Computer1 -PropertyPath Name
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'Name' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'Name' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.

PS> Lookup -DatumTree $datum -Node v-Computer1 -PropertyPath IP
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'IP' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'IP' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.

If someone could save me from tearing my hair out of my head… :slight_smile:

If you change your debug preference to continue you should get much more info for troubleshooting.

 

Sorry, only on my phone rn.

Feel free to paste result here and I can try to help interpret.

Hi Gael!

Here is the output:

PS> Lookup -DatumTree $datum -Node v-Computer1 -PropertyPath WindowsFeatureList -Debug
DEBUG: Resolve-Datum -PropertyPath  -Node 
DEBUG: Get-MergeStrategyFromString -MergeStrategy <>
DEBUG: Couldn't Match the strategy 
DEBUG: 	Get-MergeStrategyFromPath -PropertyPath  -Strategies [^.*], count 1
DEBUG: 	  Strategy matching regex ^.*
DEBUG: 	  StrategyKey: ^.*
DEBUG: 	  Returning Strategy ^.* of type ''
DEBUG: 			
DEBUG: 			Current Path: $Datum.AllNodes
DEBUG: 				branch of path Left to walk: .WindowsFeatureList
DEBUG: 			Current Path: $Datum.AllNodes.WindowsFeatureList
DEBUG: 				branch of path Left to walk: .
DEBUG:   Depth: 0; Merge options = 1
DEBUG: 			
DEBUG: 			Current Path: $Datum.Roles
DEBUG: 				branch of path Left to walk: .WindowsFeatureList
DEBUG: 			Current Path: $Datum.Roles.WindowsFeatureList
DEBUG: 				branch of path Left to walk: .
DEBUG:   Depth: 0; Merge options = 1
DEBUG: 		Attempting to load datum from E:\dsc\ConfigurationData.
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.

Ha yeah, you don’t have anything set for Node to lookup.

You should first set it:

$node = $datum.AllNodes.‘v-computer1’

Then do the lookup.

The lookup command has a parameter $node that resolves automatically what exist in current session, or you can explicitly pass the node Hashtable as param.

Unfortunately I get the same error.
It would have suprised me because I already used the -Node parameter with the cmdlet.

PS> $node = $datum.AllNodes.'v-computer1'

PS> Lookup -DatumTree $datum -Node v-Computer1 -PropertyPath WindowsFeatureList
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'WindowsFeatureList' for node '' returned a Null value, but Null is not specified as Default. This is not allowed.

I also tried without using the -Node parameter, but same error.

PS> Lookup -DatumTree $datum -PropertyPath WindowsFeatureList
WARNING: 	No Datum store found for DSC Resource
The lookup of path 'WindowsFeatureList' for node 'v-Computer1' returned a Null value, but Null is not specified as Default. This is not allowed.
At C:\Program Files\WindowsPowerShell\Modules\datum\0.0.38\ScriptsToProcess\Resolve-NodeProperty.ps1:106 char:9
+         throw "The lookup of path '$PropertyPath' for node '$($node.N ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The lookup of p...is not allowed.:String) [], RuntimeException
    + FullyQualifiedErrorId : The lookup of path 'WindowsFeatureList' for node 'v-Computer1' returned a Null value, but Null is not specified as Default. This is not allowed.

My apologies Gael,

Despite your clear explanation, I’ve completely misread your answer…
By using the $Node object instead of the node name it’s working better :slight_smile:

I had a look at your code and have a suggestion to avoid this mistake with other people using your module:

You can create the $root object in the New-DatumStructure function with a PSTypeName.
And accordingly, you can check this PSTypeName on the -Node parameter from the Resolve-Datum (lookup) function
instead of validating the parameter as a beeing a string.

I am quite sure you know the PSTypeName, but just in case, here is very good explanation from Adam Bertram:

https://adamtheautomator.com/building-custom-object-types-powershell-pstypename/

Anyway, thanks for your help Gael! :slight_smile: