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 1778402 - Weird behaviour when Importing the report template to Satellite via API
Summary: Weird behaviour when Importing the report template to Satellite via API
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Reporting
Version: 6.6.0
Hardware: All
OS: All
unspecified
high
Target Milestone: Unspecified
Assignee: Dominik Matoulek
QA Contact: Lukáš Hellebrandt
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-11-30 17:36 UTC by Waldirio M Pinheiro
Modified: 2021-07-09 17:02 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-07-09 17:02:24 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 30760 0 Normal New Weird behaviour when Importing the report template to Foreman via API 2020-10-19 07:29:19 UTC

Description Waldirio M Pinheiro 2019-11-30 17:36:04 UTC
Description of problem:
Once we have already the exported report template, we would like to import it to Satellite. Via API, after imported the code will work, however, when editing the code we will see a single long line, instead of our indented code.

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

How reproducible:
100%

Steps to Reproduce:
1. Export the report template (can be via webUI) and save the file
2. Create a small json to import and the content will be like below
---
$ cat new.json
{
    "name": "Hosts - complete list",
    "template": "
<% load_hosts(search: input('host')).each_record do |host| -%>
<%#
name: Hosts - complete list
snippet: false
template_inputs:
- name: host
  required: false
  input_type: user
  advanced: false
  value_type: plain
  resource_type: Katello::ActivationKey
model: ReportTemplate
%>
<%
      report_row(
          'Server FQND': host.name
      )
-%>
<%  end -%>
<%= report_render %>
"
}
---
3. Importing it.
---
[wpinheir@ironman ~]$ curl -s -u admin:redhat -d @new.json --header "Content-Type:application/json" -X POST -k https://wallsat66.usersys.redhat.com/api/report_templates
{"template":"<% load_hosts(search: input('host')).each_record do |host| -%><%#name: Hosts - complete listsnippet: falsetemplate_inputs:- name: host  required: false  input_type: user  advanced: false  value_type: plain  resource_type: Katello::ActivationKeymodel: ReportTemplate%><%      report_row(          'Server FQND': host.name      )-%><%  end -%><%= report_render %>","default":false,"snippet":false,"locked":false,"created_at":"2019-11-30 17:21:35 UTC","updated_at":"2019-11-30 17:21:35 UTC","name":"Hosts - complete list","id":165,"locations":[],"organizations":[]}[wpinheir@ironman ~]$
---

At this moment we can see the report template was imported, in order to run this, will be necessary to create an input but after that, the report output is fine.

Actual results:

Report is ok BUT the code is in a single line. Let's check the curl output
---
[wpinheir@ironman ~]$ curl -s -u admin:redhat -X GET -k https://wallsat66.usersys.redhat.com/api/report_templates/165 | json_reformat
{
    "template": "<% load_hosts(search: input('host')).each_record do |host| -%><%#name: Hosts - complete listsnippet: falsetemplate_inputs:- name: host  required: false  input_type: user  advanced: false  value_type: plain  resource_type: Katello::ActivationKeymodel: ReportTemplate%><%      report_row(          'Server FQND': host.name      )-%><%  end -%><%= report_render %>",
    "default": false,
    "snippet": false,
    "locked": false,
    "created_at": "2019-11-30 17:21:35 UTC",
    "updated_at": "2019-11-30 17:21:35 UTC",
    "name": "Hosts - complete list",
    "id": 165,
    "locations": [

    ],
    "organizations": [

    ]
}
[wpinheir@ironman ~]$
---

Expected results:

At this time, I just updated the code with the correct one (new lines, indentations, etc) and rerun the curl
---
[wpinheir@ironman ~]$ curl -s -u admin:redhat -X GET -k https://wallsat66.usersys.redhat.com/api/report_templates/165 | json_reformat
{
    "template": "<% load_hosts(search: input('host')).each_record do |host| -%>\n<%#\nname: Hosts - complete list\nsnippet: false\ntemplate_inputs:\n- name: host\n  required: false\n  input_type: user\n  advanced: false\n  value_type: plain\n  resource_type: Katello::ActivationKey\nmodel: ReportTemplate\n%>\n<%\n      report_row(\n          'Server FQND': host.name\n      )\n-%>\n<%  end -%>\n<%= report_render %>",
    "default": false,
    "snippet": false,
    "locked": false,
    "created_at": "2019-11-30 17:21:35 UTC",
    "updated_at": "2019-11-30 17:25:56 UTC",
    "name": "Hosts - complete list",
    "id": 165,
    "locations": [

    ],
    "organizations": [

    ]
}
[wpinheir@ironman ~]$
---

We can see a bunch of "\n" that represent new lines. I was expecting to the API handle this automatically without the necessity of manual or additional intervantion.


Additional info:

Comment 7 Dominik Matoulek 2020-09-02 10:25:19 UTC
Created redmine issue https://projects.theforeman.org/issues/30760 from this bug

Comment 8 Bryan Kearney 2020-09-07 16:02:06 UTC
Upstream bug assigned to dmatoule

Comment 9 Marek Hulan 2020-09-08 07:13:35 UTC
I believe this has already been fixed as part of BZ 1778396, Waldirio, this should be fixed in 6.8 (beta), can you recheck please? I think we can close this afterwards (and the upstream ticket)

Comment 10 Waldirio M Pinheiro 2020-09-29 19:58:42 UTC
Hello Marek,

I'll try/check on 6.8 beta and will let you know.

Thank you
Waldirio

Comment 11 Mike McCune 2021-03-16 15:58:39 UTC
Upon review of our valid but aging backlog the Satellite Team has concluded that this Bugzilla does not meet the criteria for a resolution in the near term, and are planning to close in a month. If you have any concerns about this, please contact your Red Hat Account team.  Thank you.

Comment 13 Mike McCune 2021-07-09 17:02:24 UTC
Thank you for your interest in Satellite 6. We have evaluated this request, and while we recognize that it is a valid request, we do not expect this to be implemented in the product in the foreseeable future. This is due to other priorities for the product, and not a reflection on the request itself. We are therefore closing this out as WONTFIX. If you have any concerns about this feel free to contact your Red Hat Account Team. Thank you.


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