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. 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 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.
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