def self.get_user_info(libra_server, rhlogin, password, net_http, print_result, not_found_message=nil)
data = {'rhlogin' => rhlogin}
if @mydebug
data[:debug] = true
end
print_post_data(data)
json_data = generate_json(data)
url = URI.parse("https://#{libra_server}/broker/userinfo")
response = http_post(net_http, url, json_data, password)
unless response.code == '200'
if response.code == '404'
if not_found_message
puts not_found_message
else
puts "A user with rhlogin '#{rhlogin}' does not have a registered domain. Be sure to run 'rhc domain create' before using the other rhc tools."
end
exit 99
elsif response.code == '401'
puts "Invalid user credentials"
exit 97
else
print_response_err(response)
end
exit 1
end
begin
json_resp = JSON.parse(response.body)
rescue JSON::ParserError
exit 1
end
update_server_api_v(json_resp)
if print_result
print_response_success(json_resp)
end
begin
user_info = JSON.parse(json_resp['data'].to_s)
rescue JSON::ParserError
exit 1
end
user_info
end