Bug 849039

Summary: Some errors show up when add extra word to "rhc app destroy"
Product: OKD Reporter: xjia <xjia>
Component: ocAssignee: N. Harrison Ripps <hripps>
Status: CLOSED CURRENTRELEASE QA Contact: libra bugs <libra-bugs>
Severity: low Docs Contact:
Priority: low    
Version: 2.xCC: ccoleman, hripps, johnp, 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: 2012-11-06 18:47:53 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 xjia 2012-08-17 07:06:03 UTC
Description of problem:
When execute ""rhc app destroy -a ruby19 12 -p123456", there are some errors.

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

How reproducible:
Always

Steps to Reproduce:
1.Create an app named "ruby19"
2.Destroy the app, use the command "rhc app destroy -a ruby19 12 -p123456"
3.
  
Actual results:
penshift@ubuntu:~/.openshift$ rhc app destroy -a ruby19 12 -p123456
!!!! WARNING !!!! WARNING !!!! WARNING !!!!
You are about to destroy the ruby19 application.

This is NOT reversible, all remote data for this application will be removed.
/var/lib/gems/1.8/gems/rhc-0.97.7/bin/rhc-app:339:in `gets': No such file or directory - 12 (Errno::ENOENT)
	from /var/lib/gems/1.8/gems/rhc-0.97.7/bin/rhc-app:339:in `control_app'
	from /var/lib/gems/1.8/gems/rhc-0.97.7/bin/rhc-app:509
	from /usr/local/bin/rhc-app:19:in `load'
	from /usr/local/bin/rhc-app:19
Do you want to destroy this application (y/n): 

Expected results:
No such error.

Additional info:

Comment 1 Clayton Coleman 2012-08-17 16:45:36 UTC
When we refactor the application RHC commands this should be fixed.

Comment 2 N. Harrison Ripps 2012-09-11 13:47:17 UTC
Investigated this at Matt's request. The problem is that extraneous command line arguments end up in ARGV. (In the example above, '12' is extraneous.) When gets() is invoked, it "Reads the next 'line' from the I/O stream" (http://www.ruby-doc.org/core-1.9.3/IO.html#method-i-gets), and anything hanging out in ARGV takes precedence over new input.

Two fix options:

1. Throw an error about the improperly formed command
2. Ignore the error and empty ARGV before calling gets()

I'm leaving this here in case we decide to address this before the refactoring is done.

Comment 3 Clayton Coleman 2012-10-17 18:51:46 UTC
Refactoring is done, this should no longer be an issue under the new command

Comment 4 xjia 2012-10-18 08:37:05 UTC
Verify: rhc 0.99.7

[root@broker ~]# rhc app delete -a ruby19 12 -predhat
Too many arguments passed in.

Usage: rhc app delete <app> [--namespace namespace]

Deletes your application and all of its data from the server. Use with caution as this operation is permanent.

Options for app delete
  -n, --namespace namespace Namespace to add your application to
  -b, --bypass              DEPRECATED Please use '--confirm'
  --confirm                 Deletes the application without prompting the user
  -a, --app name            The application you wish to delete

Global Options
  -l, --rhlogin login       OpenShift login
  -p, --password password   OpenShift password
  -d, --debug               Turn on debugging
  --noprompt                Suppress the interactive setup wizard from running before a command
  --config FILE             Path of a different config file
  -h, --help                Display help documentation
  -v, --version             Display version information