KEMBAR78
Enable resources to return _restartRequired metadata by SteveL-MSFT · Pull Request #975 · PowerShell/DSC · GitHub
Skip to content

Conversation

@SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Jul 16, 2025

PR Summary

Allow resources to return _restartRequired as part of _metadata. This is an array that can contain any of:

{ "system": "computerName" }
{ "service": "serviceName" }
{ "process":
  {
    "name": "processName",
    "id": "pid"
  }
}

The metadata is pulled into each resources metadata as part of result object, but also collected into the top level Microsoft.DSC metadata:

image

Any items in the array that don't conform to the above results in a warning. dsc schema -t restart-required returns the JSONSchema.

PR Context

Fix #50

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enables resources to return _restartRequired metadata to indicate what needs to be restarted after configuration operations (system, services, or processes). The metadata is both attached to individual resource results and aggregated at the top-level Microsoft.DSC metadata.

  • Adds new RestartRequired enum with variants for system, service, and process restart requirements
  • Integrates restart metadata collection into the configuration context and result processing
  • Extends CLI schema output to support the new restart-required type

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dsc_lib/src/configure/config_doc.rs Defines RestartRequired enum and Process struct, adds restart_required field to MicrosoftDscMetadata
dsc_lib/src/configure/context.rs Adds restart_required field to Context struct for aggregating restart metadata
dsc_lib/src/configure/mod.rs Updates metadata processing to handle _restartRequired and aggregate it in context
dsc_lib/locales/en-us.toml Adds localization string for invalid restart required metadata warning
dsc/src/args.rs Adds RestartRequired variant to DscType enum
dsc/src/util.rs Adds schema generation support for RestartRequired type
dsc/tests/dsc_metadata.tests.ps1 Comprehensive test coverage for restart required metadata functionality

@SteveL-MSFT SteveL-MSFT added this pull request to the merge queue Jul 18, 2025
Merged via the queue into PowerShell:main with commit 012cf3d Jul 18, 2025
4 checks passed
@SteveL-MSFT SteveL-MSFT deleted the restart-required branch July 18, 2025 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Handle resources that require restarts

2 participants