phase1: update script, shift around dir responsibility

ADP-179_sops_manage_keys
LeeW 11 months ago
parent d76e993582
commit bc1bc225e5

@ -2,8 +2,8 @@
# Purpose: manage .sops.yaml based on gpg keys in the same dir _and_ verify correct configuration
set -euo pipefail
sops_config_dir="$(realpath "${1?"E: specify dir containing .sops.yaml"}")"; shift;
keyfiles_dir="$(realpath "${1?"E: specify dir containing keyfiles"}")"; shift;
sops_config_dir="$(realpath "${1?"E: specify dir containing .sops.yaml"}")"; shift;
sops_config="${sops_config_dir}/.sops.yaml"
secrets_file="${1:-0}"
@ -82,10 +82,7 @@ fn_verify_sops_config(){
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
}
if [[ "${secrets_file}" != "0" ]]; then
pushd "${sops_config_dir}" > /dev/null 2>&1
fn_verify_sops_config "${secrets_file}"
popd > /dev/null 2>&1
echo "# SUCESS: all users with keys in this dir should have functional keys"
else
echo "# WARN: no secrets file passed in, make sure to call 'sops updatekeys' on secrets files"

@ -15,4 +15,4 @@ secrets_file="mock_secrets.yaml"
# ./bin/update_sops.sh "${curdir}" "${PWD}"/
set -x
../bin/update_sops.sh "${sops_cfg_dir}" "${keys_dir}"/ "${secrets_file}"
../bin/update_sops.sh "${keys_dir}" "${sops_cfg_dir}" "${secrets_file}"

Loading…
Cancel
Save