Skip to content

differingProperties always propagated on adapter resource #849

Open

Description

@Gijsreyn

Prerequisites

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

Summary

When writing the docs for #848, I noticed that the differingProperties are always being propagated. For example, executing the following:

$instance = @{
    Name        = 'Spooler'
    StartupType = 'Automatic'
} | ConvertTo-Json

dsc resource test --resource PSDesiredStateConfiguration/Service --input $instance

Returns the desiredState equals true. I would expect the differingProperties to be empty. Instead, both Name and StartupType are returned.

Image

Steps to reproduce

See description

Expected behavior

Return `differingProperties: []`

Actual behavior

Returns both properties

Error details

Environment data

Name                           Value
----                           -----
PSVersion                      5.1.19041.5848
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.5848
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Version

dsc 3.1.0-preview.6

Visuals

No response

Activity

  1. michaeltlombardi commented on May 30, 2025

    @michaeltlombardi
    Collaborator

    I think a major component of this is that the adapter doesn't fully munge the PSDSC resource output to match DSC expectations.

    I think the implementation should take this resource output:

    { "inDesiredState": true }

    And return it from the adapter as

    {"_inDesiredState":true,"Name":"spooler","StartupType":"Automatic"}

    This requires the adapter to synthetically invoke the get operation for the resource, but that should make everything more functional for users.

    I believe this is also related to #267, which proposes a model for simplifying the implementation of adapters so that they are able to return data to DSC with minimal munging. The PSDSC adapters would still need to invoke both the Test() and Get() operations for classic PSDSC resources to return the appropriate JSON, but this could simplify the overall implementation and enable simpler implementations for new adapters, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions