Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-40990

In FDI 5.0+ proxy_type is always set to "proxy" regardless of user choice

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • Provisioning
    • None
    • None
    • None
    • None
    • None

      Description of problem:

      When using FDI 5.0+, proxy_type variable always end up being set to proxy, regardless of boot option used or choice of the user on the menu.

      As consequence, if a user sets a foreman URL (not a proxy), the POST request sending facts to discover the host will be sent to a bad endpoint of foreman (the bad endpoint, in this case, is the valid endpoint to be used when proxy_type = proxy)

      How reproducible:

      Always

      Is this issue a regression from an earlier version:

      Yes

      Steps to Reproduce:

      1. Boot a system with the FDI

      2. Fill the form with a foreman URL and select "Configuration type: Server"

      3. Go to next screen and confirm. You'll get a error.

      4. Look at the logs on satellite (production.log) and see the error belo

      2025-12-03T09:44:50 [I|app|7f8c3672] Started POST "/discovery/create" for 192.168.110.18 at 2025-12-03 09:44:50 -0500
      2025-12-03T09:44:50 [F|app|7f8c3672]   
       7f8c3672 | ActionController::RoutingError (No route matches [POST] "/discovery/create"):
       7f8c3672 |   
       7f8c3672 | lib/foreman/middleware/logging_context_request.rb:11:in `call'
       7f8c3672 | katello (4.14.0.14) lib/katello/prevent_json_parsing.rb:12:in `call'
       

       

      Another way to reproduce is with PXE discovery. By default, if you're discovering hosts directly on Satellite (no capsules involved), the options "proxy.type=foreman" is set and proxy.url will point to the foreman URL.  Regardless of this option, the system will act like "proxy.type=proxy" and will send the discovery info to the proxy endpoint but on the foreman URL, resulting in errors.

      Actual behavior:
      proxy_type is always set to proxy and endpoint where request is sent is always the same (which is only good for a proxy server).

      Expected behavior:
      User choice to be respected and endpoint be adapted based on the proxy_type chosen by user.

      Business Impact / Additional info:

      Issue appears to have been introduced by this commit https://github.com/theforeman/foreman-discovery-image/commit/a61200b25c7122b0efe590205dcdaf416427bdde 

       

      The decision about what proxy_type to use is handled here: https://github.com/theforeman/foreman-discovery-image/blob/master/root/usr/share/ruby/vendor_ruby/discovery/screen/foreman.rb#L39 

      This condition always fails which end up setting the type to "proxy" all the time. Patch below appears to be enough to fix the behavior:

      diff --git a/root/usr/share/ruby/vendor_ruby/discovery/screen/foreman.rb b/root/usr/share/ruby/vendor_ruby/discovery/screen/foreman.rb
      index 3d6838f..bc3a750 100644
      --- a/root/usr/share/ruby/vendor_ruby/discovery/screen/foreman.rb
      +++ b/root/usr/share/ruby/vendor_ruby/discovery/screen/foreman.rb
      @@ -36,7 +36,7 @@ def screen_foreman mac = nil, gw = nil, proxy_url = cmdline('proxy.url'), proxy_
       
         if answer == b_ok
           begin
      -      proxy_type = r_server.get_current == '*' ? 'foreman' : 'proxy'
      +      proxy_type = r_server.get_current == r_server ? 'foreman' : 'proxy'
             url = t_url.get
       
             raise _("No URL was provided") if url.size < 1 

       

              rhn-engineering-lstejska Leos Stejskal
              rhn-support-jpasqual Joniel Pasqualetto
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: