datum icon indicating copy to clipboard operation
datum copied to clipboard

New-DatumStructure JSON DefinitionFile broken

Open schnyders opened this issue 2 years ago • 2 comments

A JSON that worked without any issue on version 0.39.0 doesn't work anymore in version 0.40.1

{
    "ResolutionPrecedence": [
      "AllNodes\\$($Node.NodeName)"
    ],
    "DatumHandlersThrowOnError": true,
    "DatumHandlers": {
      "Datum.ProtectedData::ProtectedDatum": {
        "CommandOptions": {
          "PlainTextPassword": "SomeSecret"
        }
      },
      "Datum.InvokeCommand::InvokeCommand": {
        "SkipDuringLoad": true
      }
    }
  }

This json for example doesn't work with 0.40.1, but it works with 0.39.0. If I convert this json to yml it works with both versions.

New-DatumStructure -DefinitionFile .\Datum.json returns

MetadataError: Cannot convert value "@{ResolutionPrecedence=System.Object[]; DatumHandlersThrowOnError=True; DatumHandlers=; __File=C:\tmp\DSCTest\Datum.json}" to type
"System.Collections.Hashtable". Error: "Cannot convert the "@{ResolutionPrecedence=System.Object[]; DatumHandlersThrowOnError=True; DatumHandlers=;
__File=C:\tmp\DSCTest\Datum.json}" value of type "System.Management.Automation.PSCustomObject" to type "System.Collections.Hashtable"."
InvalidOperation: You cannot call a method on a null-valued expression.
InvalidOperation: The property 'DatumDefinitionFile' cannot be found on this object. Verify that the property exists and can be set.
InvalidOperation: You cannot call a method on a null-valued expression.
InvalidOperation: You cannot call a method on a null-valued expression.

schnyders avatar Aug 28 '23 16:08 schnyders

Hi @schnyders, I have just came across this issue when searching for DatumHandlersThrowOnError. Did you ever solve it?

raandree avatar Jan 16 '25 13:01 raandree

Hi @raandree

In our internal pipeline, I simply added a task to convert all json to yaml before using datum on it. But I also fixed it in a simple test env with this: https://github.com/gaelcolas/datum/pull/149

But it looks like first other things needs to be fixed. So that build checks work again.

schnyders avatar Feb 06 '25 17:02 schnyders