Project

General

Profile

Bug #32837

Drop unwanted URI parsing from NetHttpExtension

Added by Lukas Zapletal 4 months ago. Updated about 2 months ago.

Status:
Closed
Priority:
Normal
Category:
Proxy gateway
Target version:
Difficulty:
Triaged:
Yes
Bugzilla link:
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

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

Associated revisions

Revision 73a42646 (diff)
Added by Lukas Zapletal about 2 months ago

Fixes #32837 - drop unwanted URI parsing from extension

History

#1 Updated by The Foreman Bot 4 months ago

  • Status changed from New to Ready For Testing
  • Pull request https://github.com/theforeman/foreman/pull/8606 added

#2 Updated by Lukas Zapletal 4 months ago

  • Bugzilla link set to 1970482

#3 Updated by Lukas Zapletal 4 months ago

  • Related to Bug #32812: Discovery plugin ignores IPv6 when doing reboot/kexec/fetch facts added

#4 Updated by Ondřej Ezr 4 months ago

  • Target version set to 3.0.0

#5 Updated by Amit Upadhye about 2 months ago

  • Target version changed from 3.0.0 to 3.0.1

#6 Updated by The Foreman Bot about 2 months ago

  • Fixed in Releases 3.1.0 added

#7 Updated by Amit Upadhye about 2 months ago

  • Target version changed from 3.0.1 to 3.0.0
  • Fixed in Releases 3.0.0 added

#8 Updated by Lukas Zapletal about 2 months ago

  • Status changed from Ready For Testing to Closed

Also available in: Atom PDF