Skip to content

Commit 936dd97

Browse files
committed
Fix path references to Ansible vault when running with Docker
1 parent 7989d2e commit 936dd97

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

lib/actions/vault.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ action_vault(){
1414
vault_run_command=("ansible-vault")
1515
run_type="local"
1616
else
17-
vault_run_command=("run_ansible" "--mount-path" "$(pwd)" "ansible-vault")
17+
vault_run_command=("run_ansible" "--mount-path" "$(pwd):/ansible" "ansible-vault")
1818
run_type="docker"
1919
fi
2020

lib/functions.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ set_ansible_vault_args() {
13511351
fi
13521352
fi
13531353

1354-
vault_args+=("--vault-password-file" ".vault-password")
1354+
vault_args+=("--vault-password-file" "/ansible/.vault-password")
13551355
elif is_encrypted_with_ansible_vault "$variable_file" || is_encrypted_with_ansible_vault ".spin-inventory.ini"; then
13561356
echo "${BOLD}${YELLOW}🔐 '.vault-password' file not found. You will be prompted to enter your vault password.${RESET}" >&2
13571357
vault_args+=("--ask-vault-pass")
@@ -1361,6 +1361,9 @@ set_ansible_vault_args() {
13611361
}
13621362

13631363
setup_color() {
1364+
# Disable debug tracing temporarily
1365+
{ set +x; } 2>/dev/null
1366+
13641367
RAINBOW="
13651368
$(printf '\033[38;5;196m')
13661369
$(printf '\033[38;5;202m')
@@ -1374,6 +1377,11 @@ setup_color() {
13741377
BOLD=$(printf '\033[1m')
13751378
RESET=$(printf '\033[m')
13761379
MAGENTA=$(printf '\033[1;35m')
1380+
1381+
# Restore debug tracing if it was enabled
1382+
if [[ "${SPIN_DEBUG:-false}" == "true" ]]; then
1383+
set -x
1384+
fi
13771385
}
13781386

13791387
show_existing_files_warning() {

0 commit comments

Comments
 (0)