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: 2020-04-14 13:25 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:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Foreman Issue Tracker 27926 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 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@redhat.com

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.