Hi Isuru,

+1 for the improvements.

Find my comments inline


On Thu, May 9, 2013 at 9:53 PM, Isuru Perera <[email protected]> wrote:

> Hi,
>
> For Stratos 2.0 release, we are planning to improve the existing CLI Tool
> [1].
>
> We are planning to support following features in Stratos2 CLI Tool
>
>
>    - Command history [2]
>    - Auto-completion of commands
>    - Character masking (for passwords) [3]
>
>
> For above features, we are planning to use jline2 library [4].
>
> *Existing Design*
>
> Currently the CLI tool has two modes. (Stratos2 CLI source can be found at
> [5])
>
> 1. Interactive Mode - In this mode, user is logged in by passing only
> username & password as arguments.
>
> $stratos <username> <password>
> After successful login, the user get a prompt as "stratos>"
>

We gave up -u, -p for passing credentials as they were mandatory.
Since we are improving it to mask password its good to have the options
model back.

We used Apache commons cli library to achieve that as for all other
optional inouts. Same library may help to add it again if we continue to
use that library.


> 2. Single Command Line Mode - In this mode, all the commands are passed as
> arguments including username and password
>
> $stratos <username> <password> list
> This will list all the cartridges.
>
> AFAIK, we can support above features only when the CLI tool is in prompt
> mode.
>
Normal command features are supported in this mode(e.g. History) as we run
them in terminal, not in an our prompt.


> In order to provide auto-complete features at the terminal, we need to use
> OS specific functions, for example /etc/bash_completion [6]
>
>
The single line mode was introduced later for the requirement of scripting
Stratos commands.
Eg. To write a bash script to do any Stratos operations.
Make sure we have a way to achieve that with new improvements.

*Drawbacks of existing Beta 2 CLI Tool & Possible Solutions*
>
> 1. A drawback of existing design is that we have to login every time the
> stratos command is executed.
>

This is true for Single line commands. But since we use Basic Auth, AFAIK
we do not login every time for prompt mode.


>
> Solution: Login only once. The back-end service is an admin service and we
> login as a tenant. I'm thinking of a way to save session in the file
> system. For example inside <user.home>/.stratos/
>
> If we can save the session id, then we use the same for authenticate next
> requests. In this way, the user can use the CLI tool, until the session
> times out.
>
> Or else we can keep the username and password cached (encrypted form). In
> this way, user can keep using the tool without worrying about the session
> time out.
>
> Which is the better way?
>
> 2. Currently the password is entered in the command line itself
>
> Solution: With jline2, we can use masking for password input.
>
> 3. Command history not support.
>
> Solution: jline2 can provide command history. Additionally if we can login
> only once, user can execute commands directly in terminal and use the
> history available in the terminal environment.
>
> *New Design*
>
> I'm going to introduce following commands to the tool
>
So are we planning to ship as Jar and script file as we had before?

Thanks.

>
> 1. $stratos setup
> This will prompt for Stratos Controller hostname & port. These values will
> be saved in <user.home>/.stratos/stratos.config
>
> 2. $stratos login
> This will have arguments for username and password. Password will be
> prompted with masked character. Authentication details will be saved in
> <user.home>/.stratos/
>
> 3. $stratos logout
> Logout user.
>
> After successful login, user can go into interactive mode by just entering
> "stratos" or user can execute commands in single line. For example "stratos
> list", "stratos subscribe" etc.
>
> CLI Tool will also be improved to use a single '-' for short option names
> and '--' for longer option names [7].
>
> WDYT?
>
> [1] https://wso2.org/jira/browse/SPI-234
> [2] https://wso2.org/jira/browse/SPI-111
> [3] https://wso2.org/jira/browse/SPI-241
> [4] http://jline.github.io/jline2/
> [5]
> https://svn.wso2.org/repos/wso2/carbon/platform/branches/4.1.0/components/stratos/artifact-deployment-coordinator/org.wso2.carbon.adc.mgt.cli/2.1.1
> [6] http://www.debian-administration.org/articles/316
> [7] https://wso2.org/jira/browse/SPI-240
>
> --
> Isuru Perera
> Senior Software Engineer | WSO2, Inc. | http://wso2.com/
> Lean . Enterprise . Middleware
>
> Twitter: http://twitter.com/chrishantha | LinkedIn:
> http://lk.linkedin.com/in/chrishantha/
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
--
Lahiru Sandaruwan
Software Engineer,
Platform Technologies,
WSO2 Inc., http://wso2.com
lean.enterprise.middleware

email: [email protected] cell: (+94) 773 325 954
blog: http://lahiruwrites.blogspot.com/
twitter: http://twitter.com/lahirus
linked-in: http://lk.linkedin.com/pub/lahiru-sandaruwan/16/153/146
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to