nodes: 0, module; 1, function_definition; 2, function_name:_get_salt_params; 3, parameters; 4, block; 5, expression_statement; 6, expression_statement; 7, expression_statement; 8, expression_statement; 9, try_statement; 10, return_statement; 11, string; 12, assignment; 13, assignment; 14, assignment; 15, block; 16, except_clause; 17, identifier:params; 18, string_content:Try to get all sort of parameters for Server Density server info.
  
      NOTE: Missing publicDNS and publicIPs parameters. There might be way of
      getting them with salt-cloud.; 19, identifier:all_stats; 20, call; 21, identifier:all_grains; 22, call; 23, identifier:params; 24, dictionary; 25, expression_statement; 26, expression_statement; 27, if_statement; 28, expression_statement; 29, expression_statement; 30, expression_statement; 31, expression_statement; 32, expression_statement; 33, expression_statement; 34, identifier:KeyError; 35, block; 36, subscript; 37, argument_list; 38, subscript; 39, argument_list; 40, assignment; 41, assignment; 42, comparison_operator:all_grains['kernel'] == 'Darwin'; 43, block; 44, else_clause; 45, assignment; 46, assignment; 47, assignment; 48, assignment; 49, assignment; 50, assignment; 51, pass_statement; 52, identifier:__salt__; 53, string; 54, identifier:__salt__; 55, string; 56, subscript; 57, subscript; 58, subscript; 59, subscript; 60, subscript; 61, string; 62, expression_statement; 63, block; 64, subscript; 65, call; 66, subscript; 67, subscript; 68, subscript; 69, call; 70, subscript; 71, call; 72, subscript; 73, call; 74, subscript; 75, call; 76, string_content:status.all_status; 77, string_content:grains.items; 78, identifier:params; 79, string; 80, identifier:all_grains; 81, string; 82, identifier:params; 83, string; 84, identifier:all_grains; 85, string; 86, identifier:all_grains; 87, string; 88, string_content:Darwin; 89, assignment; 90, expression_statement; 91, identifier:params; 92, string; 93, attribute; 94, argument_list; 95, identifier:params; 96, string; 97, subscript; 98, string; 99, identifier:params; 100, string; 101, attribute; 102, argument_list; 103, identifier:params; 104, string; 105, attribute; 106, argument_list; 107, identifier:params; 108, string; 109, attribute; 110, argument_list; 111, identifier:params; 112, string; 113, attribute; 114, argument_list; 115, string_content:name; 116, string_content:id; 117, string_content:hostname; 118, string_content:host; 119, string_content:kernel; 120, identifier:sd_os; 121, dictionary; 122, assignment; 123, string_content:os; 124, attribute; 125, identifier:dumps; 126, identifier:sd_os; 127, string_content:cpuCores; 128, identifier:all_stats; 129, string; 130, string_content:cpu cores; 131, string_content:installedRAM; 132, identifier:six; 133, identifier:text_type; 134, binary_operator:int(all_stats['meminfo']['MemTotal']['value']) / 1024; 135, string_content:swapSpace; 136, identifier:six; 137, identifier:text_type; 138, binary_operator:int(all_stats['meminfo']['SwapTotal']['value']) / 1024; 139, string_content:privateIPs; 140, attribute; 141, identifier:dumps; 142, subscript; 143, string_content:privateDNS; 144, attribute; 145, identifier:dumps; 146, subscript; 147, pair; 148, pair; 149, identifier:sd_os; 150, dictionary; 151, attribute; 152, identifier:json; 153, string_content:cpuinfo; 154, call; 155, integer:1024; 156, call; 157, integer:1024; 158, attribute; 159, identifier:json; 160, identifier:all_grains; 161, string; 162, attribute; 163, identifier:json; 164, identifier:all_grains; 165, string; 166, string; 167, string; 168, string; 169, string; 170, pair; 171, pair; 172, identifier:salt; 173, identifier:utils; 174, identifier:int; 175, argument_list; 176, identifier:int; 177, argument_list; 178, identifier:salt; 179, identifier:utils; 180, string_content:fqdn_ip4; 181, identifier:salt; 182, identifier:utils; 183, string_content:fqdn; 184, string_content:code; 185, string_content:mac; 186, string_content:name; 187, string_content:Mac; 188, string; 189, call; 190, string; 191, subscript; 192, subscript; 193, subscript; 194, string_content:code; 195, attribute; 196, argument_list; 197, string_content:name; 198, identifier:all_grains; 199, string; 200, subscript; 201, string; 202, subscript; 203, string; 204, subscript; 205, identifier:lower; 206, string_content:kernel; 207, subscript; 208, string; 209, string_content:value; 210, subscript; 211, string; 212, string_content:value; 213, identifier:all_grains; 214, string; 215, identifier:all_stats; 216, string; 217, string_content:MemTotal; 218, identifier:all_stats; 219, string; 220, string_content:SwapTotal; 221, string_content:kernel; 222, string_content:meminfo; 223, string_content:meminfo
code: def _get_salt_params():
      '''
      Try to get all sort of parameters for Server Density server info.
  
      NOTE: Missing publicDNS and publicIPs parameters. There might be way of
      getting them with salt-cloud.
      '''
      all_stats = __salt__['status.all_status']()
      all_grains = __salt__['grains.items']()
      params = {}
      try:
          params['name'] = all_grains['id']
          params['hostname'] = all_grains['host']
          if all_grains['kernel'] == 'Darwin':
              sd_os = {'code': 'mac', 'name': 'Mac'}
          else:
              sd_os = {'code': all_grains['kernel'].lower(), 'name': all_grains['kernel']}
          params['os'] = salt.utils.json.dumps(sd_os)
          params['cpuCores'] = all_stats['cpuinfo']['cpu cores']
          params['installedRAM'] = six.text_type(int(all_stats['meminfo']['MemTotal']['value']) / 1024)
          params['swapSpace'] = six.text_type(int(all_stats['meminfo']['SwapTotal']['value']) / 1024)
          params['privateIPs'] = salt.utils.json.dumps(all_grains['fqdn_ip4'])
          params['privateDNS'] = salt.utils.json.dumps(all_grains['fqdn'])
      except KeyError:
          pass
  
      return params