Red Hat Bugzilla – Bug 849039
Some errors show up when add extra word to "rhc app destroy"
Last modified: 2015-07-19 20:51:37 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):
Steps to Reproduce:
1.Create an app named "ruby19"
2.Destroy the app, use the command "rhc app destroy -a ruby19 12 -p123456"
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 /usr/local/bin/rhc-app:19:in `load'
Do you want to destroy this application (y/n):
No such error.
When we refactor the application RHC commands this should be fixed.
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.
Refactoring is done, this should no longer be an issue under the new command
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
-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