PowerShell / DSC

This repo is for the DSC v3 project
MIT License
219 stars 30 forks source link

Passing resource JSON for invocation no longer works #449

Open SteveL-MSFT opened 5 months ago

SteveL-MSFT commented 5 months ago

Prerequisites

Summary

dsc resource get -r is expected to accept a wildcard, name of resource, or the resource JSON (to avoid a search). The latter has been broken.

Steps to reproduce

$osinfo = dsc resource list Microsoft/OSInfo
dsc resource get -r $osinfo

Expected behavior

Since `$osinfo` is a JSON representation of a resource, it has all the info about the resource so discovery should not occur and `dsc` should try to directly perform a `get`

Actual behavior

`dsc` is using the JSON as a search string

Error details

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.5.0-preview.1
PSEdition                      Core
GitCommitId                    7.5.0-preview.1-103-gda1ca4a7266e2c9e43f96a38aeea8092ace71cca
OS                             Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May  1 20:16:51 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T8103
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Version

dsc 3.0.0-preview.8

Visuals

No response

SteveL-MSFT commented 5 months ago

Probably don't need this until needed by a partner

michaeltlombardi commented 5 months ago

Just as an anecdotal note, I've used this pattern to show piping behavior before, and found it useful for interactive use. If we're intentionally dropping it as functionality, I'll need to remove it from the docs.

SteveL-MSFT commented 4 months ago

Just as an anecdotal note, I've used this pattern to show piping behavior before, and found it useful for interactive use. If we're intentionally dropping it as functionality, I'll need to remove it from the docs.

I don't think it's intended to be dropped. Some changes along the way broke this and we didn't have tests to catch it. Should be removed from docs for now. The original intent is for integrating software to cache the resources if they are calling dsc resource ... instead of waiting for dsc to perform discovery on each call. This feature might not be needed if we implement a "server mode" that accepts multiple requests as dsc would hold the resource list cache internally.