Method: Wdmc::Client#network

Defined in:
lib/wdmc/client.rb

#networkObject



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/wdmc/client.rb', line 65

def network
  response = get("#{@config['url']}/api/2.1/rest/network_configuration", {accept: :json, :cookies => cookies})
  if @config['api_net_nl_bug']
    response = response.delete("\n")
  end
  begin
    JSON.parse(response, :symbolize_names => true)[:network_configuration]
  rescue JSON::ParserError => e
    unless @config['api_net_nl_bug']
      $stderr.puts("         Warning: Consider adding 'api_net_nl_bug: true' to your configuration file\n         to mitigate a known bug retrieving network configuration data.\n         EOL\n      )\n    end\n    raise e\n  end\nend\n".tr("\n", " ")