Skip to content

Commit

Permalink
daemon/deploy: allow redeploying livefs booted commit
Browse files Browse the repository at this point in the history
Also something I noticed while working on #981. When sitting on a livefs
commit, once a user does `rpm-ostree cleanup --pending --rollback`, it's
impossible to redeploy the same booted commit. Let's allow users to do
this.

Closes: #984
Approved by: cgwalters
  • Loading branch information
jlebon authored and rh-atomic-bot committed Sep 12, 2017
1 parent c08ca8f commit 077d7c1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/daemon/rpmostreed-transaction-types.c
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,23 @@ deploy_transaction_execute (RpmostreedTransaction *transaction,
&base_changed, cancellable, error))
return FALSE;

changed = changed || base_changed;
if (base_changed)
changed = TRUE;
else
{
/* If we're on a live deployment, then allow redeploying a clean version of the
* same base commit. This is useful if e.g. the pushed rollback was cleaned up. */

OstreeDeployment *deployment =
rpmostree_sysroot_upgrader_get_merge_deployment (upgrader);

gboolean is_live;
if (!rpmostree_syscore_deployment_is_live (sysroot, deployment, &is_live, error))
return FALSE;

if (is_live)
changed = TRUE;
}
}

/* let's figure out if those new overrides are valid and if so, canonicalize
Expand Down
6 changes: 6 additions & 0 deletions tests/vmcheck/test-livefs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ vm_cmd cat /etc/test-livefs-with-etc.conf > test-livefs-with-etc.conf
assert_file_has_content test-livefs-with-etc.conf "custom"
echo "ok livefs preserved modified config"

vm_rpmostree cleanup -p
# make sure there's no layering going on somehow
vm_assert_status_jq '.deployments[0]["base-checksum"]|not'
vm_rpmostree deploy $(vm_get_booted_deployment_info checksum)
echo "ok livefs redeploy booted commit"

reset
vm_rpmostree install /tmp/vmcheck/yumrepo/packages/x86_64/foo-1.0-1.x86_64.rpm
vm_rpmostree ex livefs
Expand Down

0 comments on commit 077d7c1

Please sign in to comment.