From: Lennart Poettering Date: Tue, 10 Oct 2023 16:25:32 +0000 (+0200) Subject: dissect: show architecture in JSON output too X-Git-Tag: v255-rc1~247^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e0b5cd36b07cc6b28358bec69eb9fa3842ac150;p=thirdparty%2Fsystemd.git dissect: show architecture in JSON output too We show it in the human readable output, and we should include the same data in the JSON output too. --- diff --git a/src/dissect/dissect.c b/src/dissect/dissect.c index a1ef16406aa..888e84923ff 100644 --- a/src/dissect/dissect.c +++ b/src/dissect/dissect.c @@ -902,11 +902,14 @@ static int action_dissect(DissectedImage *m, LoopDevice *d) { if (r < 0) return log_error_errno(r, "Failed to parse scope: %m"); + Architecture a = dissected_image_architecture(m); + r = json_build(&v, JSON_BUILD_OBJECT( JSON_BUILD_PAIR("name", JSON_BUILD_STRING(bn)), JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->image_uuid), "imageUuid", JSON_BUILD_UUID(m->image_uuid)), JSON_BUILD_PAIR("size", JSON_BUILD_INTEGER(size)), JSON_BUILD_PAIR("sectorSize", JSON_BUILD_INTEGER(m->sector_size)), + JSON_BUILD_PAIR_CONDITION(a >= 0, "architecture", JSON_BUILD_STRING(architecture_to_string(a))), JSON_BUILD_PAIR_CONDITION(m->hostname, "hostname", JSON_BUILD_STRING(m->hostname)), JSON_BUILD_PAIR_CONDITION(!sd_id128_is_null(m->machine_id), "machineId", JSON_BUILD_ID128(m->machine_id)), JSON_BUILD_PAIR_CONDITION(!strv_isempty(m->machine_info), "machineInfo", JSON_BUILD_STRV_ENV_PAIR(m->machine_info)),