From 5126b2774e0da2412585d266cedead87003d1d24 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 20 Aug 2018 17:53:56 -0400 Subject: [PATCH] Stabilize `stage` automatic update policy Now that staging is the default, there's no reason for this policy not to be stable too. Closes: #1510 Approved by: jlebon --- man/rpm-ostreed.conf.xml | 6 +++++- src/app/rpmostree-builtin-upgrade.c | 4 ++-- src/daemon/org.projectatomic.rpmostree1.xml | 2 +- src/libpriv/rpmostree-util.c | 4 ++-- tests/vmcheck/test-autoupdate-stage.sh | 8 ++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/man/rpm-ostreed.conf.xml b/man/rpm-ostreed.conf.xml index a016f8c8..d84bddf2 100644 --- a/man/rpm-ostreed.conf.xml +++ b/man/rpm-ostreed.conf.xml @@ -71,11 +71,15 @@ Boston, MA 02111-1307, USA. AutomaticUpdatePolicy= - Controls the automatic update policy. Currently "none" or "check". + Controls the automatic update policy. Currently "none", "check", or "stage". "none" disables automatic updates. "check" downloads just enough metadata to check for updates and display them in rpm-ostree status. Defaults to "none". The rpm-ostreed-automatic.timer8 unit determines the actual frequency of updates. + Finally, the "stage" policy downloads and unpacks the update, performing + any package layering. Only a small amount of work is left to be performed at + shutdown time via the ostree-finalize-staged.service systemd unit. + diff --git a/src/app/rpmostree-builtin-upgrade.c b/src/app/rpmostree-builtin-upgrade.c index 5f48f24c..c52ff96f 100644 --- a/src/app/rpmostree-builtin-upgrade.c +++ b/src/app/rpmostree-builtin-upgrade.c @@ -112,7 +112,7 @@ rpmostree_builtin_upgrade (int argc, cancellable, &os_proxy, error)) return FALSE; - /* Print a notice if ex-stage updates are enabled and the user + /* Print a notice if stage updates are enabled and the user * has requested an update manually - in that case we've * already doing basically all of `upgrade` here automatically in * the background. @@ -120,7 +120,7 @@ rpmostree_builtin_upgrade (int argc, if (!opt_automatic) { const char *policy = rpmostree_sysroot_get_automatic_update_policy (sysroot_proxy); - if (policy && g_str_equal (policy, "ex-stage")) + if (policy && g_str_equal (policy, "stage")) g_print ("note: automatic updates (%s) are enabled\n", policy); } diff --git a/src/daemon/org.projectatomic.rpmostree1.xml b/src/daemon/org.projectatomic.rpmostree1.xml index 3c046def..933e11c9 100644 --- a/src/daemon/org.projectatomic.rpmostree1.xml +++ b/src/daemon/org.projectatomic.rpmostree1.xml @@ -56,7 +56,7 @@ - + diff --git a/src/libpriv/rpmostree-util.c b/src/libpriv/rpmostree-util.c index 2cf80a74..5ac84175 100644 --- a/src/libpriv/rpmostree-util.c +++ b/src/libpriv/rpmostree-util.c @@ -1003,7 +1003,7 @@ rpmostree_auto_update_policy_to_str (RpmostreedAutomaticUpdatePolicy policy, case RPMOSTREED_AUTOMATIC_UPDATE_POLICY_CHECK: return "check"; case RPMOSTREED_AUTOMATIC_UPDATE_POLICY_STAGE: - return "ex-stage"; + return "stage"; default: return glnx_null_throw (error, "Invalid policy value %u", policy); } @@ -1019,7 +1019,7 @@ rpmostree_str_to_auto_update_policy (const char *str, *out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_NONE; else if (g_str_equal (str, "check")) *out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_CHECK; - else if (g_str_equal (str, "ex-stage")) + else if (g_str_equal (str, "stage") || g_str_equal (str, "ex-stage")) *out_policy = RPMOSTREED_AUTOMATIC_UPDATE_POLICY_STAGE; else return glnx_throw (error, "Invalid value for AutomaticUpdatePolicy: '%s'", str); diff --git a/tests/vmcheck/test-autoupdate-stage.sh b/tests/vmcheck/test-autoupdate-stage.sh index c09d397b..3402866f 100755 --- a/tests/vmcheck/test-autoupdate-stage.sh +++ b/tests/vmcheck/test-autoupdate-stage.sh @@ -34,9 +34,13 @@ vm_rpmostree cleanup -m vm_rpmostree status > status.txt assert_file_has_content status.txt 'AutomaticUpdates: disabled' +vm_change_update_policy stage +vm_rpmostree status > status.txt +assert_file_has_content_literal status.txt 'AutomaticUpdates: stage; rpm-ostreed-automatic.timer: inactive' +# And test that we still support "ex-stage" vm_change_update_policy ex-stage vm_rpmostree status > status.txt -assert_file_has_content_literal status.txt 'AutomaticUpdates: ex-stage; rpm-ostreed-automatic.timer: inactive' +assert_file_has_content_literal status.txt 'AutomaticUpdates: stage; rpm-ostreed-automatic.timer: inactive' vm_rpmostree upgrade --trigger-automatic-update-policy vm_assert_status_jq ".deployments[1][\"booted\"]" \ @@ -45,7 +49,7 @@ vm_assert_status_jq ".deployments[1][\"booted\"]" \ vm_rpmostree status -v > status.txt assert_file_has_content status.txt "Staged: yes" vm_rpmostree upgrade > upgrade.txt -assert_file_has_content_literal upgrade.txt 'note: automatic updates (ex-stage) are enabled' +assert_file_has_content_literal upgrade.txt 'note: automatic updates (stage) are enabled' # And ensure that we have new content in /etc after staging vm_cmd echo new-content-in-etc \> /etc/somenewfile vm_reboot