Skip to content

CLI: Enhance image and container inspection behavior#40315

Open
AmelBawa-msft wants to merge 2 commits intofeature/wsl-for-appsfrom
user/amelbawa/update-inspect
Open

CLI: Enhance image and container inspection behavior#40315
AmelBawa-msft wants to merge 2 commits intofeature/wsl-for-appsfrom
user/amelbawa/update-inspect

Conversation

@AmelBawa-msft
Copy link
Copy Markdown

@AmelBawa-msft AmelBawa-msft commented Apr 24, 2026

Summary of the Pull Request

  • Graceful not-found handling for inspect commands, container inspect and image inspect now
    catch not-found errors and print a friendly localized message to stderr instead of throwing an
    unhandled exception.
  • Partial results on multi-inspect. When inspecting multiple items, found items are still returned in JSON output; missing items log an error and set exit code 1.
  • New MessageWslcImageNotFound localization string added to Resources.resw.
  • New E2E test suite for container inspect (help, missing arg, not-found, single, multi, mixed found/not-found).
  • Updated image inspect not-found test to expect the new friendly error + empty JSON array output.

PR Checklist

  • Closes: Link to issue #xxx
  • Communication: I've discussed this with core contributors already. If work hasn't been agreed, this work might be rejected
  • Tests: Added/updated if needed and all pass
  • Localization: All end user facing strings can be localized
  • Dev docs: Added/updated if needed
  • Documentation updated: If checked, please file a pull request on our docs repo and link it here: #xxx

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

Copilot AI review requested due to automatic review settings April 24, 2026 20:33
Copy link
Copy Markdown
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 updates WSLC’s image inspect and container inspect CLI behavior to be more consistent with other “inspect” commands by returning JSON output (including partial results) even when some requested objects are missing, while emitting localized “not found” errors and a non-zero exit code.

Changes:

  • Update image inspect to handle missing images by emitting a localized error, returning []/partial JSON on stdout, and setting exit code to 1 rather than failing the whole command.
  • Add end-to-end test coverage for container inspect, including success, not-found, multi-inspect, and mixed found/not-found scenarios.
  • Add a new localized string for the image-not-found error message.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
test/windows/wslc/e2e/WSLCE2EImageInspectTests.cpp Updates expected output for image-not-found to match new inspect behavior (JSON on stdout + localized stderr).
test/windows/wslc/e2e/WSLCE2EContainerInspectTests.cpp Adds e2e tests validating help, missing args, not-found, single/multi inspect, and mixed results for container inspect.
src/windows/wslc/tasks/ImageTasks.cpp Implements “try inspect” behavior for images to allow partial results and per-item not-found reporting.
src/windows/wslc/tasks/ContainerTasks.cpp Implements “try inspect” behavior for containers to allow partial results and per-item not-found reporting.
localization/strings/en-US/Resources.resw Adds MessageWslcImageNotFound localized string used by the new image inspect behavior.

Comment thread src/windows/wslc/tasks/ImageTasks.cpp
Comment thread localization/strings/en-US/Resources.resw
@AmelBawa-msft AmelBawa-msft marked this pull request as ready for review April 24, 2026 23:48
@AmelBawa-msft AmelBawa-msft requested a review from a team as a code owner April 24, 2026 23:48
Copilot AI review requested due to automatic review settings April 24, 2026 23:48
Copy link
Copy Markdown
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

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

@AmelBawa-msft AmelBawa-msft enabled auto-merge (squash) April 25, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants