diff --git a/bin/update_sops.sh b/bin/update_sops.sh index b290fc1..dbcef9a 100755 --- a/bin/update_sops.sh +++ b/bin/update_sops.sh @@ -195,7 +195,9 @@ function main(){ done fi if [[ "${opt_find_secrets}" -eq 1 ]]; then + # BAHHH https://stackoverflow.com/questions/9612090/how-to-loop-through-file-names-returned-by-find secrets_file_list+=("$(find "${sops_config_dir}" -name secrets.yaml)") + exit fi # /VALIDATE INPUTS # /OPTIONS: ARGPARSING and VALIDATION diff --git a/verify/test.sh b/verify/test.sh index b567796..90eb04a 100755 --- a/verify/test.sh +++ b/verify/test.sh @@ -81,9 +81,12 @@ fi if [[ 1 -eq 1 ]]; then >&2 echo -e "# ---\n# TEST: auto-find secrets files" # SETUP - _tmp_mock_secrets_filepath='mock_hierarchy/secrets.yaml' - mkdir -p "$(dirname "${_tmp_mock_secrets_filepath}")" - touch "${_tmp_mock_secrets_filepath}" + _tmp_mock_secrets_filepath_1='mock_hierarchy/one/secrets.yaml' + mkdir -p "$(dirname "${_tmp_mock_secrets_filepath_1}")" + touch "${_tmp_mock_secrets_filepath_1}" + _tmp_mock_secrets_filepath_2='mock_hierarchy/two/secrets.yaml' + mkdir -p "$(dirname "${_tmp_mock_secrets_filepath_2}")" + touch "${_tmp_mock_secrets_filepath_2}" # RUN # set -x # suspend strict: check output for errors @@ -91,14 +94,17 @@ if [[ 1 -eq 1 ]]; then # move 'set -x' within the sub-shell, otherwise all output dumped to tty # ... bug: stderr still gets printed, not sure why. E.g. '# RUN: sops updatekeys mock_secrets.yaml' _out="$(set -x; ../bin/update_sops.sh --find_secrets -s "${secrets_file}" 2>&1 )" + echo "$_out}" # re-enable strict set -e set +x - grep "${_tmp_mock_secrets_filepath}" <<< "${_out}" + grep "${_tmp_mock_secrets_filepath_1}" <<< "${_out}" + grep "${_tmp_mock_secrets_filepath_2}" <<< "${_out}" grep "${secrets_file}" <<< "${_out}" set -e # TEARDOWN - rm -rf "${_tmp_mock_secrets_filepath}" + rm -rf "${_tmp_mock_secrets_filepath_1}" + rm -rf "${_tmp_mock_secrets_filepath_2}" # enmesh: restore, since this particular one is checked in git checkout "${PWD}/.sops.yaml" > /dev/null 2>&1 else