Skip to content

Commit

Permalink
Deployment: add ostree.endoflife
Browse files Browse the repository at this point in the history
When metadata contains ostree.endoflife attribute,
its information will be added to the deployment Variant,
which will later be shown in rpm-ostree status command
  • Loading branch information
peterbaouoft committed Jul 21, 2017
1 parent 1f3ebba commit 0522b95
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/app/rpmostree-builtin-status.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy,
const gchar *os_name;
const gchar *checksum;
const gchar *version_string;
const gchar *end_of_life_string;
const gchar *unlocked;
const gchar *live_inprogress;
const gchar *live_replaced;
Expand Down Expand Up @@ -563,6 +564,11 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy,
print_kv ("Unlocked", max_key_len, unlocked);
g_print ("%s%s", bold_suffix, red_suffix);
}
/* look for ostree.endoflife attribute in the deployment */
g_variant_dict_lookup (dict, "ostree.endoflife", "&s", &end_of_life_string);

if (end_of_life_string)
g_print ("\n end-of-life: %s", end_of_life_string);
}

return TRUE;
Expand Down
11 changes: 10 additions & 1 deletion src/daemon/rpmostreed-deployment-utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,21 @@ variant_add_commit_details (GVariantDict *dict,
{
g_autoptr(GVariant) metadata = NULL;
g_autofree gchar *version_commit = NULL;
g_autofree gchar *end_of_life = NULL;
guint64 timestamp = 0;

timestamp = ostree_commit_get_timestamp (commit);
metadata = g_variant_get_child_value (commit, 0);
if (metadata != NULL)
g_variant_lookup (metadata, "version", "s", &version_commit);
{
g_variant_lookup (metadata, "version", "s", &version_commit);
/* only add the attribute for the base commit */
if (prefix != NULL)
g_variant_lookup (metadata, "ostree.endoflife", "s", &end_of_life);
}

if (end_of_life != NULL)
g_variant_dict_insert (dict, "ostree.endoflife", "s", end_of_life);

if (version_commit != NULL)
g_variant_dict_insert (dict, glnx_strjoina (prefix ?: "", "version"),
Expand Down

0 comments on commit 0522b95

Please sign in to comment.