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 #1

Updated by The Foreman Bot almost 3 years ago

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

Updated by Lukas Zapletal almost 3 years ago

  • Bugzilla link set to 1970482
Actions #3

Updated by Lukas Zapletal almost 3 years ago

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

Updated by Ondřej Ezr over 2 years ago

  • Target version set to 3.0.0
Actions #5

Updated by Amit Upadhye over 2 years ago

  • Target version changed from 3.0.0 to 3.0.1
Actions #6

Updated by The Foreman Bot over 2 years ago

  • Fixed in Releases 3.1.0 added
Actions #7

Updated by Amit Upadhye over 2 years ago

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

Updated by Lukas Zapletal over 2 years ago

  • Status changed from Ready For Testing to Closed
Actions

Also available in: Atom PDF