Bug 1577769

Summary: [APB] apb list "-o" option output format in yaml and json have different result
Product: OpenShift Container Platform Reporter: sunzhaohua <zhsun>
Component: Service BrokerAssignee: Dylan Murray <dymurray>
Status: CLOSED ERRATA QA Contact: Zihan Tang <zitang>
Severity: medium Docs Contact:
Priority: medium    
Version: 3.10.0CC: aos-bugs, chezhang, jiazha, jmatthew, zhsun, zitang
Target Milestone: ---   
Target Release: 3.11.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
undefined
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-10-11 07:20:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description sunzhaohua 2018-05-14 06:45:02 UTC
Description of problem:
`apb list -o yaml` and `apb list -o json` have different results. If this option must use with "--verbose" option should be explained. If add --verbose option, the result also different.


Version-Release number of selected component (if applicable):
oc v3.10.0-0.41.0
Version: apb-1.2.8

How reproducible:
Always

Steps to Reproduce:
1. list all apbs
#apb list
2. Output verbose information in yaml or json
#apb list -o yaml
#apb list -o json
3. add "--verbose" option
#apb list -o yaml --verbose
#apb list -o json --verbose

Actual results:
Output verbose information in yaml or json are different. 
Add "--verbose" option, yaml lack of "instances_retrievable", "instances_retrievable", "plans.id", "plans.schemas".

1. # apb list
ID                                NAME             DESCRIPTION                                         
0cd794ef27f565cc0e755585dbbcdcdc  local-my-01-apb  This is a sample application generated by apb init

2. # apb list -o yaml
ID                                NAME             DESCRIPTION                                         
0cd794ef27f565cc0e755585dbbcdcdc  local-my-01-apb  This is a sample application generated by apb init 

# apb list -o json
[
    {
        "bindable": false, 
        "bindings_retrievable": false, 
        "description": "This is a sample application generated by apb init", 
        "id": "0cd794ef27f565cc0e755585dbbcdcdc", 
        "instances_retrievable": true, 
        "metadata": {
            "dependencies": [], 
            "displayName": "my-01"
        }, 
        "name": "local-my-01-apb", 
        "plans": [
            {
                "description": "This default plan deploys my-01-apb", 
                "free": true, 
                "id": "92111c30af3ec77c9c6bbfb3fa02990c", 
                "metadata": {
                    "schemas": {
                        "service_binding": {
                            "create": {
                                "openshift_form_definition": []
                            }
                        }, 
                        "service_instance": {
                            "create": {
                                "openshift_form_definition": []
                            }, 
                            "update": {}
                        }
                    }
                }, 
                "name": "default", 
                "schemas": {
                    "service_binding": {
                        "create": {
                            "parameters": {
                                "$schema": "http://json-schema.org/draft-04/schema", 
                                "additionalProperties": false, 
                                "type": "object"
                            }
                        }
                    }, 
                    "service_instance": {
                        "create": {
                            "parameters": {
                                "$schema": "http://json-schema.org/draft-04/schema", 
                                "additionalProperties": false, 
                                "type": "object"
                            }
                        }, 
                        "update": {
                            "parameters": {
                                "$schema": "http://json-schema.org/draft-04/schema", 
                                "additionalProperties": false, 
                                "type": "object"
                            }
                        }
                    }
                }
            }
        ]
    }
]

3. # apb list -o json --verbose
same with `apb list -o json`

# apb list -o yaml --verbose
name: local-my-01-apb
id: 0cd794ef27f565cc0e755585dbbcdcdc
description: This is a sample application generated by apb init
bindable: false
metadata:
  dependencies: []
  displayName: my-01
plans:
- name: default
  description: This default plan deploys my-01-apb
  free: true
  metadata:
    schemas:
      service_binding:
        create:
          openshift_form_definition: []
      service_instance:
        create:
          openshift_form_definition: []
        update: {}
  parameters: []
  bind_parameters: []
  
  

Expected results:
Output information in yaml or json are same.
1) `apb list -o yaml` and `apb list -o json` should all show brief information.
2)`apb list -o yaml --verbose` and `apb list -o json --verbose` should have same detail information.


Additional info:

Comment 1 Dylan Murray 2018-08-13 19:06:59 UTC
https://github.com/automationbroker/apb/pull/114

The equivalent command is now `apb broker catalog`. You can do `apb broker catalog -o yaml` or `apb broker catalog -o json` and see the services displayed in either format. By default it uses a custom table printer and hides excessive information.

Comment 2 Dylan Murray 2018-08-22 14:50:21 UTC
New builds added to advisory:
openshift-enterprise-asb-container-v3.11.0-0.20.0.0
openshift-enterprise-apb-tools-container-v3.11.0-0.20.0.0

Comment 3 Zihan Tang 2018-08-28 08:38:34 UTC
Verified. 
-o json or -o yaml worked for 'apb broker catalog' 

version: apb-1.9.3

Comment 5 errata-xmlrpc 2018-10-11 07:20:00 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/RHBA-2018:2652