Repair malformed Seriatim build state directories
This commit is contained in:
@@ -60,6 +60,29 @@
|
|||||||
Seriatim binary path exists but is not a regular file:
|
Seriatim binary path exists but is not a regular file:
|
||||||
{{ seriatim_binary_path }}. Move the unexpected object before rerunning the role.
|
{{ seriatim_binary_path }}. Move the unexpected object before rerunning the role.
|
||||||
|
|
||||||
|
- name: Inspect Seriatim build state directory
|
||||||
|
ansible.builtin.stat:
|
||||||
|
path: "{{ seriatim_build_state_dir }}"
|
||||||
|
register: seriatim_build_state_dir_stat
|
||||||
|
|
||||||
|
- name: Remove malformed Seriatim build state directory object
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ seriatim_build_state_dir }}"
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- seriatim_build_state_dir_stat.stat.exists or
|
||||||
|
(seriatim_build_state_dir_stat.stat.islnk | default(false))
|
||||||
|
- not (seriatim_build_state_dir_stat.stat.isdir | default(false))
|
||||||
|
|
||||||
|
- name: Create missing Seriatim build state directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "{{ seriatim_build_state_dir }}"
|
||||||
|
state: directory
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: "0755"
|
||||||
|
when: not (seriatim_build_state_dir_stat.stat.isdir | default(false))
|
||||||
|
|
||||||
- name: Inspect Seriatim build input state
|
- name: Inspect Seriatim build input state
|
||||||
ansible.builtin.stat:
|
ansible.builtin.stat:
|
||||||
path: "{{ seriatim_build_state_dir }}/build-inputs.json"
|
path: "{{ seriatim_build_state_dir }}/build-inputs.json"
|
||||||
|
|||||||
@@ -94,6 +94,39 @@ run_converge \
|
|||||||
tee "$test_tmp/custom-path-repeat.log"
|
tee "$test_tmp/custom-path-repeat.log"
|
||||||
require_clean_recap "$test_tmp/custom-path-repeat.log"
|
require_clean_recap "$test_tmp/custom-path-repeat.log"
|
||||||
|
|
||||||
|
sudo rm -rf -- "$custom_state"
|
||||||
|
sudo install -o root -g root -m 0644 /dev/null "$custom_state"
|
||||||
|
run_converge \
|
||||||
|
-e "seriatim_binary_path=$custom_binary" \
|
||||||
|
-e "seriatim_build_state_dir=$custom_state" |
|
||||||
|
tee "$test_tmp/state-file-repair.log"
|
||||||
|
require_changed_recap "$test_tmp/state-file-repair.log"
|
||||||
|
test -d "$custom_state"
|
||||||
|
test ! -L "$custom_state"
|
||||||
|
run_converge \
|
||||||
|
-e "seriatim_binary_path=$custom_binary" \
|
||||||
|
-e "seriatim_build_state_dir=$custom_state" |
|
||||||
|
tee "$test_tmp/state-file-repair-repeat.log"
|
||||||
|
require_clean_recap "$test_tmp/state-file-repair-repeat.log"
|
||||||
|
|
||||||
|
redirected_state="$test_tmp/redirected-build-state"
|
||||||
|
sudo rm -rf -- "$custom_state"
|
||||||
|
sudo install -d -o root -g root -m 0755 "$redirected_state"
|
||||||
|
sudo ln -s "$redirected_state" "$custom_state"
|
||||||
|
run_converge \
|
||||||
|
-e "seriatim_binary_path=$custom_binary" \
|
||||||
|
-e "seriatim_build_state_dir=$custom_state" |
|
||||||
|
tee "$test_tmp/state-link-repair.log"
|
||||||
|
require_changed_recap "$test_tmp/state-link-repair.log"
|
||||||
|
test -d "$custom_state"
|
||||||
|
test ! -L "$custom_state"
|
||||||
|
test -z "$(find "$redirected_state" -mindepth 1 -maxdepth 1 -print -quit)"
|
||||||
|
run_converge \
|
||||||
|
-e "seriatim_binary_path=$custom_binary" \
|
||||||
|
-e "seriatim_build_state_dir=$custom_state" |
|
||||||
|
tee "$test_tmp/state-link-repair-repeat.log"
|
||||||
|
require_clean_recap "$test_tmp/state-link-repair-repeat.log"
|
||||||
|
|
||||||
baseline_binary=$(binary_digest)
|
baseline_binary=$(binary_digest)
|
||||||
baseline_state=$(state_digest)
|
baseline_state=$(state_digest)
|
||||||
for scenario in \
|
for scenario in \
|
||||||
|
|||||||
Reference in New Issue
Block a user