From 735ac583d5159f5a01adb0fc35e59173c9ff3843 Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Mon, 23 Sep 2019 13:32:17 +0100 Subject: [PATCH] Fix template command to not print list of deleted files For all wrapped Helm commands the list of decrypted files is printed as they get removed at the end of plugin execution. For the `template` command this is undesired, as it means you cannot simply run `helm secrets template` and get valid YAML output. This change suppresses the output of deleted files for the `template` only, meaning it does not alter the behavior of other commands, but just fixes the `template` command to work as I imagine most people would expect it to work. [Fixes issues #126 and #132] --- secrets.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/secrets.sh b/secrets.sh index 599c867..6b7bc55 100755 --- a/secrets.sh +++ b/secrets.sh @@ -460,7 +460,9 @@ EOF ${HELM_BIN} ${TILLER_HOST:+--host "$TILLER_HOST" }"$cmd" $subcmd "$@" "${cmdopts[@]}" helm_exit_code=$? # cleanup on-the-fly decrypted files - [[ ${#decfiles[@]} -gt 0 ]] && rm -v "${decfiles[@]}" + local rmflags=(-v) + if [ "$cmd" == "template" ]; then rmflags=(); fi + [[ ${#decfiles[@]} -gt 0 ]] && rm "${rmflags[@]}" "${decfiles[@]}" } helm_command() {