Bug 1874619 - Hostgroup tag is never reported in slice
Summary: Hostgroup tag is never reported in slice
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: RH Cloud - Inventory
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.8.0
Assignee: Shimon Shtein
QA Contact: Mirek Długosz
URL:
Whiteboard:
: 1884988 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-01 18:33 UTC by Mirek Długosz
Modified: 2020-11-02 21:12 UTC (History)
4 users (show)

Fixed In Version: tfm-rubygem-foreman_rh_cloud-2.0.12
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1884009 (view as bug list)
Environment:
Last Closed: 2020-10-27 13:08:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5488231 0 None None None 2020-10-14 07:26:29 UTC
Red Hat Product Errata RHSA-2020:4366 0 None None None 2020-10-27 13:09:18 UTC

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


Note You need to log in before you can comment on or make changes to this bug.