Petals CLI SNAPSHOT

compared with
Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (18)

View Page History
h2. Connection options from the command line

All the required parameters for a JMX connection must be configurable on the command line as options:
All the required parameters for a JMX connection can be configured on the command line as options or through the command {{connect}}:
{code}
> ./petals-cli.sh -h <host> -n <port> -u <user> -p <password> -c -- <command>
> ./petals-cli.sh -h <host> -n <port> -u <user> -p <password> -C
> ./petals-cli.sh -C
petals-cli> connect -h <host1> -n <port1> -u <user1> -p <password1>
petals-cli@<host1>:<port1>>
{code}

\\
An alias can also be used.
{code}
> ./petals-cli.sh -a <alias> -c -- <command>
> ./petals-cli.sh -a <alias> -C
petals-cli> connect -a <alias1>
petals-cli@<host1>:<port1>>
{code}

h2. Interacting with several Petals nodes without exiting Petals CLI
{tip}The arguments {{-h}}, {{-p}}, {{-u}}, {{-p}} and {{-a}} of the command line are significant only for the command line mode (ie. {{-c}}){tip}

In interactive mode or script mode, we should be able to close a connection and open another one without leaving Petals CLI. This is achieved with the '_connect_' and '_disconnect_' commands. If no argument is set on the '_connect_' command, default values are used. These default values are specified in the preferences file. If a connection already exists, the '_connect_' command will realize a disconnection before to establish the new connection.

{code}
> ./petals-cli.sh -C

Type 'help' for help.
------------------------------------------------------------------------------
petals-cli> connect -h <host1> -n <port1> -u <user1> -p <password1>
Connected on <host1>:<port1> with '<user1>'
petals-cli@<host1>:<port1>> disconnect
petals-cli> connect -a <alias>
Connected on <host1>:<port1> with '<user1>'
petals-cli@<host1>:<port1>> disconnect
petals-cli> connect -h <host2> -n <port2> -u <user2> -p <password2>
Connected on <host2>:<port2> with '<user2>'
petals-cli@<host2>:<port2>> connect
petals-cli@<host2>:<port2>> Would you like to connect to <default-user>:*****@<default-host>:<default-port>? (y/n)
y
petals-cli@<default-host>:<default-port>>
{code}

h2. Default connection

By default (if no argument or option is set).
In console mode, the connection is established, by the command 'connect', with the values given in the preferences file. The connection parameters are identified through the default alias defined by the property {{alias.default}} of the preferences file.
{code}
> ./petals-cli.sh -C
{code}

In command line mode, if no argument or option is set, a connection is *automatically* established (the command 'connect' is automatically executed before the provided command) with the values defined in the preferences file.
In command line mode, no default connection is available. A connection is *automatically* established with the connection parameters explicitly set on the command line.

{code}
> ./petals-cli.sh -h localhost -n 7700 -u petals -p petals -c -- stop
> ./petals-cli.sh -a default -c -- stop
{code}

{tip}This is necessary to easily stop a local container{tip}

In script mode, the connection is established, by the command 'connect', with the values defined given in the preferences file. The connection parameters are identified through the default alias defined by the property {{alias.default}} of the preferences file.
{code}
> ./petals-cli.sh - << EOF
If the preferences file does not exist and that _connect_ was invoked without an argument, the command returns the error code 2.

h2. Interacting with several Petals nodes without exiting Petals CLI

In interactive mode or script mode, we should be able to close a connection and open another one without leaving Petals CLI. This is achieved with the '_connect_' and '_disconnect_' commands. If no argument is set on the '_connect_' command, default values are used. These default values are specified in the preferences file. If a connection already exists, the '_connect_' command will realize a disconnection before to establish the new connection.

{code}
> ./petals-cli.sh -C

Type 'help' for help.
------------------------------------------------------------------------------
petals-cli> connect -h <host1> -n <port1> -u <user1> -p <password1>
Connected on <host1>:<port1> with '<user1>'
petals-cli@<host1>:<port1>> disconnect
petals-cli> connect -a <alias>
Connected on <host1>:<port1> with '<user1>'
petals-cli@<host1>:<port1>> disconnect
petals-cli> connect -h <host2> -n <port2> -u <user2> -p <password2>
Connected on <host2>:<port2> with '<user2>'
petals-cli@<host2>:<port2>> connect
petals-cli@<host2>:<port2>> Would you like to connect to <default-user>:*****@<default-host>:<default-port>? (y/n)
y
petals-cli@<default-host>:<default-port>>
{code}

h2. Security