Bug 1383218 - oc get --raw outputs mess json and needs to append a break line
Summary: oc get --raw outputs mess json and needs to append a break line
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OKD
Classification: Red Hat
Component: Pod
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
low
Target Milestone: ---
: ---
Assignee: Fabiano Franz
QA Contact: DeShuai Ma
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-10 08:42 UTC by XiaochuanWang
Modified: 2016-11-21 19:09 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-21 19:09:15 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description XiaochuanWang 2016-10-10 08:42:42 UTC
Description of problem:
`oc get --raw="/"` needs a break line in the end of output.
Other request like `oc get --raw="/api/v1/"` will return a mess json

Version-Release number of selected component (if applicable):
oc/openshift v1.4.0-alpha.0+e76e0e8

How reproducible:
Always

Steps to Reproduce:
1. oc get --raw="/"
2. oc get --raw="/api/v1/"
3. Try other requests like `oc get --raw "/oapi/v1/users/~"`

Actual results:
1. Need to append a break line after the end character "}"
2 & 3. Output a mess json as below:
# oc get --raw "/oapi/v1/users/~"
{"kind":"User","apiVersion":"v1","metadata":{"name":"xiaocwan","selfLink":"/oapi/v1/users/xiaocwan","uid":"6b35cf0f-8e8e-11e6-8533-0ee97497f27f","resourceVersion":"498","creationTimestamp":"2016-10-10T02:08:21Z"},"identities":["anypassword:xiaocwan"],"groups":null}

Expected results:
Output should be prettier.

Additional info:

Comment 1 David Eads 2016-10-10 14:56:23 UTC
`--raw` is intended to give output exactly as it returns from the server.  Think of it as a nice wrapper on curl to allow you to easily run requests against the API server that aren't covered by the normal flows.  For example, `oc get --raw /metrics`.  Any mutation of the output defeats the purpose of the command.

@ffranz If you want to add newline on `stderr` I'm ok with that, but definitely not in `stdout`.


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