From: Philip Withnall Date: Mon, 19 Jan 2026 17:11:18 +0000 (+0000) Subject: updatectl: Expose partial/pending updates in the updatectl list output X-Git-Tag: v260-rc1~38^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b0ca987cd96599ca672716249aa4efe3d80abf72;p=thirdparty%2Fsystemd.git updatectl: Expose partial/pending updates in the updatectl list output And expand the tests to catch if any more JSON fields are added to the sysupdated output in future without being added to `updatectl`’s parser. Signed-off-by: Philip Withnall Helps: https://github.com/systemd/systemd/issues/34814 --- diff --git a/src/sysupdate/updatectl.c b/src/sysupdate/updatectl.c index 7638bbff795..60523181bcd 100644 --- a/src/sysupdate/updatectl.c +++ b/src/sysupdate/updatectl.c @@ -338,6 +338,8 @@ typedef struct DescribeParams { bool newest; bool available; bool installed; + bool partial; + bool pending; bool obsolete; bool protected; bool incomplete; @@ -373,6 +375,8 @@ static int parse_describe(sd_bus_message *reply, Version *ret) { { "newest", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, newest), 0 }, { "available", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, available), 0 }, { "installed", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, installed), 0 }, + { "partial", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, partial), 0 }, + { "pending", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, pending), 0 }, { "obsolete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, obsolete), 0 }, { "protected", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, protected), 0 }, { "incomplete", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(DescribeParams, incomplete), 0 }, @@ -390,6 +394,8 @@ static int parse_describe(sd_bus_message *reply, Version *ret) { SET_FLAG(p.v.flags, UPDATE_NEWEST, p.newest); SET_FLAG(p.v.flags, UPDATE_AVAILABLE, p.available); SET_FLAG(p.v.flags, UPDATE_INSTALLED, p.installed); + SET_FLAG(p.v.flags, UPDATE_PARTIAL, p.partial); + SET_FLAG(p.v.flags, UPDATE_PENDING, p.pending); SET_FLAG(p.v.flags, UPDATE_OBSOLETE, p.obsolete); SET_FLAG(p.v.flags, UPDATE_PROTECTED, p.protected); SET_FLAG(p.v.flags, UPDATE_INCOMPLETE, p.incomplete); diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index f3b712a6e6e..3fe125a26a6 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -150,6 +150,12 @@ verify_version_current() { cmp "$WORKDIR/source/dir-$version/bar.txt" "$WORKDIR/dirs/current/bar.txt" } +verify_object_fields() { + local updatectl_output="${1:?}" + + [[ "${updatectl_output}" != *"Unrecognized object field"* ]] || exit 1 +} + for sector_size in "${SECTOR_SIZES[@]}"; do for update_type in monolithic split-offline split; do # Disk size of: @@ -373,9 +379,9 @@ EOF if [[ -x "$SYSUPDATED" ]] && command -v updatectl; then mkdir -p /run/sysupdate.test.d/ cp "$CONFIGDIR/01-first.transfer" /run/sysupdate.test.d/01-first.transfer - updatectl list - updatectl list host - updatectl list host@v6 + verify_object_fields "$(updatectl list 2>&1)" + verify_object_fields "$(updatectl list host 2>&1)" + verify_object_fields "$(updatectl list host@v6 2>&1)" updatectl check rm -r /run/sysupdate.test.d fi