portablectl: keep inspect --force unit metadata

Parse the WithExtensions metadata block whenever --force selects that
bus method. This keeps the following unit-file array aligned with the
reply layout.

Reproducer:
  portablectl inspect --force /usr/share/minimal_0.raw \
      minimal-app0.service

Before:
  inspect printed the image metadata but dropped the matching unit
  list. Scripts could not see which unit files were selected when
  --force was used with the WithExtensions bus reply.

Follow-up: bdfa3f3a5c
This commit is contained in:
dongshengyuan
2026-07-15 16:30:15 +08:00
parent 90739ac251
commit 9773189e56
2 changed files with 2 additions and 1 deletions
+1 -1
View File
@@ -556,7 +556,7 @@ static int verb_inspect_image(int argc, char *argv[], uintptr_t _data, void *use
strna(pretty_os));
}
if (!strv_isempty(arg_extension_images)) {
if (!strv_isempty(arg_extension_images) || arg_force) {
/* If we specified any extensions, we'll first get back exactly the paths (and
* extension-release content) for each one of the arguments. */
+1
View File
@@ -66,6 +66,7 @@ portablectl "${ARGS[@]}" attach --force --now --runtime /usr/share/minimal_0.raw
portablectl is-attached --force minimal-app0
portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service
portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service | grep -F "minimal-app0.service" >/dev/null
systemctl is-active minimal-app0.service
systemctl is-active minimal-app0-foo.service
systemctl is-active minimal-app0-bar.service && exit 1