Bug 1278291

Summary: The OPTIONS place mismatch in different atomic-openshift-installer Usage
Product: OpenShift Container Platform Reporter: Anping Li <anli>
Component: InstallerAssignee: Devan Goodwin <dgoodwin>
Status: CLOSED WONTFIX QA Contact: Ma xiaoqiang <xiama>
Severity: low Docs Contact:
Priority: medium    
Version: 3.0.0CC: aos-bugs, dgoodwin, jokerman, mmccomas, xtian
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-13 14:33:31 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 Anping Li 2015-11-05 07:58:01 UTC
Description of problem:

if we put OPTIONS after COMMAND, atomic-openshift-installer  will pop up Error.

'atomic-openshift-installer  --help' show OPTIONS should be prior to COMMAND, While 'atomic-openshift-installer upgrade  --help' show OPTIONS should be at the back of COMMAND. 


Version-Release number of selected component (if applicable):
atomic-openshift-utils-3.0.7-1.git.48.75d357c.el7aos.noarch


How reproducible:
always

Steps to Reproduce:

1.atomic-openshift-installer upgrade -c ansible.config
Error: no such option: -c

2.  atomic-openshift-installer 
Usage: atomic-openshift-installer [OPTIONS] COMMAND [ARGS]...

3. atomic-openshift-installer upgrade  --help
Usage: atomic-openshift-installer upgrade [OPTIONS]


Actual Result:
The OPTIONS place mismatch in different help description.

Expected Result:
The OPTIONS location should be accurate.


Additional info:

Comment 1 Devan Goodwin 2015-11-13 14:33:31 UTC
This is the behavior I would prefer as well, unfortunately we use the python Click library which explicitly does not agree with us: http://click.pocoo.org/5/commands/#passing-parameters

I attempted to pursue a decorator solution similar to the one in: https://github.com/mitsuhiko/click/issues/108

However this gets complicated as well. In the current form, all options then transfer to the subcommand and must be specified *after* install / uninstall / upgrade. They will not show up in "atomic-openshift-installer --help" either, but they would show up in "atomic-openshift-installer install --help".

I cannot specify them in both places without things getting very ugly.

So our options are (1) use what we have today, or (2) specify all cli args *after* the sub-command, which will break CLI commands shipping with 3.1. 

Another other solution will probably require going to a different CLI library entirely.

The reasoning behind click's decision to only support (1) is pretty logical and clean, even if it's not as user friendly as we would like. 

I'm going to assume we should keep it as it is today for now, please reopen this bug if QE feels strongly otherwise and I can use my implementation for (2) instead.