aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2016-05-16 12:00:30 -0300
committerSilvio Rhatto <rhatto@riseup.net>2016-05-16 12:00:30 -0300
commit51c75cb933688ad1411fb1a6a8b429820b8c18e8 (patch)
treefc6a0699fee5fafc04d536bfb8490ecc0af2d8c7 /lib
parent1cd08cf7992b6ebb02d99f8cec2d8fd7074bf3aa (diff)
downloadhydra-51c75cb933688ad1411fb1a6a8b429820b8c18e8.tar.gz
hydra-51c75cb933688ad1411fb1a6a8b429820b8c18e8.tar.bz2
Deploy: enhance eyaml localhost keypair logic
Diffstat (limited to 'lib')
-rw-r--r--lib/hydra/deploy20
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/hydra/deploy b/lib/hydra/deploy
index 196b944..70a8a67 100644
--- a/lib/hydra/deploy
+++ b/lib/hydra/deploy
@@ -9,6 +9,9 @@ function hydra_deploy_setup {
DEPLOY_RSYNC="rsync -CrltDvpq --no-owner --exclude=/ssl --exclude=keys --exclude=site_keys --exclude=config/secrets --delete --rsync-path"
RSYNC_PATH="rsync -q"
+ # Ensure keystore existence
+ mkdir -p $HYDRA_FOLDER/puppet/keys
+
if [ "$1" == "remote" ]; then
# Deploy in a remote host
if [ ! -z "$2" ]; then
@@ -59,12 +62,17 @@ function hydra_deploy_setup {
PUPPET_OPTS="--confdir=$HYDRA_FOLDER/puppet --modulepath=$HYDRA_FOLDER/puppet/modules"
hydra_deploy_set_manifest $HYDRA_FOLDER
- # Fix eyaml keys
- mkdir -p $HYDRA_FOLDER/puppet/keys
- rm -f $HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem
- rm -f $HYDRA_FOLDER/puppet/keys/public_key.pkcs7.pem
- ln -sf $HYDRA_FOLDER/puppet/keys/$FQDN/eyaml/private_key.pkcs7.pem $HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem
- ln -sf $HYDRA_FOLDER/puppet/keys/$FQDN/eyaml/public_key.pkcs7.pem $HYDRA_FOLDER/puppet/keys/public_key.pkcs7.pem
+ # Remove old eyaml symlinks if exists
+ if [ -h "$HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem" ]; then
+ rm -f $HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem
+ rm -f $HYDRA_FOLDER/puppet/keys/public_key.pkcs7.pem
+ fi
+
+ # Use eyaml keypair from the current hostname
+ if [ ! -e "$HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem" ]; then
+ ln -sf $HYDRA_FOLDER/puppet/keys/$FQDN/eyaml/private_key.pkcs7.pem $HYDRA_FOLDER/puppet/keys/private_key.pkcs7.pem
+ ln -sf $HYDRA_FOLDER/puppet/keys/$FQDN/eyaml/public_key.pkcs7.pem $HYDRA_FOLDER/puppet/keys/public_key.pkcs7.pem
+ fi
fi
# Common parameters