Bug 2026239

Summary: Config report upload failed with "No smart proxy server found on ["capsule.example.com"] and is not in trusted_hosts"
Product: Red Hat Satellite Reporter: Hao Chang Yu <hyu>
Component: PuppetAssignee: Lukas Zapletal <lzap>
Status: CLOSED ERRATA QA Contact: Vladimír Sedmík <vsedmik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.10.0CC: ahumbe, ankulkar, gtalreja, jjansky, mhulan, momran, oezr, pcreech, saydas
Target Milestone: 6.11.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman-3.1.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2071004 (view as bug list) Environment:
Last Closed: 2022-07-05 14:30:29 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hao Chang Yu 2021-11-24 07:36:00 UTC
Description of problem:
After upgrading to Satellite 6.10, config reports failed to upload due to the error below:

# production.log
------------------------------------------------------------
Started POST "/api/config_reports" for <CAPSULE IP> at <time>
Processing by Api::V2::ConfigReportsController#create as JSON
  Parameters: {"config_report"=>"[FILTERED]", "apiv"=>"v2"}
No smart proxy server found on ["capsule.example.com"] and is not in trusted_hosts  <=========
...
Completed 403 Forbidden in 34ms (Views: 13.0ms | ActiveRecord: 9.3ms | Allocations: 16915)
------------------------------------------------------------

This happens to all the Capsules without "Ansible" feature because Satellite tries to find all the smart proxies with the feature of "Ansible". Previously, it would look for "Puppet" feature. Since all capsules don't have the "Ansible" feature enabled, Satellite doesn't include them in trusted hosts list.


# Satellite 6.9:
foreman-rake console
irb(main):001:0> ConfigReportImporter.authorized_smart_proxy_features
=> ["Puppet"]


# Satellite 6.10
foreman-rake console
irb(main):003:0> ConfigReportImporter.authorized_smart_proxy_features
=> ["Ansible"]


# Expected features:
foreman-rake console
irb(main):003:0> ConfigReportImporter.authorized_smart_proxy_features
=> ["Puppet", "Ansible"]


In "foreman/app/services/config_report_importer.rb"

class ConfigReportImporter < ReportImporter
  def self.authorized_smart_proxy_features
    @authorized_smart_proxy_features ||= super + ['Puppet'] <=====
  end


In "foreman_ansible-6.3.4/app/services/foreman_ansible/ansible_report_importer.rb"

module ForemanAnsible
  module AnsibleReportImporter
  ...
    included do
      ...
      def self.authorized_smart_proxy_features
        super + ['Ansible']  <================== This is appending the list of parent
      end


In "foreman_ansible-6.3.4/lib/foreman_ansible/engine.rb"

::ConfigReportImporter.include ForemanAnsible::AnsibleReportImporter  <======= This seems like not appending the list

Comment 3 Ondřej Ezr 2021-12-03 13:21:59 UTC
This issue was also reported upstream in thread https://community.theforeman.org/t/no-smart-proxy-server-found-on-foreman-puppet-example-com-and-is-not-in-trusted-hosts/26215

It is not related to the Puppet extraction as that will only be in 7.0, so it should not affect 6.10

It already has upstream ticket and PR, hopefully it will be resolved soon.

Comment 4 Bryan Kearney 2021-12-04 00:05:53 UTC
Upstream bug assigned to lzap

Comment 5 Bryan Kearney 2021-12-04 00:05:55 UTC
Upstream bug assigned to lzap

Comment 6 Bryan Kearney 2021-12-18 20:06:20 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/34026 has been resolved.

Comment 8 Jan Jansky 2022-03-21 08:44:20 UTC
*** Bug 2052589 has been marked as a duplicate of this bug. ***

Comment 9 Vladimír Sedmík 2022-04-05 21:43:27 UTC
Verified in 7.0 snap 14:
1) Had 6.9.9 Satellite + external Capsule without Ansible feature enabled.
2) Upgraded both to 6.10.4 - the issue was successfully reproduced (fix is going to be cherry-picked into 6.10.5)
3) Upgraded both to 7.0.0 snap 14 - reports were successfully uploaded per interval and/or manually by `puppet agent -t`

Comment 12 errata-xmlrpc 2022-07-05 14:30:29 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498