Module: DTK::Client::NodeMixin

Included in:
Node
Defined in:
lib/commands/common/thor/node.rb

Constant Summary collapse

DefaultLoginByOSType =
{
  'ubuntu'       => 'ubuntu',
  'amazon-linux' => 'ec2-user'
}

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_login_user?(node_properties) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
45
46
# File 'lib/commands/common/thor/node.rb', line 42

def self.(node_properties)
if os_type = node_properties['os_type']
    DefaultLoginByOSType[os_type]
  end
end

Instance Method Details

#get_node_info_for_ssh_login(node_id, context_params) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/commands/common/thor/node.rb', line 20

def (node_id, context_params)
  context_params.forward_options(:json_return => true)
  response = info_aux(context_params)
  return response unless response.ok?
  # Should only have info about the specfic node_id
  
  unless node_info = response.data(:nodes).find{ |node| node_id == (node['node_properties'] || {})['node_id'] }
    raise DtkError, "Cannot find info about node with id '#{node_id}'"
  end

  data = {}
  node_properties = node_info['node_properties'] || {}
  if public_dns = node_properties['ec2_public_address']
    data.merge!('public_dns' => public_dns)
  end
  if  = NodeMixin.(node_properties)
    data.merge!('default_login_user' => )
  end

  Response::Ok.new(data)
end