sysupdate: undo some accidental field renaming (#43707)
This undoes some of the work in #43603 which was a follow-up to #42900 which – unintentionally I'd claim – renamed some JSON fields. Instead of setting those changes in stone we should undo them. Not just to not needlessly break compat, but more importantly because the old names made more sense given the underlying .feature file knobs.
This commit is contained in:
@@ -144,10 +144,10 @@ CHANGES WITH 262 in spe:
|
||||
hierarchy that is not merged is now shown as "-" instead of "none".
|
||||
|
||||
* The JSON payload returned by systemd-sysupdated's DescribeFeature()
|
||||
method changed the "name" and "enabled" keys to "id" and
|
||||
"isEnabled", respectively. The "appStream" key is now "appstream",
|
||||
and the "documentation" key is now an array of strings. Consumers
|
||||
of this interface must update their JSON parsing accordingly.
|
||||
method and by the "systemd-sysupdate features" command changed the
|
||||
"name" key to "id". The "documentation" key is now an array of
|
||||
strings. Consumers of this interface must update their JSON parsing
|
||||
accordingly.
|
||||
|
||||
* The PrivateUsersOwnership= setting in .nspawn files now defaults to
|
||||
"auto" when PrivateUsers= is "pick" or "managed", matching the
|
||||
|
||||
@@ -333,7 +333,7 @@ node /org/freedesktop/sysupdate1/target/host {
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>isEnabled</literal></term>
|
||||
<term><literal>enabled</literal></term>
|
||||
<listitem><para>A boolean indicating whether this feature is enabled.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
@@ -350,7 +350,7 @@ node /org/freedesktop/sysupdate1/target/host {
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><literal>appstream</literal></term>
|
||||
<term><literal>appStream</literal></term>
|
||||
<listitem><para>An optional string that contains an HTTP/HTTPS URL to an
|
||||
<ulink url="https://wwww.freedesktop.org/software/appstream/docs/chap-CatalogData.html">appstream
|
||||
catalog</ulink> XML file containing metadata about this feature.</para></listitem>
|
||||
|
||||
@@ -39,9 +39,9 @@ static SD_VARLINK_DEFINE_STRUCT_TYPE(
|
||||
SD_VARLINK_FIELD_COMMENT("URLs to documentation for the feature."),
|
||||
SD_VARLINK_DEFINE_FIELD(documentation, SD_VARLINK_STRING, SD_VARLINK_NULLABLE|SD_VARLINK_ARRAY),
|
||||
SD_VARLINK_FIELD_COMMENT("A URL to an AppStream catalog XML file describing the feature."),
|
||||
SD_VARLINK_DEFINE_FIELD(appstream, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_DEFINE_FIELD(appStream, SD_VARLINK_STRING, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Whether the feature is enabled."),
|
||||
SD_VARLINK_DEFINE_FIELD(isEnabled, SD_VARLINK_BOOL, 0),
|
||||
SD_VARLINK_DEFINE_FIELD(enabled, SD_VARLINK_BOOL, 0),
|
||||
SD_VARLINK_FIELD_COMMENT("Whether the feature is suggested for enablement."),
|
||||
SD_VARLINK_DEFINE_FIELD(suggested, SD_VARLINK_BOOL, SD_VARLINK_NULLABLE),
|
||||
SD_VARLINK_FIELD_COMMENT("Array of IDs of the transfers (including currently disabled ones) which are controlled by this feature."),
|
||||
|
||||
@@ -2442,8 +2442,8 @@ static int feature_to_json(Context *context, const Feature *f, sd_json_variant *
|
||||
SD_JSON_BUILD_PAIR_STRING("id", f->id),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY("description", f->description),
|
||||
JSON_BUILD_PAIR_STRV_NON_EMPTY("documentation", f->documentation),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY("appstream", f->appstream),
|
||||
SD_JSON_BUILD_PAIR_BOOLEAN("isEnabled", f->enabled),
|
||||
JSON_BUILD_PAIR_STRING_NON_EMPTY("appStream", f->appstream),
|
||||
SD_JSON_BUILD_PAIR_BOOLEAN("enabled", f->enabled),
|
||||
SD_JSON_BUILD_PAIR_CONDITION(suggested >= 0, "suggested", SD_JSON_BUILD_BOOLEAN(suggested > 0)),
|
||||
JSON_BUILD_PAIR_STRV_NON_EMPTY("transfers", transfers));
|
||||
if (r < 0)
|
||||
|
||||
@@ -1420,10 +1420,10 @@ static int describe_feature(sd_bus *bus, const char *feature, Feature *ret) {
|
||||
static const sd_json_dispatch_field dispatch_table[] = {
|
||||
{ "id", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Feature, id), SD_JSON_MANDATORY },
|
||||
{ "description", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Feature, description), SD_JSON_NULLABLE },
|
||||
{ "isEnabled", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(Feature, enabled), SD_JSON_MANDATORY },
|
||||
{ "enabled", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_stdbool, offsetof(Feature, enabled), SD_JSON_MANDATORY },
|
||||
{ "suggested", SD_JSON_VARIANT_BOOLEAN, sd_json_dispatch_tristate, offsetof(Feature, suggested), SD_JSON_NULLABLE },
|
||||
{ "documentation", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(Feature, documentation), SD_JSON_NULLABLE },
|
||||
{ "appstream", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Feature, appstream), SD_JSON_NULLABLE },
|
||||
{ "appStream", SD_JSON_VARIANT_STRING, sd_json_dispatch_string, offsetof(Feature, appstream), SD_JSON_NULLABLE },
|
||||
{ "transfers", SD_JSON_VARIANT_ARRAY, sd_json_dispatch_strv, offsetof(Feature, transfers), SD_JSON_NULLABLE },
|
||||
{}
|
||||
};
|
||||
|
||||
@@ -507,9 +507,9 @@ EOF
|
||||
"https://example.com/optional-more"
|
||||
]
|
||||
' <<<"$feature_json" >/dev/null
|
||||
jq -e '.isEnabled == false' <<<"$feature_json" >/dev/null
|
||||
jq -e '.enabled == false' <<<"$feature_json" >/dev/null
|
||||
jq -e '.suggested == false' <<<"$feature_json" >/dev/null
|
||||
jq -e '.appstream == "https://example.com/optional.appstream.xml"' <<<"$feature_json" >/dev/null
|
||||
jq -e '.appStream == "https://example.com/optional.appstream.xml"' <<<"$feature_json" >/dev/null
|
||||
|
||||
suggested_json="$("$SYSUPDATE" --json=short features suggested)"
|
||||
jq -e '.id == "suggested" and .suggested == true' <<<"$suggested_json" >/dev/null
|
||||
|
||||
Reference in New Issue
Block a user