Actions
Bug #32837
closedDrop unwanted URI parsing from NetHttpExtension
Difficulty:
Triaged:
Yes
Bugzilla link:
Pull request:
Description
Ruby Net::HTTP object does not contain URI, it contains address and port attributes which is documented to only old IP address or hostname and port, not URI or URL at all.
In our NetHttpExtension we parse the address into URI and then extract hostname part from there. This works fine for IPv4, however it fails for IPv6 as addresses must be enclosed within square brackets. The patch is removing the not-needed conversion to URI and back. The error I am seeing is coming from discovery:
irb(main):016:0> resource = ::ForemanDiscovery::NodeAPI::Power.service(:url => "https://[2a00:4bc0:1010:1102:0:b19:7175:babe]:8443") => #<ForemanDiscovery::NodeAPI::PowerService:0x0000000012d5f0b8 @args={:url=>"https://[2a00:4bc0:1010:1102:0:b19:7175:babe]:8443"}, @connect_params={:headers=>{:accept=>:json}, :timeout=>20, :verify_ssl=>0}> irb(main):017:0> resource.reboot Traceback (most recent call last): 5: from lib/tasks/console.rake:5:in `block in <top (required)>' 4: from (irb):17 3: from foreman_discovery (16.3.1) app/services/foreman_discovery/node_api/power_service.rb:8:in `reboot' 2: from foreman_discovery (16.3.1) app/services/foreman_discovery/node_api/node_resource.rb:103:in `put' 1: from lib/foreman/http_proxy/net_http_extension.rb:5:in `request' URI::InvalidURIError (bad URI(is not URI?): 2a00:4bc0:1010:1102:0:b19:7175:babe)
Actions