From: Silvio Rhatto Date: Thu, 23 Jun 2016 17:04:14 +0000 (-0300) Subject: Compile: check if key exists and set node key X-Git-Tag: 0.2.4~134 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=4eb202f0191eb1b6eb558f8f1a6102ca9c6bef9c;p=hydra.git Compile: check if key exists and set node key --- diff --git a/share/hydra/compile b/share/hydra/compile index 1dd7b07..7fdf195 100755 --- a/share/hydra/compile +++ b/share/hydra/compile @@ -51,7 +51,12 @@ echo " ssh:" >> $CONFIG echo " keys:" >> $CONFIG for node in $NODES; do - echo "... for $node" - key="$(keyringer $HYDRA decrypt nodes/$node/ssh/id_rsa.pub 2> /dev/null)" - echo " $node: '$key'" >> $CONFIG + # Hiera doesn't accept keys with dots + key="`echo $node | sed -e 's/\./_/g'`" + + if [ -e "$HYDRA_FOLDER/keyring/keys/nodes/$node/ssh/id_rsa.pub.asc" ]; then + echo "... for $node" + value="$(keyringer $HYDRA decrypt nodes/$node/ssh/id_rsa.pub 2> /dev/null)" + echo " $key: '$value'" >> $CONFIG + fi done