Project

General

Profile

Actions

Bug #32837

closed

Drop unwanted URI parsing from NetHttpExtension

Added by Lukas Zapletal almost 3 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Proxy gateway
Target version:
Difficulty:
Triaged:
Yes
Fixed in Releases:
Found in Releases:

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)

Related issues 1 (0 open1 closed)

Related to Discovery - Bug #32812: Discovery plugin ignores IPv6 when doing reboot/kexec/fetch factsClosedLukas ZapletalActions
Actions

Also available in: Atom PDF