deploy: Retain staged by default

For `rpm-ostree ex livefs` we have a use case of pushing a rollback
deployment.  There's no reason this should require deleting the staged
deployment (and doing so actually breaks livefs which tries to access
it as a data source).

I was initially very conservative here, but I think it ends up
being fairly easy to retain the staged deployment.  We need to handle
two cases:

First, when the staged is *intentionally* deleted; here, we just need
to unlink the `/run` file, and then everything will be sync'd up after
reloading.

Second, (as in the livefs case) where we're retaining it,
e.g. adding a deployment to the end.  What I realized here is that
we can have the code keep `new_deployments` as view without staged,
and then when we do the final reload we'll end up re-reading it from
disk anyways.

Closes: #1672
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2018-07-06 15:23:52 +00:00
1 parent 10c2fc33f6
commit 7468600029
2 files changed
+57 -25

No files matched your search

+15 -1
View File
@@ -70,7 +70,7 @@
grep -vqFe '(staged)' status.txt
test '!' -f /run/ostree/staged-deployment
- name: Staged should be overwritten by non-staged
- name: Staged should be overwritten by non-staged as first
shell: |
set -xeuo pipefail
ostree admin deploy --stage staged-deploy
@@ -84,5 +84,19 @@
environment:
commit: "{{ rpmostree_status['deployments'][0]['checksum'] }}"
- name: Staged is retained when pushing rollback
shell: |
set -xeuo pipefail
ostree admin deploy --stage staged-deploy
test -f /run/ostree/staged-deployment
ostree admin deploy --retain-pending --not-as-default nonstaged-deploy
test -f /run/ostree/staged-deployment
ostree admin status > status.txt
grep -qFe '(staged)' status.txt
ostree admin undeploy 0
ostree admin undeploy 1
environment:
commit: "{{ rpmostree_status['deployments'][0]['checksum'] }}"
- name: Cleanup refs
shell: ostree refs --delete staged-deploy nonstaged-deploy