summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-06-23 14:04:14 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-06-23 14:04:14 -0300
commit4eb202f0191eb1b6eb558f8f1a6102ca9c6bef9c (patch)
tree4688e94f3dc72177ebcc5cf6e88a640f3ee729ae
parentb9151cdb3b318400180db532e35abfe5486c0adc (diff)
downloadhydra-4eb202f0191eb1b6eb558f8f1a6102ca9c6bef9c.tar.gz
hydra-4eb202f0191eb1b6eb558f8f1a6102ca9c6bef9c.tar.bz2
Compile: check if key exists and set node key
-rwxr-xr-xshare/hydra/compile11
1 files changed, 8 insertions, 3 deletions
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