refactor - move function up with other functions

was mixed in between non-function code
ADP-216_sops_automation
LeeW 10 months ago
parent d07f106c67
commit c34a767076

@ -162,6 +162,19 @@ EOM
echo " ${fpr_list[${ind_2nd_last}]}" echo " ${fpr_list[${ind_2nd_last}]}"
} }
fn_sops_updatekeys_and_verify(){
# call 'sops updatekeys' and dump contents of file so end user can visually verify functionality
sops_enc_file="${1}";shift;
# update keys in secrets file
test -e "${sops_enc_file}" || exit 1
# "update the keys of SOPS files using the config file"
sops updatekeys "${sops_enc_file}"
# verify: dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
}
# BEGIN # BEGIN
if [[ "${opt_list_roles}" -eq 1 ]]; then if [[ "${opt_list_roles}" -eq 1 ]]; then
# list available roles and exit # list available roles and exit
@ -186,17 +199,6 @@ pushd "${keyfiles_dir}" > /dev/null 2>&1
popd > /dev/null 2>&1 popd > /dev/null 2>&1
# VERIFY # VERIFY
fn_sops_updatekeys_and_verify(){
sops_enc_file="${1}";shift;
# update keys in secrets file
test -e "${sops_enc_file}" || exit 1
# "update the keys of SOPS files using the config file"
sops updatekeys "${sops_enc_file}"
# verify: dump secrets, GPG_TTY src: https://www.varokas.com/secrets-in-code-with-mozilla-sops/
GPG_TTY=$(tty) sops -d "${sops_enc_file}"
}
if [[ "${#secrets_file_list[@]}" != "0" ]]; then if [[ "${#secrets_file_list[@]}" != "0" ]]; then
for secrets_file in "${secrets_file_list[@]}"; do for secrets_file in "${secrets_file_list[@]}"; do
fn_sops_updatekeys_and_verify "${secrets_file}" fn_sops_updatekeys_and_verify "${secrets_file}"

Loading…
Cancel
Save