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