aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-05-23 17:58:30 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-05-23 17:58:30 -0300
commit8464844610b851ca7477b05f71c42890fcc43599 (patch)
tree27934280ce9de3dd0769e596eef3f2b059e69414
parentdb50450364de13c718defa6eff8b0623840f6480 (diff)
downloadhydra-8464844610b851ca7477b05f71c42890fcc43599.tar.gz
hydra-8464844610b851ca7477b05f71c42890fcc43599.tar.bz2
Deploy: check also for OpenPGP keys
-rwxr-xr-xshare/hydra/deploy12
1 files changed, 9 insertions, 3 deletions
diff --git a/share/hydra/deploy b/share/hydra/deploy
index b988e43..f64a56e 100755
--- a/share/hydra/deploy
+++ b/share/hydra/deploy
@@ -89,7 +89,9 @@ for node in $NODES; do
tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%m%d%H%M`.log
# Check if keys should be imported
- if ! $SUDO test -f $FOLDER/root/.ssh/id_rsa || ! $SUDO test -f $FOLDER/root/.borg/hydra/key; then
+ if ! $SUDO test -f $FOLDER/root/.ssh/id_rsa || \
+ ! $SUDO test -f $FOLDER/root/.borg/hydra/key || \
+ ! $SUDO gpg --homedir=$FOLDER/root --list-secret-keys root@$FQDN &> /dev/null; then
echo "No $FOLDER/root/.ssh/id_rsa found. Please import it and other keys when the system is online using import-keys action"
fi
elif [ "$node" == "localhost" ] || [ "$node" == "`facter fqdn`" ] || [ "$node" == "`facter hostname`" ]; then
@@ -128,7 +130,9 @@ for node in $NODES; do
$SUDO chown -R `whoami`. $HYDRA_FOLDER/puppet/ssl
# Import keys if needed
- if ! $SUDO test -f /root/.ssh/id_rsa || ! $SUDO test -f /root/.borg/hydra/key; then
+ if ! $SUDO test -f /root/.ssh/id_rsa || \
+ ! $SUDO test -f /root/.borg/hydra/key || \
+ ! $SUDO gpg --list-secret-keys root@$FQDN &> /dev/null; then
hydra $HYDRA import-keys localhost
fi
else
@@ -211,7 +215,9 @@ EOF
tee $HYDRA_FOLDER/puppet/logs/$FQDN.`date +%Y%m%d%H%M`.log
# Import keys if needed
- if ! $HYDRA_CONNECT $FQDN sudo test -f /root/.ssh/id_rsa || ! $HYDRA_CONNECT $FQDN sudo test -f /root/.borg/hydra/key; then
+ if ! $HYDRA_CONNECT $FQDN sudo test -f /root/.ssh/id_rsa || \
+ ! $HYDRA_CONNECT $FQDN sudo test -f /root/.borg/hydra/key || \
+ ! $HYDRA_CONNECT $FQDN sudo gpg --list-secret-keys root@$FQDN &> /dev/null; then
hydra $HYDRA import-keys localhost
fi
fi