ostree-sysroot: make simple_write_deployment smarter
This is a follow-up to https://github.com/ostreedev/ostree/pull/1097. We make simple_write_deployment smart enough so that it can be used for rpm-ostree's purposes. This is mostly an upstreaming of logic that already existed there. Notably we correctly append NOT_DEFAULT deployments *after* the booted deployment and we now support RETAIN_PENDING and RETAIN_ROLLBACK flags to have more granularity on deployment pruning. Expose these new flags on the CLI using new options (as well as expose the previously existing NOT_DEFAULT flag as --not-as-default). I couldn't add tests for --retain-pending because the merge deployment is always the topmost one. Though I did check that it worked in a VM. Closes: #1110 Approved by: cgwalters
This commit is contained in:
1 parent
d0f40a6af8
commit
9342be6e34
9 files changed
+143
-41
No files matched your search
+33
-2
@@ -19,6 +19,8 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..$((21 + ${extra_admin_tests:-0}))"
|
||||
|
||||
function validate_bootloader() {
|
||||
cd ${test_tmpdir};
|
||||
bootloader=""
|
||||
@@ -130,6 +132,8 @@ rm -r sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/testdirectory
|
||||
rm sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
|
||||
ln -s /ENOENT sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/a-new-broken-symlink
|
||||
${CMD_PREFIX} ostree admin deploy --retain --os=testos testos:testos/buildmaster/x86_64-runtime
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
linktarget=$(readlink sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-broken-symlink)
|
||||
test "${linktarget}" = /ENOENT
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/os-release 'NAME=TestOS'
|
||||
@@ -138,9 +142,36 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/a-new-c
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
|
||||
echo "ok deploy with modified /etc"
|
||||
|
||||
# we now have 5 deployments, let's bring that back down to 1
|
||||
for i in $(seq 4); do
|
||||
${CMD_PREFIX} ostree admin undeploy 0
|
||||
done
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-testos-1.conf
|
||||
assert_not_has_file sysroot/boot/loader/entries/ostree-otheros-1.conf
|
||||
${CMD_PREFIX} ostree admin deploy --not-as-default --os=otheros testos:testos/buildmaster/x86_64-runtime
|
||||
assert_has_dir sysroot/boot/loader.0
|
||||
assert_not_has_dir sysroot/boot/loader.1
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-testos-0.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-otheros-1.conf
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
|
||||
echo "ok deploy --not-as-default"
|
||||
|
||||
${CMD_PREFIX} ostree admin deploy --retain-rollback --os=otheros testos:testos/buildmaster/x86_64-runtime
|
||||
assert_not_has_dir sysroot/boot/loader.0
|
||||
assert_has_dir sysroot/boot/loader.1
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-otheros-0.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-testos-1.conf
|
||||
assert_has_file sysroot/boot/loader/entries/ostree-otheros-2.conf
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
|
||||
echo "ok deploy --retain-rollback"
|
||||
|
||||
os_repository_new_commit
|
||||
${CMD_PREFIX} ostree --repo=sysroot/ostree/repo pull-local --remote=testos testos-repo testos/buildmaster/x86_64-runtime
|
||||
newrev=$(${CMD_PREFIX} ostree --repo=sysroot/ostree/repo rev-parse testos:testos/buildmaster/x86_64-runtime)
|
||||
@@ -153,7 +184,7 @@ assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/os-r
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/a-new-default-config-file "a new default config file"
|
||||
assert_file_has_content sysroot/ostree/deploy/testos/deploy/${newrev}.0/etc/new-default-dir/moo "a new default dir and file"
|
||||
# And persist /etc changes from before
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.3/etc/aconfigfile
|
||||
assert_not_has_file sysroot/ostree/deploy/testos/deploy/${rev}.4/etc/aconfigfile
|
||||
${CMD_PREFIX} ostree admin status
|
||||
validate_bootloader
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..19"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive-z2" "grub2 ostree-grub-generator"
|
||||
|
||||
extra_admin_tests=0
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
@@ -19,13 +19,13 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..22"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive-z2" "syslinux"
|
||||
|
||||
extra_admin_tests=3
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
# Test the legacy dirs
|
||||
|
||||
@@ -20,13 +20,13 @@
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "1..20"
|
||||
|
||||
. $(dirname $0)/libtest.sh
|
||||
|
||||
# Exports OSTREE_SYSROOT so --sysroot not needed.
|
||||
setup_os_repository "archive-z2" "uboot"
|
||||
|
||||
extra_admin_tests=1
|
||||
|
||||
. $(dirname $0)/admin-test.sh
|
||||
|
||||
cd ${test_tmpdir}
|
||||
|
||||
Reference in new issue
Block a user