upgrader/vmcheck: fix kargs get lost when doing multiple operations
Kernel arguments added from `rpm-ostree ex kargs` can be lost after doing multiple deploy related operations (e.g upgrade, install etc). The root cause of that is because when doing the deployment (ostree_sysroot_deploy_tree), the kernel arguments from the pending deployment were never passed in. This commit adds logic to pass in kernel arguments from pending deployment to fix the above mentioned problem Closes: https://github.com/projectatomic/rpm-ostree/issues/1392 Closes: #1420 Approved by: cgwalters
This commit is contained in:
parent
8b66c830b7
commit
92f08ea80b
@ -1216,8 +1216,19 @@ rpmostree_sysroot_upgrader_deploy (RpmOstreeSysrootUpgrader *self,
|
||||
const gboolean use_staging = staging_is_configured &&
|
||||
ostree_sysroot_get_booted_deployment (self->sysroot) != NULL;
|
||||
|
||||
/* Fix for https://github.com/projectatomic/rpm-ostree/issues/1392,
|
||||
* when kargs_strv is empty, we port those directly from pending
|
||||
* deployment if there is one */
|
||||
if (!self->kargs_strv)
|
||||
{
|
||||
OstreeBootconfigParser *bootconfig = ostree_deployment_get_bootconfig (self->origin_merge_deployment);
|
||||
const char *options = ostree_bootconfig_parser_get (bootconfig, "options");
|
||||
self->kargs_strv = g_strsplit (options, " ", -1);
|
||||
}
|
||||
|
||||
g_autoptr(GKeyFile) origin = rpmostree_origin_dup_keyfile (self->origin);
|
||||
g_autoptr(OstreeDeployment) new_deployment = NULL;
|
||||
|
||||
if (use_staging)
|
||||
{
|
||||
if (!ostree_sysroot_stage_tree (self->sysroot, self->osname,
|
||||
|
@ -85,6 +85,9 @@ assert_not_file_has_content tmp_conf.txt "REPLACE_MULTI_TEST=TEST"
|
||||
assert_file_has_content tmp_conf.txt "REPLACE_MULTI_TEST=NUMBERTWO"
|
||||
echo "ok replacing value from multi-valued key pairs"
|
||||
|
||||
# Reboot into the new deployment, to prepare for a rollback
|
||||
vm_reboot
|
||||
|
||||
# Do a rollback and check if the content matches original booted conf (read in the beginning of the test)
|
||||
vm_rpmostree rollback
|
||||
for arg in $(vm_cmd grep ^options /boot/loader/entries/ostree-$osname-0.conf | sed -e 's,options ,,'); do
|
||||
@ -128,3 +131,15 @@ for arg in $(vm_rpmostree ex kargs --import-proc-cmdline | tail -n +2); do
|
||||
esac
|
||||
done
|
||||
echo "ok import kargs from current deployment"
|
||||
|
||||
# Test for https://github.com/projectatomic/rpm-ostree/issues/1392
|
||||
vm_rpmostree ex kargs --append=PACKAGE=TEST
|
||||
vm_build_rpm foo
|
||||
vm_rpmostree install foo
|
||||
|
||||
vm_cmd grep ^options /boot/loader/entries/ostree-$osname-0.conf > kargs.txt
|
||||
assert_file_has_content_literal kargs.txt 'PACKAGE=TEST'
|
||||
echo "ok kargs with multiple operations"
|
||||
vm_rpmostree ex kargs > kargs.txt
|
||||
assert_file_has_content_literal kargs.txt 'PACKAGE=TEST'
|
||||
echo "ok kargs display with multiple operations"
|
||||
|
Loading…
Reference in New Issue
Block a user