From a2dc6714417c513c4a0eb3a750d99f7e5f0e80b2 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Mon, 30 Jan 2023 09:00:15 +0100 Subject: Allow fingerprint as argument Fingerprint can optionally be passed as the second command line argument. Signed-off-by: Georg Pfuetzenreuter --- salt-keydiff.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/salt-keydiff.sh b/salt-keydiff.sh index b4de6a9..a6c66e0 100755 --- a/salt-keydiff.sh +++ b/salt-keydiff.sh @@ -13,6 +13,7 @@ set -Ceu minion="${1:-null}" +key_user="${2:-null}" NOCOLOR="$(tput sgr0)" if ! command -v jq >/dev/null || ! command -v salt-key >/dev/null @@ -35,8 +36,11 @@ then exit 2 fi -printf 'Enter fingerprint to diff against (run `salt-call --local key.finger` on the minion)\n' -read -r key_user +if [ "$key_user" = 'null' ] +then + printf 'Enter fingerprint to diff against (run `salt-call --local key.finger` on the minion)\n' + read -r key_user +fi if [ "$key_salt" = "$key_user" ] then -- cgit v1.2.3