Bug 1607207 - [RFE] Job_invocation reset API could support its output being formatted in clean JSON by providing an API endpoint
Summary: [RFE] Job_invocation reset API could support its output being formatted in cl...
Alias: None
Product: Red Hat Satellite 6
Classification: Red Hat
Component: Remote Execution
Version: 6.3.0
Hardware: x86_64
OS: Linux
medium vote
Target Milestone: 6.5.0
Assignee: Adam Ruzicka
QA Contact: Peter Ondrejka
Depends On:
TreeView+ depends on / blocked
Reported: 2018-07-23 02:37 UTC by raju kumar
Modified: 2019-11-05 22:30 UTC (History)
6 users (show)

Fixed In Version: tfm-rubygem-foreman_remote_execution-1.6.7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed: 2019-05-14 12:37:37 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2019:1222 None None None 2019-05-14 12:37:44 UTC
Foreman Issue Tracker 24483 None None None 2018-07-30 16:08:48 UTC

Description raju kumar 2018-07-23 02:37:37 UTC
1. Proposed title of this feature request - 

Job_invocation reset API could support its output being formatted in clean JSON by providing an API endpoint that returns the output in a single field.

2. Who is the customer behind the request?
     Account: name (acct #) TVA [540694]
     TAM customer: no
     SRM customer: yes
     Strategic: yes

3. What is the nature and description of the request?

Customer executed job_invocation command `ps aux` via below API
curl -k -X POST  -u admin:password --data '{ "job_invocation": { "inputs": {"command": "ps aux"}, "job_template_id": 94,"targeting_type": "static_query", "search_query": "name = client.example.com" } }' -H "Content-Type:application/json" https://Satellite.example.com/api/job_invocations/

When they try to get the output for a host using below API, the JSON output is split between multiple JSON outputs and has all the injected new line (such as the /n and /r statements)-

curl -k -X GET  -u admin:password -H "Content-Type:application/json" https://satellite.example.com/api/job_invocations/14/hosts/65 | python -m json.tool

Customer wants to know if the json output from the rest call was just the raw data in one json object / string it would be ideal. But as it stands now the json output is split between multiple json outputs and has all the injected new line statements that make presenting it to a user as a legible list very difficult.

4. Why does the customer need this? (List the business requirements here) 

Customer is in process of automating where they are running into situations where they need per-cursor information prior to running a complex automation job such as a very recent listing of a process ID. 

Being able to use Satellites job_invocation API and getting its "STDOUT" in a clean and consistent format would be required going forward. 

5. For each functional requirement listed, specify how Red Hat and the customer can test to confirm the requirement is successfully implemented. 

Customer would prefer it if the job_invocation reset API could support its output being formatted in clean JSON. Rather than the "Job invocations store output by the timestamp received" I think their should be an option to asynchronously submit a job and wait for its complete output in properly formatted JSON. This would ensure that the entire STDOUT would be available for logging / reporting in one block of JSON.

6. Does the customer have any specific time-line dependencies and which release would they like to target (i.e. RHEL5, RHEL6)? → no

7. Is the sales team involved in this request and do they have any additional input? → no

8. List any affected packages or components. → no

9. Would the customer be able to assist in testing this functionality if implemented? -→yes

Comment 2 Ivan Necas 2018-07-30 16:08:46 UTC
Created redmine issue https://projects.theforeman.org/issues/24483 from this bug

Comment 3 pm-sat@redhat.com 2018-09-19 14:01:48 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 4 pm-sat@redhat.com 2018-09-19 14:01:51 UTC
Upstream bug assigned to aruzicka@redhat.com

Comment 5 Ivan Necas 2018-12-12 16:53:25 UTC
Proposing for 6.5, as this is going to be available in latest 1.20 release

Comment 6 Peter Ondrejka 2019-01-31 15:29:43 UTC
Verified in Satellite 6.5 snap 13, job invocation related api requests now return well-formed JSON

Comment 9 errata-xmlrpc 2019-05-14 12:37:37 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.


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