Bug 1013321

Summary: when do app control commands for app2 under app1 repo dir, it actually do operations on app1.
Product: OpenShift Online Reporter: weiwei jiang <wjiang>
Component: ocAssignee: Clayton Coleman <ccoleman>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 2.xCC: wsun, 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: 2013-10-17 13:32:46 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:

Description weiwei jiang 2013-09-29 09:05:41 UTC
Description of problem:
when do app control commands for app2 under app1 repo dir, it actually do operations on app1.

Version-Release number of selected component (if applicable):
rhc-1.15.3

How reproducible:
always

Steps to Reproduce:
1.create a app $app1 and git clone the app repo to local dir
2.cd repo dir
3.create another app $app2
4.try to control app2 with -a option
rhc app stop -a app2
rhc app restart -a app2
rhc cartridge add mysql-5.1 -a app2

Actual results:
# rhc app stop -a apps -d
DEBUG: Using config file /root/.openshift/express.conf
DEBUG: Git config 'git config --get rhc.app-id' returned '5247c93a6e0f5d6874000057'
DEBUG: Git config 'git config --get rhc.app-name' returned 'app'
DEBUG: Git config 'git config --get rhc.domain-name' returned 'wjiang'
DEBUG: Authenticating with RHC::Auth::Token
DEBUG: Connecting to https://10.4.59.132/broker/rest/api
DEBUG: Client supports API versions 1.1, 1.2, 1.3, 1.4, 1.5
DEBUG: Using token authentication
DEBUG: Created new httpclient
DEBUG: Request GET https://10.4.59.132/broker/rest/api
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 1194 ms
DEBUG: Server supports API versions 1.0, 1.1, 1.2, 1.3, 1.4
DEBUG:    Using API version 1.4
DEBUG: Client API version 1.4 is not current. Refetching API
DEBUG: Using token authentication
DEBUG: Request GET https://10.4.59.132/broker/rest/api
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 1132 ms
DEBUG: Getting all domains
DEBUG: Using token authentication
DEBUG: Request GET https://10.4.59.132/broker/rest/domains
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 1137 ms
DEBUG: Getting all applications for domain wjiang
DEBUG: Using token authentication
DEBUG: Request GET https://10.4.59.132/broker/rest/domains/wjiang/applications
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 1447 ms
DEBUG: Stopping application app force-false
DEBUG: Using token authentication
DEBUG: Request POST https://10.4.59.132/broker/rest/domains/wjiang/applications/app/events
DEBUG: SSL Verification failed -- Using self signed cert
DEBUG:    code 200 7726 ms
RESULT:
 stopped

Expected results:
It should use the given value instead of `git config`

Additional info:

Comment 1 Clayton Coleman 2013-10-02 14:46:01 UTC
As a consequence of the fix here, 'rhc ssh' will now behave differently.  In a app Git directory, you must run 'rhc ssh -- <command>' or 'rhc app-alias -- <alias>' in order to get the implicit value to work.  This is because it's impossible to know for sure whether the first value is an app name or an alias.

Comment 2 Clayton Coleman 2013-10-02 16:54:57 UTC
https://github.com/openshift/rhc/pull/471

Comment 3 Clayton Coleman 2013-10-02 21:42:51 UTC
Needs a stage pull - didn't make the cut today.

Comment 4 openshift-github-bot 2013-10-03 16:24:32 UTC
Commit pushed to master at https://github.com/openshift/rhc

https://github.com/openshift/rhc/commit/3725348374c05b2a621cf684b9be06cf71738179
Bug 1013321 - Handle implicit arguments more accurately

When both arguments to a command are optional (rhc ssh <app> <command...>), if the user wants to use the default app - the current Git directory, for instance - then they must specify '--' in order to guarantee that <command> isn't confused for <app>.  This commit changes that parsing behavior and cleans up the tests to ensure we are covering that case.

Comment 5 weiwei jiang 2013-10-08 04:45:44 UTC
Tried on INT(devnev_stage_488) and this issue has been fixed. So verified it. Thanks