fix: iterate fix for sops.yaml not created in specified config dir - fixed!

ADP-216_sops_automation
LeeW 10 months ago
parent f86b074648
commit 892fbc2039

@ -170,17 +170,16 @@ function main(){
# VALIDATE INPUTS # VALIDATE INPUTS
keyfiles_dir="$(realpath "${keyfiles_dir}")" keyfiles_dir="$(realpath "${keyfiles_dir}")"
test -d "${keyfiles_dir}" || (echo "E: specify dir containing keyfiles; invalid dir: '${keyfiles_dir}'" && exit 1) test -d "${keyfiles_dir}" || (echo "E: specify dir containing keyfiles; invalid dir: '${keyfiles_dir}'" && exit 1)
# define sops config location
sops_config="" sops_config=""
if [[ -n "${sops_config_dir:-}" ]]; then if [[ -n "${sops_config_dir:-}" ]]; then
# user-specified
sops_config_dir="$(realpath "${sops_config_dir}")" sops_config_dir="$(realpath "${sops_config_dir}")"
# vvv possibly redundant, since the 'realpath' will fail if dir not valid
test -d "${sops_config_dir}" || (echo "E: specify dir containing .sops.yaml, invalid dir: '${sops_config_dir}'" && exit 1) test -d "${sops_config_dir}" || (echo "E: specify dir containing .sops.yaml, invalid dir: '${sops_config_dir}'" && exit 1)
sops_config="${sops_config_dir}/.sops.yaml" sops_config="${sops_config_dir}/.sops.yaml"
set -x else
touch "${sops_config}" # locate appropriate sops config if default assumption not found
fi
# locate appropriate sops config if default assumption not found
if [[ ! -e "${sops_config}" ]]; then
# dev note: '2> /dev/null' to disable debug output # dev note: '2> /dev/null' to disable debug output
sops_config="$(fn_sops_locate_config_in_git_repo 2> /dev/null)" sops_config="$(fn_sops_locate_config_in_git_repo 2> /dev/null)"
fi fi

Loading…
Cancel
Save