From 0c9bca2f64279ed2817f7c87c9c5c19bcb1035a1 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Sun, 21 Nov 2010 23:45:18 -0200 Subject: Adding 'all' param to newkeys --- share/hydra/newkeys | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'share') 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 $* -- cgit v1.2.3