puppet-fdio: check for public key file 10/3910/1
authorFeng Pan <fpan@redhat.com>
Mon, 21 Nov 2016 20:56:52 +0000 (15:56 -0500)
committerFeng Pan <fpan@redhat.com>
Mon, 21 Nov 2016 20:56:52 +0000 (15:56 -0500)
Change-Id: I9738c51ea4a473658145979d98d8dd16979aee41
Signed-off-by: Feng Pan <fpan@redhat.com>
jjb/puppet-fdio/puppet-fdio.yaml

index d34f2c1..82edfea 100644 (file)
           echo "Match address ::1" | sudo tee -a /etc/ssh/sshd_config
           echo "    PermitRootLogin without-password" | sudo tee -a /etc/ssh/sshd_config
           mkdir -p .ssh
-          if [ ! -f ~/.ssh/id_rsa ]; then
+          if [ ! -f ~/.ssh/id_rsa.pub ]; then
+            if [ -f ~/.ssh/id_rsa ]; then
+              ssh-keygen -y -f ~/.ssh/id_rsa -b 2048 -P "" > ~/.ssh/id_rsa.pub
+            else
               ssh-keygen -f ~/.ssh/id_rsa -b 2048 -P ""
+            fi
           fi
           sudo mkdir -p /root/.ssh
           cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys