summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2010-11-21 23:45:18 -0200
committerSilvio Rhatto <rhatto@riseup.net>2010-11-21 23:45:18 -0200
commit0c9bca2f64279ed2817f7c87c9c5c19bcb1035a1 (patch)
treec9836a74019d2fae6b8a6d0c8c27a64bc5815691
parentbe398bec618aaeb395be6e58764963021aea09fa (diff)
downloadhydra-0c9bca2f64279ed2817f7c87c9c5c19bcb1035a1.tar.gz
hydra-0c9bca2f64279ed2817f7c87c9c5c19bcb1035a1.tar.bz2
Adding 'all' param to newkeys
-rwxr-xr-xshare/hydra/newkeys20
1 files changed, 13 insertions, 7 deletions
diff --git a/share/hydra/newkeys b/share/hydra/newkeys
index 56f9b5b..63d8254 100755
--- a/share/hydra/newkeys
+++ b/share/hydra/newkeys
@@ -10,16 +10,22 @@ function hydra_newkeys {
node="`echo $host | cut -d . -f 1`"
privkey="$PUPPET_KEYS/"$node"_id_rsa"
pubkey="$privkey.pub"
- if [ ! -e "$privkey" ] || [ ! -e "$pubkey" ]; then
- keyringer $HYDRA genpair ssh $node/ssh/id_rsa $host $privkey
- keyringer $HYDRA genpair gpg $node/gpg/key $host
-
- # Add key into puppet git repository.
- ( cd $PUPPET_KEYS && git add $(basename $privkey) $(basename $pubkey) )
+ if [ "$1" == "all" ]; then
+ hydra_genpairs
+ elif [ ! -e "$privkey" ] || [ ! -e "$pubkey" ]; then
+ hydra_genpairs
fi
done
}
+function hydra_genpairs {
+ keyringer $HYDRA genpair ssh $node/ssh/id_rsa $host $privkey
+ keyringer $HYDRA genpair gpg $node/gpg/key $host
+
+ # Add key into puppet git repository.
+ ( cd $PUPPET_KEYS && git add $(basename $privkey) $(basename $pubkey) )
+}
+
# Load.
source $APP_BASE/lib/hydra/functions || exit 1
hydra_config_load
@@ -30,4 +36,4 @@ if ! which keyringer &> /dev/null; then
exit 1
fi
-hydra_newkeys
+hydra_newkeys $*