Support missing custom binary directories
This commit is contained in:
@@ -24,6 +24,28 @@
|
||||
seriatim_stored_fingerprint: ""
|
||||
seriatim_stored_checksum: ""
|
||||
|
||||
- name: Inspect Seriatim binary parent directory
|
||||
ansible.builtin.stat:
|
||||
path: "{{ seriatim_binary_path | dirname }}"
|
||||
register: seriatim_binary_parent_stat
|
||||
|
||||
- name: Require an existing Seriatim binary parent to be a directory
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- not seriatim_binary_parent_stat.stat.exists or seriatim_binary_parent_stat.stat.isdir
|
||||
fail_msg: >-
|
||||
Seriatim binary parent exists but is not a directory:
|
||||
{{ seriatim_binary_path | dirname }}.
|
||||
|
||||
- name: Create missing Seriatim binary parent directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ seriatim_binary_path | dirname }}"
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0755"
|
||||
when: not seriatim_binary_parent_stat.stat.exists
|
||||
|
||||
- name: Inspect installed Seriatim binary
|
||||
ansible.builtin.stat:
|
||||
path: "{{ seriatim_binary_path }}"
|
||||
|
||||
@@ -23,7 +23,7 @@ restore_default() {
|
||||
cleanup() {
|
||||
exit_status=$?
|
||||
restore_default || true
|
||||
rm -rf -- "$test_tmp"
|
||||
sudo rm -rf -- "$test_tmp"
|
||||
exit "$exit_status"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
@@ -78,6 +78,22 @@ require_changed_recap "$test_tmp/metadata-repair.log"
|
||||
run_converge | tee "$test_tmp/metadata-repair-repeat.log"
|
||||
require_clean_recap "$test_tmp/metadata-repair-repeat.log"
|
||||
|
||||
custom_binary="$test_tmp/missing-binary-parent/seriatim"
|
||||
custom_state="$test_tmp/custom-build-state"
|
||||
test ! -e "$(dirname "$custom_binary")"
|
||||
run_converge \
|
||||
-e "seriatim_binary_path=$custom_binary" \
|
||||
-e "seriatim_build_state_dir=$custom_state" |
|
||||
tee "$test_tmp/custom-path.log"
|
||||
require_changed_recap "$test_tmp/custom-path.log"
|
||||
test "$($custom_binary --version)" = 'seriatim version v1.5.0'
|
||||
test "$(stat -c '%U:%G %a' "$(dirname "$custom_binary")")" = 'root:root 755'
|
||||
run_converge \
|
||||
-e "seriatim_binary_path=$custom_binary" \
|
||||
-e "seriatim_build_state_dir=$custom_state" |
|
||||
tee "$test_tmp/custom-path-repeat.log"
|
||||
require_clean_recap "$test_tmp/custom-path-repeat.log"
|
||||
|
||||
baseline_binary=$(binary_digest)
|
||||
baseline_state=$(state_digest)
|
||||
for scenario in \
|
||||
@@ -146,4 +162,4 @@ require_clean_recap "$test_tmp/final-restore.log"
|
||||
"$playbook" -i "$inventory" tests/verify.yml
|
||||
|
||||
trap - EXIT
|
||||
rm -rf -- "$test_tmp"
|
||||
sudo rm -rf -- "$test_tmp"
|
||||
|
||||
Reference in New Issue
Block a user