Method: Anamo::Node::Thor#exec

Defined in:
lib/anamo/node/thor.rb

#execObject



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/anamo/node/thor.rb', line 19

def exec

  data = inspect false
  response = ::Anamo::Api.new.post_node MultiJson.dump data

  response_data = MultiJson.load response.body
  if response_data.respond_to?(:has_key?) and response_data.has_key?('client_key')
    File.open(key_file, 'w') { |file| file.write response_data['client_key'] }
    File.chmod(0600, key_file)
  end

end