Handle failures properly.
authorFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 3 Feb 2016 21:00:35 +0000 (22:00 +0100)
committerFrantišek Dvořák <valtri@civ.zcu.cz>
Wed, 3 Feb 2016 21:00:35 +0000 (22:00 +0100)
docker.sh

index 0755de6..fdbe05c 100755 (executable)
--- a/docker.sh
+++ b/docker.sh
@@ -88,9 +88,12 @@ if [ -n "${FETCH_SSH_KEYS}" ]; then
     for j in '' '.pub'; do
       for i in rsa dsa ecdsa; do
         (umask 0177; rsh -5 -f -u -x -p 5665 kdccesnet.ics.muni.cz /usr/local/bin/rsh.getsshhostkey ${FACTER_fqdn} ssh_host_${i}_key${j} > ${config_dir}/ssh/ssh_host_${i}_key${j})
+        if [ ! -s ${config_dir}/ssh/ssh_host_${i}_key${j} ]; then
+          rm ${config_dir}/ssh/ssh_host_${i}_key${j}
+        fi
       done
     done
-    chmod 0644 ${config_dir}/ssh/*.pub
+    chmod 0644 ${config_dir}/ssh/ssh_host_*.pub 2>&1 || :
   fi
 fi
 if [ -f "${config_dir}/../.k5login" ]; then