Allow fingerprint as argument

Fingerprint can optionally be passed as the second command line
argument.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-01-30 09:00:15 +01:00
parent db343e31ce
commit a2dc671441
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -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