lib/kytoon/providers/openstack/server_group.rb in kytoon-1.3.0 vs lib/kytoon/providers/openstack/server_group.rb in kytoon-1.3.1
- old
+ new
@@ -186,29 +186,29 @@
end
puts "Copying hosts files..."
gateway_ssh_config = %{
-[ -d .ssh ] || mkdir .ssh
+mkdir -p .ssh
cat > .ssh/id_rsa <<-EOF_CAT
#{private_ssh_key}
EOF_CAT
chmod 600 .ssh/id_rsa
cat > .ssh/id_rsa.pub <<-EOF_CAT
#{public_ssh_key}
EOF_CAT
-chmod 600 .ssh/id_rsa.pub
+chmod 644 .ssh/id_rsa.pub
cat > .ssh/config <<-EOF_CAT
StrictHostKeyChecking no
EOF_CAT
chmod 600 .ssh/config
}
node_ssh_config= %{
-[ -d .ssh ] || mkdir .ssh
-cat > .ssh/authorized_keys <<-EOF_CAT
-#{public_ssh_key}
+mkdir -p .ssh
+cat >> .ssh/authorized_keys <<-EOF_CAT
+#{public_ssh_key}\n
EOF_CAT
chmod 600 .ssh/authorized_keys
}
# now that we have IP info copy hosts files into the servers
@@ -220,11 +220,12 @@
EOF_CAT
hostname "#{server['hostname']}"
if [ -f /etc/sysconfig/network ]; then
sed -e "s|^HOSTNAME.*|HOSTNAME=#{server['hostname']}|" -i /etc/sysconfig/network
fi
-#{server['gateway'] == 'true' ? gateway_ssh_config : node_ssh_config}
- }, server['ip_address']) do |ok, out|
+#{server['gateway'] == 'true' ? gateway_ssh_config : ""}
+#{node_ssh_config}
+ }, server['ip_address'], 3) do |ok, out|
if not ok
puts out
raise KytoonException, "Failed to copy host file to instance #{server['hostname']}."
end
end