Sha256: 4c181f3e34e62006780ce40e5a13f0552d3e038e4bc4b41d4ac7ba0032cea143

Contents?: true

Size: 815 Bytes

Versions: 19

Compression:

Stored size: 815 Bytes

Contents

module Fog
module Compute
class AWS
class Server
  
  def setup(credentials = {})
    requires :ssh_ip_address, :username
    
    commands = [
      %{mkdir .ssh},
      %{passwd -l #{username}},
      %{echo "#{Fog::JSON.encode(Fog::JSON.sanitize(attributes))}" >> ~/attributes.json}
    ]
    if public_key
      commands << %{echo "#{public_key}" >> ~/.ssh/authorized_keys}
    end

    tries      = 5
    sleep_secs = 5
    
    begin      
      Nucleon::Util::SSH.session(ssh_ip_address, username, ssh_port, private_key_path, true)
      results = Nucleon::Util::SSH.exec(ssh_ip_address, username, commands)
            
    rescue Exception => error
      if tries > 1
        sleep(sleep_secs)        
        tries -= 1
        retry
      else
        raise error
      end
    end
  end
end
end
end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
corl-0.4.20 lib/core/mod/fog_aws_server.rb
corl-0.4.19 lib/core/mod/fog_aws_server.rb
corl-0.4.18 lib/core/mod/fog_aws_server.rb
corl-0.4.17 lib/core/mod/fog_aws_server.rb
corl-0.4.16 lib/core/mod/fog_aws_server.rb
corl-0.4.15 lib/core/mod/fog_aws_server.rb
corl-0.4.14 lib/core/mod/fog_aws_server.rb
corl-0.4.13 lib/core/mod/fog_aws_server.rb
corl-0.4.12 lib/core/mod/fog_aws_server.rb
corl-0.4.11 lib/core/mod/fog_aws_server.rb
corl-0.4.10 lib/core/mod/fog_aws_server.rb
corl-0.4.9 lib/core/mod/fog_aws_server.rb
corl-0.4.8 lib/core/mod/fog_aws_server.rb
corl-0.4.7 lib/core/mod/fog_aws_server.rb
corl-0.4.6 lib/core/mod/fog_aws_server.rb
corl-0.4.5 lib/core/mod/fog_aws_server.rb
corl-0.4.4 lib/core/mod/fog_aws_server.rb
corl-0.4.3 lib/core/mod/fog_aws_server.rb
corl-0.4.2 lib/core/mod/fog_aws_server.rb