Skip to content

Stdin for config vs resource #253

@mgreenegit

Description

@mgreenegit

Summary of the new feature / enhancement

With the implementation we have at this time, the only way a resource group author can determine if the input is from a configuration or resource is to look for a resources property at the top level. This is problematic for two reasons.

1 - When the input is from a configuration, the Name and Type properties are not dsc properties, they are describing the resource. The input moves to being under properties. This shift in behavior will require the author to have read docs and understand, otherwise they will waste time figuring it out.
2 - There could be a dsc resource with the name resources already in existence.

Proposed technical implementation details (optional)

First, I would propose that any time we offer stdin to a resource group, if should include some information about the command that has been run. In the first example below the parameter is include as _context, in the second example the entire command is included.

Proposal1 - simple:

{
  "_context": "config"
  }
  "resources": [
    {
      "name": "bits",
      "type": "PsDscResources/Service",
      "properties": {
        "Name": "bits"
        "State": "Running"
      }
    }
  ]
}

Proposal2 - full:

{
  "_context": "dsc config test"
  }
  "resources": [
    {
      "name": "bits",
      "type": "PsDscResources/Service",
      "properties": {
        "Name": "bits"
        "State": "Running"
      }
    }
  ]
}

Second, I would propose that when stdin is from a configuration, we should use the _ to indicate the properties are referencing details about the resource and are not actually properties of the resource.

Example:

{
  "_context": "config"
  }
  "resources": [
    {
      "_name": "bits",
      "_type": "PsDscResources/Service",
      "_properties": {
        "Name": "bits"
        "State": "Running"
      }
    }
  ]
}

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions