|
|
7d8bc5 |
From c48a889da09af0c2cc9d540fa5f3868d6f239e3e Mon Sep 17 00:00:00 2001
|
|
|
7d8bc5 |
From: Colin Walters <walters@verbum.org>
|
|
|
7d8bc5 |
Date: Mon, 13 Feb 2017 21:01:31 -0500
|
|
|
7d8bc5 |
Subject: [PATCH] daemon: Avoid erroring out on startup/status with origin
|
|
|
7d8bc5 |
unconfigured-state
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
As part of an earlier cleanup of origin parsing, we started checking
|
|
|
7d8bc5 |
the origin `unconfigured-state` even just starting the daemon, which
|
|
|
7d8bc5 |
is kind of bad.
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
It's tempting to flip the default for the parser so that we *only* check
|
|
|
7d8bc5 |
unconfigured state if we go to upgrade, but let's not do that in this patch.
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
Closes: #626
|
|
|
7d8bc5 |
Approved by: jlebon
|
|
|
7d8bc5 |
---
|
|
|
7d8bc5 |
src/daemon/rpmostree-sysroot-upgrader.c | 3 ++-
|
|
|
7d8bc5 |
src/daemon/rpmostreed-deployment-utils.c | 6 ++++--
|
|
|
7d8bc5 |
src/daemon/rpmostreed-os.c | 3 ++-
|
|
|
7d8bc5 |
tests/check/test-basic.sh | 14 +++++++++++++-
|
|
|
7d8bc5 |
4 files changed, 21 insertions(+), 5 deletions(-)
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
diff --git a/src/daemon/rpmostree-sysroot-upgrader.c b/src/daemon/rpmostree-sysroot-upgrader.c
|
|
|
7d8bc5 |
index edadde0..cdb90d4 100644
|
|
|
7d8bc5 |
--- a/src/daemon/rpmostree-sysroot-upgrader.c
|
|
|
7d8bc5 |
+++ b/src/daemon/rpmostree-sysroot-upgrader.c
|
|
|
7d8bc5 |
@@ -1321,7 +1321,8 @@ clean_pkgcache_orphans (RpmOstreeSysrootUpgrader *self,
|
|
|
7d8bc5 |
OstreeDeployment *deployment = deployments->pdata[i];
|
|
|
7d8bc5 |
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
- origin = rpmostree_origin_parse_deployment (deployment, error);
|
|
|
7d8bc5 |
+ origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
|
|
7d8bc5 |
+ error);
|
|
|
7d8bc5 |
if (!origin)
|
|
|
7d8bc5 |
return FALSE;
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
diff --git a/src/daemon/rpmostreed-deployment-utils.c b/src/daemon/rpmostreed-deployment-utils.c
|
|
|
7d8bc5 |
index 9b2fb9a..43c814f 100644
|
|
|
7d8bc5 |
--- a/src/daemon/rpmostreed-deployment-utils.c
|
|
|
7d8bc5 |
+++ b/src/daemon/rpmostreed-deployment-utils.c
|
|
|
7d8bc5 |
@@ -185,7 +185,8 @@ rpmostreed_deployment_generate_variant (OstreeDeployment *deployment,
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
id = rpmostreed_deployment_generate_id (deployment);
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
- origin = rpmostree_origin_parse_deployment (deployment, error);
|
|
|
7d8bc5 |
+ origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
|
|
7d8bc5 |
+ error);
|
|
|
7d8bc5 |
if (!origin)
|
|
|
7d8bc5 |
return NULL;
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
@@ -254,7 +255,8 @@ rpmostreed_commit_generate_cached_details_variant (OstreeDeployment *deployment,
|
|
|
7d8bc5 |
{
|
|
|
7d8bc5 |
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
- origin = rpmostree_origin_parse_deployment (deployment, error);
|
|
|
7d8bc5 |
+ origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
|
|
7d8bc5 |
+ error);
|
|
|
7d8bc5 |
if (!origin)
|
|
|
7d8bc5 |
return NULL;
|
|
|
7d8bc5 |
origin_refspec = g_strdup (rpmostree_origin_get_refspec (origin));
|
|
|
7d8bc5 |
diff --git a/src/daemon/rpmostreed-os.c b/src/daemon/rpmostreed-os.c
|
|
|
7d8bc5 |
index ded637d..3fde7da 100644
|
|
|
7d8bc5 |
--- a/src/daemon/rpmostreed-os.c
|
|
|
7d8bc5 |
+++ b/src/daemon/rpmostreed-os.c
|
|
|
7d8bc5 |
@@ -1166,7 +1166,8 @@ rpmostreed_os_load_internals (RpmostreedOS *self, GError **error)
|
|
|
7d8bc5 |
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
/* Don't fail here for unknown origin types */
|
|
|
7d8bc5 |
- origin = rpmostree_origin_parse_deployment (merge_deployment, NULL);
|
|
|
7d8bc5 |
+ origin = rpmostree_origin_parse_deployment_ex (merge_deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
|
|
7d8bc5 |
+ NULL);
|
|
|
7d8bc5 |
if (origin)
|
|
|
7d8bc5 |
{
|
|
|
7d8bc5 |
cached_update = rpmostreed_commit_generate_cached_details_variant (merge_deployment,
|
|
|
7d8bc5 |
diff --git a/tests/check/test-basic.sh b/tests/check/test-basic.sh
|
|
|
7d8bc5 |
index 8b7baa6..670a668 100755
|
|
|
7d8bc5 |
--- a/tests/check/test-basic.sh
|
|
|
7d8bc5 |
+++ b/tests/check/test-basic.sh
|
|
|
7d8bc5 |
@@ -24,7 +24,7 @@ export RPMOSTREE_SUPPRESS_REQUIRES_ROOT_CHECK=yes
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
ensure_dbus
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
-echo "1..14"
|
|
|
7d8bc5 |
+echo "1..15"
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
setup_os_repository "archive-z2" "syslinux"
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
@@ -145,6 +145,18 @@ $OSTREE remote add secureos file://$(pwd)/testos-repo
|
|
|
7d8bc5 |
rpm-ostree rebase --os=testos secureos:$branch gpg-signed
|
|
|
7d8bc5 |
echo "ok deploy from remote with unsigned and signed commits"
|
|
|
7d8bc5 |
|
|
|
7d8bc5 |
+originpath=$(ostree admin --sysroot=sysroot --print-current-dir).origin
|
|
|
7d8bc5 |
+echo "unconfigured-state=Access to TestOS requires ONE BILLION DOLLARS" >> ${originpath}
|
|
|
7d8bc5 |
+pid=$(pgrep -u $(id -u) -f 'rpm-ostree.*daemon')
|
|
|
7d8bc5 |
+test -n "${pid}" || assert_not_reached "failed to find rpm-ostree pid"
|
|
|
7d8bc5 |
+kill -9 ${pid}
|
|
|
7d8bc5 |
+rpm-ostree status
|
|
|
7d8bc5 |
+if rpm-ostree upgrade --os=testos 2>err.txt; then
|
|
|
7d8bc5 |
+ assert_not_reached "Upgraded from unconfigured-state"
|
|
|
7d8bc5 |
+fi
|
|
|
7d8bc5 |
+assert_file_has_content err.txt 'ONE BILLION DOLLARS'
|
|
|
7d8bc5 |
+echo "ok unconfigured status"
|
|
|
7d8bc5 |
+
|
|
|
7d8bc5 |
# Ensure it returns an error when passing a wrong option.
|
|
|
7d8bc5 |
rpm-ostree --help | awk '/^$/ {in_commands=0} {if(in_commands==1){print $0}} /^Builtin Commands:/ {in_commands=1}' > commands
|
|
|
7d8bc5 |
while read command; do
|
|
|
7d8bc5 |
--
|
|
|
7d8bc5 |
2.9.3
|
|
|
7d8bc5 |
|