Bug 1005426
Summary: | Better CLI Parsing and Error reporting | ||||||
---|---|---|---|---|---|---|---|
Product: | [JBoss] JBoss Operations Network | Reporter: | Jim Tyrrell <jtyrrell> | ||||
Component: | CLI, Usability | Assignee: | Thomas Segismont <tsegismo> | ||||
Status: | CLOSED CURRENTRELEASE | QA Contact: | Armine Hovsepyan <ahovsepy> | ||||
Severity: | low | Docs Contact: | |||||
Priority: | medium | ||||||
Version: | JON 3.1.2 | CC: | ahovsepy, hrupp, jkremser, jshaughn, mfoley, myarboro, tsegismo | ||||
Target Milestone: | ER05 | ||||||
Target Release: | JON 3.3.0 | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Whiteboard: | |||||||
Fixed In Version: | Doc Type: | Bug Fix | |||||
Doc Text: | Story Points: | --- | |||||
Clone Of: | Environment: | ||||||
Last Closed: | 2014-12-11 14:02:24 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: | |||||||
Attachments: |
|
Description
Jim Tyrrell
2013-09-06 21:58:23 UTC
Maybe we can make this a bit better for 3.3.0. Setting to ER04. Fixed in master commit 5fec5167ff76c9081203b538db9098ad47765fe2 Author: Thomas Segismont <tsegismo> Date: Mon Sep 29 17:34:23 2014 +0200 * Unified behavior for CLI script args and "login" command args * Fixed "login" command: ** support host definition without port definition ** output defaults for host and port ** command syntax message ** show meaningful error messages: *** for port number format *** for unsupported transport *** for exceptions (use exception cause message instead of meaningless JBoss Remoting exception message) Also, some code cleanup (In reply to Jim Tyrrell from comment #0) > Description of problem: > A few things around connecting via the CLI could be improved > > Version-Release number of selected component (if applicable): > RHQ Enterprise Remote CLI 4.4.0.JON312GA > > Expected results: > 1.) When running the command line I should get help with more then just > ./rhq-cli.sh --help > rhq-cli.sh [-h] [-u user] [-p pass] [-P] [-s host] [-t port] [-v] [-f > file]|[-c command] > RHQ Enterprise Remote CLI 4.4.0.JON312GA > > > /? and -help and -h could all return the same to match. Could not find a way to do that with Gnu Getopt for Java. Getopt accepts arguments in the short and long form ("-h", "--help"). It's not perfect but already good IMO. > > 2.) Jim-Tyrrells-MacBook-Pro-2:bin jimtyrrell$ ./rhq-cli.sh -u rhqadmin -p > rhqadmin 192.168.1.25 > RHQ Enterprise Remote CLI 4.4.0.JON312GA > Login failed: Can not connect http client invoker. Connection refused. > Usage: login username password [host port [transport]] > > > When running this command with a bad command line parameter passed in I > should get a output above of: > rhq-cli.sh [-h] [-u user] [-p pass] [-P] [-s host] [-t port] [-v] [-f > file]|[-c command] > Instead of the command line usage once I started the tool > This is considered valid because 192.168.1.25 may be a parameter. With commit 5fec5167ff76c9081203b538db9098ad47765fe2 you'll see a message telling you that the CLI will log in with the default host (localhost). > 3.) ./rhq-cli.sh -u rhqadmin -p rhqadmin -s 192.168.1.25 > RHQ Enterprise Remote CLI 4.4.0.JON312GA > Remote server version is: 3.1.2.GA (323587d:38819b7) > Login successful > > Good job on this working and assuming the 7080 port. > > However, ./rhq-cli.shRHQ Enterprise Remote CLI 4.4.0.JON312GA > unconnected$ login rhqadmin rhqadmin 192.168.1.25 > Login failed: Can not connect http client invoker. Connection refused. > Usage: login username password [host port [transport]] > This doesn't respect the usual port. > > 4.) Also if I pass in a bad port or IP address a better message should > occur to m let me now it is not working. For example running this command: > ./rhq-cli.sh -u rhqadmin -p rhqadminRHQ Enterprise Remote CLI 4.4.0.JON312GA > Login failed: Can not connect http client invoker. Connection refused. > Usage: login username password [host port [transport]] > > I have no idea which IP address is trying to be connected or if it was the > problem or the port. Fixed branch: release/jon3.3.x link: https://github.com/rhq-project/rhq/commit/83bb4ab21 time: 2014-10-03 14:26:27 +0200 commit: 83bb4ab218c49505188bed263b3c6423eae65eea author: Thomas Segismont - tsegismo message: Bug 1005426 - Better CLI Parsing and Error reporting * Unified behavior for CLI script args and "login" command args * Fixed "login" command: ** support host definition without port definition ** output defaults for host and port ** command syntax message ** show meaningful error messages: *** for port number format *** for unsupported transport *** for exceptions (use exception cause message instead of meaningless JBoss Remoting exception message) Also, some code cleanup (cherry picked from commit 5fec5167ff76c9081203b538db9098ad47765fe2) Signed-off-by: Jirka Kremser <jkremser> Conflicts: modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/commands/LoginCommand.java Moving to ON_QA as available to test with the latest brew build: https://brewweb.devel.redhat.com//buildinfo?buildID=394734 Created attachment 950358 [details]
rhq_cli.log
verified in JON 3.3 ER05 rhq-cli.log attached |