From 4eb202f0191eb1b6eb558f8f1a6102ca9c6bef9c Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 23 Jun 2016 14:04:14 -0300 Subject: Compile: check if key exists and set node key --- share/hydra/compile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'share/hydra/compile') 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 -- cgit v1.2.3