Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1746780 - [RFE] Host parameter should be accessible in Report Template without setting "Safemode rendering" to false
Summary: [RFE] Host parameter should be accessible in Report Template without setting ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Reporting
Version: 6.5.0
Hardware: All
OS: All
medium
medium
Target Milestone: 6.7.0
Assignee: Ondřej Pražák
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-29 09:07 UTC by Ranjan Kumar
Modified: 2023-09-07 20:30 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-04-14 13:25:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 27926 0 Normal Closed Host parameter should be accessible in Report Template without setting "Safemode rendering" to false 2020-05-11 15:47:05 UTC
Red Hat Product Errata RHSA-2020:1454 0 None None None 2020-04-14 13:25:45 UTC

Description Ranjan Kumar 2019-08-29 09:07:29 UTC
Description of problem:
Currently, the host parameter is accessible in report template only using  host.info['parameters']['Parameter Name'] but needs to set "Safemode rendering" to false. We should able to access this when "Safemode rendering" is set to true

Here is an example template

<%- load_hosts().each_record do |host| -%>

<%-   report_row({

        'Name': host.name,

        'LOB': host.info['parameters']['SomeParameter']

      }) -%>

<%- end -%>

Version-Release number of selected component (if applicable): 6.5


How reproducible: Always

Actual results: Getting Error message --> Warning! There was an error rendering the parameterreport template: undefined method '#info' for Host::Managed::Jail (Host::Managed)


Expected results: parameter should be accessible when "Safemode rendering" to true

Comment 3 Marek Hulan 2019-08-30 17:36:54 UTC
Have you tried host_param macro? From the request, it's not clear if you ask for host parameter of smart class parameter, but both is available when safe mode is enabled. Try:

host_param('SomeParameter')
host_enc('parameters', 'SomeParameter')
host_enc['parameters']['SomeParameter']

all of that will work with safe mode. If you find out it's working, please close as notabug.

Comment 7 Marek Hulan 2019-09-24 09:00:37 UTC
Created redmine issue https://projects.theforeman.org/issues/27926 from this bug

Comment 8 Bryan Kearney 2019-10-04 14:04:11 UTC
Upstream bug assigned to oprazak

Comment 9 Bryan Kearney 2019-10-04 14:04:12 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/27926 has been resolved.

Comment 10 Lukáš Hellebrandt 2019-12-04 14:42:42 UTC
Verified with Sat 6.7 snap 4.

With safemode on (Administer -> Settings -> Safemode rendering -> yes), I tried to generate report with contents:

<%- load_hosts(includes: :host_statuses).each_record do |host| -%>
<%-   report_row({
        'Name': host.name,
        'Global': host.global_status,
        'Parameter 1': host.host_param('test') || 'Unknown',
      }) -%>
<%- end -%>
<%= report_render -%>

The generated report contained the correct data.

Comment 13 errata-xmlrpc 2020-04-14 13:25:28 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, 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:1454


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