mirror of
https://github.com/techno-tim/k3s-ansible.git
synced 2026-08-09 15:33:18 +02:00
bbca35331d
- Use the Molecule Ubuntu SSH settings when creating its linked-clone master - Bound a prewarm SSH failure to ten minutes - Verify the generated Vagrantfile in the master-preparation fixture
31 lines
906 B
Bash
Executable File
31 lines
906 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -Eeuo pipefail
|
|
|
|
printf '%s\n' "$*" >> "$MOCK_VAGRANT_LOG"
|
|
case "${1:-}" in
|
|
up)
|
|
if [[ -n "${MOCK_VAGRANTFILE_CAPTURE:-}" ]]; then
|
|
cp -- "$VAGRANT_CWD/Vagrantfile" "$MOCK_VAGRANTFILE_CAPTURE"
|
|
fi
|
|
counter_file="$MOCK_VBOX_STATE/counter"
|
|
counter=0
|
|
[[ ! -r "$counter_file" ]] || counter="$(cat "$counter_file")"
|
|
counter=$((counter + 1))
|
|
printf '%s\n' "$counter" > "$counter_file"
|
|
uuid="00000000-0000-4000-8000-$(printf '%012d' "$counter")"
|
|
vm_dir="$MOCK_VBOX_ROOT/master-$counter"
|
|
mkdir -p -- "$vm_dir"
|
|
: > "$vm_dir/master.vbox"
|
|
: > "$vm_dir/master.vdi"
|
|
printf '%s\n' \
|
|
'VMState="poweroff"' \
|
|
'groups="/"' \
|
|
"CfgFile=\"$vm_dir/master.vbox\"" \
|
|
"SATA-0-0=\"$vm_dir/master.vdi\"" > "$MOCK_VBOX_STATE/vm-$uuid"
|
|
printf '%s\n' "$uuid" > "$MOCK_BOX_DIR/master_id"
|
|
;;
|
|
destroy) ;;
|
|
*) exit 2 ;;
|
|
esac
|