Bug 849039 - Some errors show up when add extra word to "rhc app destroy"
Some errors show up when add extra word to "rhc app destroy"
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
Unspecified Unspecified
low Severity low
: ---
: ---
Assigned To: N. Harrison Ripps
libra bugs
Depends On:
  Show dependency treegraph
Reported: 2012-08-17 03:06 EDT by xjia
Modified: 2015-07-19 20:51 EDT (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-11-06 13:47:53 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description xjia 2012-08-17 03:06:03 EDT
Description of problem:
When execute ""rhc app destroy -a ruby19 12 -p123456", there are some errors.

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

How reproducible:

Steps to Reproduce:
1.Create an app named "ruby19"
2.Destroy the app, use the command "rhc app destroy -a ruby19 12 -p123456"
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 12:45:36 EDT
When we refactor the application RHC commands this should be fixed.
Comment 2 N. Harrison Ripps 2012-09-11 09:47:17 EDT
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 14:51:46 EDT
Refactoring is done, this should no longer be an issue under the new command
Comment 4 xjia 2012-10-18 04:37:05 EDT
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

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