DSC icon indicating copy to clipboard operation
DSC copied to clipboard

Passing resource JSON for invocation no longer works

Open SteveL-MSFT opened this issue 1 year ago • 3 comments

Prerequisites

  • [X] Write a descriptive title.
  • [X] Make sure you are able to repro it on the latest version
  • [X] Search the existing issues.

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 avatar Jun 06 '24 01:06 SteveL-MSFT

Probably don't need this until needed by a partner

SteveL-MSFT avatar Jun 06 '24 04:06 SteveL-MSFT

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.

michaeltlombardi avatar Jun 13 '24 13:06 michaeltlombardi

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.

SteveL-MSFT avatar Jun 17 '24 20:06 SteveL-MSFT