You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/integration/targets/ansible-vault/script/vault-secret.sh

22 lines
488 B
Bash

#!/usr/bin/env bash
set -eu
basename="$(basename "$0")"
dirname="$(basename "$(dirname "$0")")"
basename_prefix="get-password"
default_password="foo-bar"
case "${basename}" in
"${basename_prefix}"-*)
password="${default_password}-${basename#"${basename_prefix}-"}"
;;
*)
password="${default_password}"
;;
esac
# the password is different depending on the path used (direct or symlink)
# it would be the same if symlink is 'resolved'.
echo "${password}_${dirname}"