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 2263041 - Hammer "job-invocation create" does not produce clean CSV/JSON format if requested
Summary: Hammer "job-invocation create" does not produce clean CSV/JSON format if requ...
Keywords:
Status: ON_QA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Tasks Plugin
Version: 6.15.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: stream
Assignee: Oleh Fedorenko
QA Contact: Satellite QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-02-06 18:11 UTC by Ondrej Gajdusek
Modified: 2024-05-14 12:47 UTC (History)
4 users (show)

Fixed In Version: rubygem-hammer_cli_foreman_tasks-0.0.21
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 37264 0 Normal New Hammer "job-invocation create" does not produce clean CSV/JSON format if requested 2024-03-14 14:59:00 UTC
Red Hat Issue Tracker SAT-23096 0 None None None 2024-02-06 18:13:14 UTC

Description Ondrej Gajdusek 2024-02-06 18:11:34 UTC
Description of problem:
hammer --output=csv nor hammer --output=json does not provide valid output in the requested format. 

Examples:

# hammer --output=csv job-invocation create --inputs="command=echo tYEzvrxBAG" --job-template="Run Command - Script Default" --search-query="name ~ my.host.com" 2> /dev/null
Message,Id
Job invocation 3 created,3
1 task(s), 0 success, 1 fail

# hammer --output=json job-invocation create --inputs="command=echo tYEzvrxBAG" --job-template="Run Command - Script Default" --search-query="name ~ my.host.com" 2> /dev/null
{
  "message": "Job invocation 4 created",
  "id": 4
}
1 task(s), 0 success, 1 fail

Version-Release number of selected component (if applicable):
6.12 (or lower) onwards

How reproducible:
always

Steps to Reproduce:
1.Run `hammer --output=csv job-invocation create` or `hammer --output=json job-invocation create`

Actual results:
There is an extra line on STDOUT that shows the result of the task. This prevents STDOUT from being parsed as JSON or CSV.

Expected results:
No extra line in the requested format.

Comment 1 Oleh Fedorenko 2024-03-14 14:58:59 UTC
Created redmine issue https://projects.theforeman.org/issues/37264 from this bug

Comment 2 Bryan Kearney 2024-03-15 16:03:31 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/37264 has been resolved.


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