summaryrefslogtreecommitdiffstats
path: root/salt-keydiff.sh
diff options
context:
space:
mode:
authorGeorg Pfuetzenreuter2023-01-30 09:00:15 +0100
committerGeorg Pfuetzenreuter2023-01-30 09:00:15 +0100
commita2dc6714417c513c4a0eb3a750d99f7e5f0e80b2 (patch)
treebf0fa6ea3c8896fe62f18f86fd30bef5684faa80 /salt-keydiff.sh
parentdb343e31ced646f69bf1868e6d14989ee8c7606a (diff)
downloadsalt-keydiff-a2dc6714417c513c4a0eb3a750d99f7e5f0e80b2.tar.gz
salt-keydiff-a2dc6714417c513c4a0eb3a750d99f7e5f0e80b2.tar.bz2
salt-keydiff-a2dc6714417c513c4a0eb3a750d99f7e5f0e80b2.zip
Allow fingerprint as argument
Fingerprint can optionally be passed as the second command line argument. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'salt-keydiff.sh')
-rwxr-xr-xsalt-keydiff.sh8
1 files 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