Bug 1874619

Summary: Hostgroup tag is never reported in slice
Product: Red Hat Satellite Reporter: Mirek Długosz <mzalewsk>
Component: RH Cloud - InventoryAssignee: Shimon Shtein <sshtein>
Status: CLOSED ERRATA QA Contact: Mirek Długosz <mzalewsk>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.8.0CC: aruzicka, jjeffers, kkohli, pmoravec
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: tfm-rubygem-foreman_rh_cloud-2.0.12 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1884009 (view as bug list) Environment:
Last Closed: 2020-10-27 13:08:57 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 Mirek Długosz 2020-09-01 18:33:10 UTC
I have hostgroup assigned to host, but there is no "hostgroup" tag to be found inside report generated by plugin.

When report slice is generated, `host.hostgroup&.name` apparently returns null, since it never passes initial check inside `report_satellite_tag` method. But it does work inside rake console, which leaves me at complete loss.

I added logger and debug statements into `/opt/theforeman/tfm/root/usr/share/gems/gems/foreman_rh_cloud-2.0.10/lib/foreman_inventory_upload/generators/slice.rb`:

#v+
      def report_satellite_tag(key, value, last = nil)
        logger.debug("#{key} => #{value}")
        return if value.nil?
        logger.debug("  passed initial check if nil?")
#v-

When generating report, production.log reports:

#v+
2020-09-01T14:23:02 [D|bac|] Working on <REDACTED>
2020-09-01T14:23:02 [D|bac|] organization => Default Organization
2020-09-01T14:23:02 [D|bac|]   passed initial check if nil?
2020-09-01T14:23:02 [D|bac|] hostgroup =>
2020-09-01T14:23:02 [D|bac|] organization_id => 1
2020-09-01T14:23:02 [D|bac|]   passed initial check if nil?
#v-

But inside `foreman-rake console`:
#v+
irb(main):001:0> Host.where(:name => '<REDACTED>').first.hostgroup&.name
=> "my hostgroup"
#v-

It affects only hostgroup - organization, content view, activation key, host collection, all are added as expected. Only hostgroup is not.


Found on:
Satellite 6.8 snap 13
pulp-server-2.21.2-1.el7sat.noarch
foreman-2.1.2.1-1.el7sat.noarch
katello-3.16.0-0.4.rc4.el7sat.noarch
satellite-6.8.0-1.el7sat.noarch
tfm-rubygem-foreman_rh_cloud-2.0.10-1.el7sat.noarch

Comment 6 Mirek Długosz 2020-10-02 12:25:28 UTC
hostgroup tag is correctly included in slice:

#v+
"tags": [
       {
           "namespace": "satellite",
           "key": "hostgroup",
           "value": "test hostgroup"
       }
]
#v-



Tested on:
Satellite 6.8 snap 17
satellite-6.8.0-1.el7sat.noarch
katello-3.16.0-1.el7sat.noarch
foreman-2.1.2.17-1.el7sat.noarch
pulp-server-2.21.3-1.el7sat.noarch
tfm-rubygem-foreman_rh_cloud-2.0.12-1.el7sat.noarch

Comment 7 Shimon Shtein 2020-10-13 14:25:13 UTC
*** Bug 1884988 has been marked as a duplicate of this bug. ***

Comment 10 errata-xmlrpc 2020-10-27 13:08:57 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 (Important: Satellite 6.8 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-2020:4366