Bug 1577131 - [svcat] some svcat output information not clear
Summary: [svcat] some svcat output information not clear
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Service Catalog
Version: 3.10.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: 3.11.0
Assignee: Marko Luksa
QA Contact: Dongbo Yan
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-11 09:20 UTC by sunzhaohua
Modified: 2018-10-11 07:19 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
undefined
Clone Of:
Environment:
Last Closed: 2018-10-11 07:19:10 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2018:2652 0 None None None 2018-10-11 07:19:39 UTC

Description sunzhaohua 2018-05-11 09:20:29 UTC
Description of problem:
1) `oc plugin svcat --help` and `oc plugin svcat` help information are different.
2) `-v, --v Level ` option value type and scope are not clear. 
3) install command doesn't show useful information.
4) In plugin model, install command is not avaiable, should be hiden or prompted.
5) In plugin model, some command usage should add [name]. For example, "oc plugin svcat sync broker [flags]" should change to "oc plugin svcat sync broker [name] [flags]"


Version-Release number of selected component (if applicable):
svcat:
client: v3.10.0-0.38.0;Upstream:v0.1.16
server: v1.10.0+b81c8f8


How reproducible:
Always

Steps to Reproduce:
1. run `oc plugin svcat --help` and `oc plugin svcat`
2. run `svcat --help`
3. run `svcat --help`
4. In plugin model, check whether install command is avaiable
# oc plugin svcat install plugin
5. check command help information
#oc plugin svcat sync broker -h
# svcat sync broker -h

Actual results:

1) It is different and misleading. For example, I run `oc plugin svcat get brokers -v=7`, it is not work. But `svcat get brokers -v=7` and `oc plugin svcat get brokers --v=7` work.
# oc plugin svcat get brokers -v=7
Error: unknown shorthand flag: 'v' in -v=7
2) `-v, --v Level ` option value type and scope are not clear. 
3) install command doesn't show useful information.
4) In plugin model, install commond is not avaiable.
# oc plugin svcat install plugin
Error: could not copy /root/.kube/plugins/svcat/svcat to /root/.kube/plugins/svcat/svcat (open /root/.kube/plugins/svcat/svcat: text file busy)
error: exit status 1

5) In plugin model, some command usage should add [name]. For example, "oc plugin svcat sync broker [flags]" should change to "oc plugin svcat sync broker [name] [flags]"
# oc plugin svcat sync broker -h
Usage:
  oc plugin svcat sync broker [flags]

# svcat sync broker -h
Usage:
  svcat sync broker [name] [flags]
  

Expected results:
the output information should be clear and show in the same way.

Additional info:

Comment 1 sunzhaohua 2018-05-14 06:22:31 UTC
In plugin model, `oc plugin svcat` and `oc plugin svcat -h` ,they have different gloable flags. one is same with svcat command, one is same with oc command. I tried oc options are worked. But  this cause misunderstandings.

# oc plugin svcat get brokers --v=7
I0514 02:21:20.923473   18753 loader.go:357] Config loaded from file /root/.kube/config
I0514 02:21:20.940391   18762 loader.go:357] Config loaded from file /root/.kube/config
I0514 02:21:20.941579   18762 round_trippers.go:383] GET https://qe-zhsun-gce-310-513master-etcd-1:8443/apis/servicecatalog.k8s.io/v1beta1/clusterservicebrokers
I0514 02:21:20.941609   18762 round_trippers.go:390] Request Headers:
I0514 02:21:20.941621   18762 round_trippers.go:393]     Accept: application/json, */*
I0514 02:21:20.941632   18762 round_trippers.go:393]     User-Agent: svcat/v0.0.0 (linux/amd64) kubernetes/$Format
I0514 02:21:20.941699   18762 round_trippers.go:393]     Authorization: Bearer ImjzDu5qR2FtqjBX3hFC85Ajtle8kmTE84jysnKRaeg
I0514 02:21:20.958427   18762 round_trippers.go:408] Response Status: 200 OK in 16 milliseconds
           NAME                                                        URL                                              STATUS  
+-------------------------+-------------------------------------------------------------------------------------------+--------+
  ansible-service-broker    https://asb.openshift-ansible-service-broker.svc:1338/ansible-service-broker                Ready   
  template-service-broker   https://apiserver.openshift-template-service-broker.svc:443/brokers/template.openshift.io   Ready   

# oc plugin svcat get brokers -v=7
Error: unknown shorthand flag: 'v' in -v=7

Comment 2 sunzhaohua 2018-05-15 07:42:27 UTC
In plugin model,  `oc options` doesn't include logtostderr option.  run `oc plugin svcat get brokers --logtostderr` show error.

# oc plugin svcat 
Usage:
  svcat [flags]
  svcat [command]

Available Commands:
  bind        Binds an instance's metadata to a secret, which can then be used by an application to connect to the instance
  completion  Output shell completion code for the specified shell (bash).
  deprovision Deletes an instance of a service
  describe    Show details of a specific resource
  get         List a resource, optionally filtered by name
  install     
  provision   Create a new instance of a service
  sync        Syncs service catalog for a service broker
  touch       Force Service Catalog to reprocess a resource
  unbind      Unbinds an instance. When an instance name is specified, all of its bindings are removed, otherwise use --name to remove a specific binding
  version     Provides the version for the Service Catalog client and server

Flags:
      --context string      name of the kubeconfig context to use.
  -h, --help                help for svcat
      --kubeconfig string   path to kubeconfig file. Overrides $KUBECONFIG
      --logtostderr         log to standard error instead of files (default false)
  -v, --v Level             log level for V logs

Use "svcat [command] --help" for more information about a command.

# oc plugin svcat -h
The Kubernetes Service Catalog Command-Line Interface (CLI)

Usage:
  oc plugin svcat [flags]

Available Commands:
  bind        Binds an instance's metadata to a secret, which can then be used by an application to connect to the
instance
  completion  Output shell completion code for the specified shell (bash).
  deprovision Deletes an instance of a service
  describe    Show details of a specific resource
  get         List a resource, optionally filtered by name
  help        Help about any command
  install      
  provision   Create a new instance of a service
  sync        Syncs service catalog for a service broker
  touch       Force Service Catalog to reprocess a resource
  unbind      Unbinds an instance. When an instance name is specified, all of its bindings are removed, otherwise use
--name to remove a specific binding
  version     Provides the version for the Service Catalog client and server

Use "oc <command> --help" for more information about a given command.
Use "oc options" for a list of global command-line options (applies to all commands).

# oc plugin svcat get brokers --logtostderr
Error: unknown flag: --logtostderr

Usage:
  oc plugin svcat get brokers [flags]

Options:
  -o, --output='': The output format to use. Valid options are table, json or yaml. If not present, defaults to table

Use "oc options" for a list of global command-line options (applies to all commands).

#  svcat get brokers --logtostderr
           NAME                                                        URL                                              STATUS  
+-------------------------+-------------------------------------------------------------------------------------------+--------+
  ansible-service-broker    https://asb.openshift-ansible-service-broker.svc:1338/ansible-service-broker                Ready   
  template-service-broker   https://apiserver.openshift-template-service-broker.svc:443/brokers/template.openshift.io   Ready

Comment 3 Marko Luksa 2018-05-21 13:13:17 UTC
I've fixed 3), 4) and 5), and also a part of 1).

PR for 3 and 4: https://github.com/kubernetes-incubator/service-catalog/pull/2050 (already merged)

PR for 5: https://github.com/kubernetes-incubator/service-catalog/pull/2056

PR for one part of 1): https://github.com/kubernetes-incubator/service-catalog/pull/2044

The other aspects of 1) and 2) are much harder to fix. Can you open two separate bug reports for those? And describe what exactly you'd like to see as a solution?

The problem is that oc plugin svcat and oc plugin svcat --help are executed very differently. The first command actually invokes the plugin, while the other one doesn't - it only invokes oc and it then prints out the help messages. I've looked into how we could have them both have identical output, but that just isn't possible at the moment. Oc and svcat each use its own help output template. 

The scope of flags is also problematic, because we have three scopes of flags when running oc plugin svcat foo:
- the local flags used by svcat's foo command
- the global svcat flags
- the global oc flags

IMHO, they should be listed as three separate groups. But there's some overlap between them (like in the case of the --v flag). 

At this time, this seems like way too much work for very little benefit. Can you help identify individual problems instead of what you describe under 1)?

Comment 4 sunzhaohua 2018-05-22 09:36:43 UTC
1)If now we couldn't have them both have identical output. I think we should let them have same name.For example, rename "--kubeconfig" to "--config=". delete "-v" and hold "--v" only.  I don't know how to deal with "--logtostderr" option. `oc options` doesn't include logtostderr option.At least we should point out this in document.

2)I think we should specified separately for three scopes of flags. For svcat's foo command flags and global svcat flags maybe we can refer to `oc options` to set it as "--v=0: Set the level of log output (0-10)". For oc flags we keep default is ok.

Comment 5 Jay Boyd 2018-05-22 15:21:40 UTC
3.10 is closing out, moving target release to 3.11.

Comment 6 Jay Boyd 2018-08-07 17:22:57 UTC
This has been picked up by OpenShift 3.11.  Anything built since 18 July will include it, please make certain Service Catalog build is v0.1.24 or later.

Comment 7 Jian Zhang 2018-08-13 05:48:08 UTC
Some display problems still exist for v0.1.27, such as:

[root@qe-jiazha-round2master-etcd-1 ~]# oc plugin svcat sync broker -h
Syncs service catalog for a service broker

Usage:
  oc plugin svcat sync broker [flags]

[root@qe-jiazha-round2master-etcd-1 ~]# oc plugin svcat install plugin
Error: unknown command "install" for "svcat"
Run 'svcat --help' for usage.
error: exit status 1

...

[root@qe-jiazha-round2master-etcd-1 ~]# svcat version
Client Version: v3.11.0-0.13.0;Upstream:v0.1.27
Server Version: v1.11.0+d4cacc0
[root@qe-jiazha-round2master-etcd-1 ~]# oc plugin svcat version
Client Version: v3.11.0-0.13.0;Upstream:v0.1.27
Server Version: v1.11.0+d4cacc0

Comment 9 Dongbo Yan 2018-08-24 03:01:53 UTC
Test with Client Version: v3.11.0-0.20.0;Upstream:v0.1.29

1) # oc plugin svcat get broker --logtostderr
no error outputs
2) track in bz1581185
3) $svcat --help
 install     Install Service Catalog related tools
   $oc plugin svcat --help
 cannot see install command
4) no need execute install command in plugin model
5) all command usage have added [name]

move to verified

Comment 11 errata-xmlrpc 2018-10-11 07:19:10 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


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