From c1c0c5de1a8c04c2e450cccff6c8570d799ac5c4 Mon Sep 17 00:00:00 2001 From: Nat Welch Date: Tue, 30 Apr 2013 15:00:05 -0700 Subject: [PATCH] Trying to get ssh command working. --- lib/fog/google/models/compute/server.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/fog/google/models/compute/server.rb b/lib/fog/google/models/compute/server.rb index 116bca36f..5c8a6f7cc 100644 --- a/lib/fog/google/models/compute/server.rb +++ b/lib/fog/google/models/compute/server.rb @@ -60,6 +60,16 @@ module Fog service.servers.merge_attributes(data) end + def setup(credentials = {}) + requires :public_ip_address, :identity, :public_key, :username + Fog::SSH.new(public_ip_address, username, credentials).run([ + %{mkdir .ssh}, + %{echo "#{public_key}" >> ~/.ssh/authorized_keys}, + ]) + rescue Errno::ECONNREFUSED + sleep(1) + retry + end end end end