diff options
author | Colin Walters <walters@verbum.org> | 2018-02-23 14:23:38 -0500 |
---|---|---|
committer | Atomic Bot <atomic-devel@projectatomic.io> | 2018-02-26 19:06:59 +0000 |
commit | c40a47e965d139cf6e72192bd582098a635b72f4 (patch) | |
tree | a020e001e6f00a1aa1640514b4d8bda95f323474 /src/ostree/ot-admin-builtin-upgrade.c | |
parent | 2f5a34bed98475b966de3c41bcd0275dc4bb4388 (diff) | |
download | ostree-c40a47e965d139cf6e72192bd582098a635b72f4.tar.gz |
sysroot: Add API to clean up transient keys in origin files
The `origin/unlocked` and `origin/override-commit` keys are examples of state
that's really transient; we don't want to maintain them across upgrades. Right
now there are bits for this in both `ostree admin upgrade` as well as in
rpm-ostree.
This new API will slightly clean up both cases, but it's really prep for adding
a concept of deployment "pinning" that will live in the new
`libostree-transient` group.
Closes: #1464
Approved by: jlebon
Diffstat (limited to 'src/ostree/ot-admin-builtin-upgrade.c')
-rw-r--r-- | src/ostree/ot-admin-builtin-upgrade.c | 23 |
1 files changed, 4 insertions, 19 deletions
diff --git a/src/ostree/ot-admin-builtin-upgrade.c b/src/ostree/ot-admin-builtin-upgrade.c index e42ded6c..1b6a0253 100644 --- a/src/ostree/ot-admin-builtin-upgrade.c +++ b/src/ostree/ot-admin-builtin-upgrade.c @@ -88,33 +88,18 @@ ot_admin_builtin_upgrade (int argc, char **argv, OstreeCommandInvocation *invoca g_autoptr(GKeyFile) origin = ostree_sysroot_upgrader_dup_origin (upgrader); if (origin != NULL) { - gboolean origin_changed = FALSE; - + /* Should we consider requiring --discard-hotfix here? */ + ostree_deployment_origin_remove_transient_state (origin); if (opt_override_commit != NULL) { /* Override the commit to pull and deploy. */ g_key_file_set_string (origin, "origin", "override-commit", opt_override_commit); - origin_changed = TRUE; } - else - { - /* Strip any override-commit from the origin file so - * we always upgrade to the latest available commit. */ - origin_changed = g_key_file_remove_key (origin, "origin", - "override-commit", NULL); - } - - /* Should we consider requiring --discard-hotfix here? */ - origin_changed |= g_key_file_remove_key (origin, "origin", "unlocked", NULL); - if (origin_changed) - { - /* XXX GCancellable parameter is not used. */ - if (!ostree_sysroot_upgrader_set_origin (upgrader, origin, NULL, error)) - return FALSE; - } + if (!ostree_sysroot_upgrader_set_origin (upgrader, origin, NULL, error)) + return FALSE; } gboolean changed; |