Method: Fog::Compute::Rackspace::Server#setup

Defined in:
lib/fog/rackspace/models/compute/server.rb

#setup(credentials = {}) ⇒ Object



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/fog/rackspace/models/compute/server.rb', line 82

def setup(credentials = {})
  requires :ssh_ip_address, :identity, :public_key, :username
  Fog::SSH.new(ssh_ip_address, username, credentials).run([
    %{mkdir .ssh},
    %{echo "#{public_key}" >> ~/.ssh/authorized_keys},
    %{passwd -l #{username}},
    %{echo "#{Fog::JSON.encode(attributes)}" >> ~/attributes.json},
    %{echo "#{Fog::JSON.encode()}" >> ~/metadata.json}
  ])
rescue Errno::ECONNREFUSED
  sleep(1)
  retry
end