daemon: Avoid erroring out on startup/status with origin unconfigured-state
As part of an earlier cleanup of origin parsing, we started checking the origin `unconfigured-state` even just starting the daemon, which is kind of bad. It's tempting to flip the default for the parser so that we *only* check unconfigured state if we go to upgrade, but let's not do that in this patch. Closes: #626 Approved by: jlebon
This commit is contained in:
parent
ae90a9d2b8
commit
775c7819b7
@ -1335,7 +1335,8 @@ clean_pkgcache_orphans (OstreeSysroot *sysroot,
|
|||||||
OstreeDeployment *deployment = deployments->pdata[i];
|
OstreeDeployment *deployment = deployments->pdata[i];
|
||||||
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
||||||
|
|
||||||
origin = rpmostree_origin_parse_deployment (deployment, error);
|
origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
||||||
|
error);
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
@ -191,7 +191,8 @@ rpmostreed_deployment_generate_variant (OstreeDeployment *deployment,
|
|||||||
|
|
||||||
id = rpmostreed_deployment_generate_id (deployment);
|
id = rpmostreed_deployment_generate_id (deployment);
|
||||||
|
|
||||||
origin = rpmostree_origin_parse_deployment (deployment, error);
|
origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
||||||
|
error);
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@ -281,7 +282,8 @@ rpmostreed_commit_generate_cached_details_variant (OstreeDeployment *deployment,
|
|||||||
{
|
{
|
||||||
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
||||||
|
|
||||||
origin = rpmostree_origin_parse_deployment (deployment, error);
|
origin = rpmostree_origin_parse_deployment_ex (deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
||||||
|
error);
|
||||||
if (!origin)
|
if (!origin)
|
||||||
return NULL;
|
return NULL;
|
||||||
origin_refspec = g_strdup (rpmostree_origin_get_refspec (origin));
|
origin_refspec = g_strdup (rpmostree_origin_get_refspec (origin));
|
||||||
|
@ -1214,7 +1214,8 @@ rpmostreed_os_load_internals (RpmostreedOS *self, GError **error)
|
|||||||
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
g_autoptr(RpmOstreeOrigin) origin = NULL;
|
||||||
|
|
||||||
/* Don't fail here for unknown origin types */
|
/* Don't fail here for unknown origin types */
|
||||||
origin = rpmostree_origin_parse_deployment (merge_deployment, NULL);
|
origin = rpmostree_origin_parse_deployment_ex (merge_deployment, RPMOSTREE_ORIGIN_PARSE_FLAGS_IGNORE_UNCONFIGURED,
|
||||||
|
NULL);
|
||||||
if (origin)
|
if (origin)
|
||||||
{
|
{
|
||||||
cached_update = rpmostreed_commit_generate_cached_details_variant (merge_deployment,
|
cached_update = rpmostreed_commit_generate_cached_details_variant (merge_deployment,
|
||||||
|
@ -24,7 +24,7 @@ export RPMOSTREE_SUPPRESS_REQUIRES_ROOT_CHECK=yes
|
|||||||
|
|
||||||
ensure_dbus
|
ensure_dbus
|
||||||
|
|
||||||
echo "1..15"
|
echo "1..16"
|
||||||
|
|
||||||
setup_os_repository "archive-z2" "syslinux"
|
setup_os_repository "archive-z2" "syslinux"
|
||||||
|
|
||||||
@ -133,6 +133,18 @@ $OSTREE remote add secureos file://$(pwd)/testos-repo
|
|||||||
rpm-ostree rebase --os=testos secureos:$branch gpg-signed
|
rpm-ostree rebase --os=testos secureos:$branch gpg-signed
|
||||||
echo "ok deploy from remote with unsigned and signed commits"
|
echo "ok deploy from remote with unsigned and signed commits"
|
||||||
|
|
||||||
|
originpath=$(ostree admin --sysroot=sysroot --print-current-dir).origin
|
||||||
|
echo "unconfigured-state=Access to TestOS requires ONE BILLION DOLLARS" >> ${originpath}
|
||||||
|
pid=$(pgrep -u $(id -u) -f 'rpm-ostree.*daemon')
|
||||||
|
test -n "${pid}" || assert_not_reached "failed to find rpm-ostree pid"
|
||||||
|
kill -9 ${pid}
|
||||||
|
rpm-ostree status
|
||||||
|
if rpm-ostree upgrade --os=testos 2>err.txt; then
|
||||||
|
assert_not_reached "Upgraded from unconfigured-state"
|
||||||
|
fi
|
||||||
|
assert_file_has_content err.txt 'ONE BILLION DOLLARS'
|
||||||
|
echo "ok unconfigured status"
|
||||||
|
|
||||||
# Ensure it returns an error when passing a wrong option.
|
# Ensure it returns an error when passing a wrong option.
|
||||||
rpm-ostree --help | awk '/^$/ {in_commands=0} {if(in_commands==1){print $0}} /^Builtin Commands:/ {in_commands=1}' > commands
|
rpm-ostree --help | awk '/^$/ {in_commands=0} {if(in_commands==1){print $0}} /^Builtin Commands:/ {in_commands=1}' > commands
|
||||||
while read command; do
|
while read command; do
|
||||||
|
Loading…
Reference in New Issue
Block a user