incubator-cloudstack-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebgoa <run...@gmail.com>
Subject Re: CLI for CloudStack: cloudmonkey
Date Fri, 09 Nov 2012 09:51:59 GMT
Using lower case commands solved the issue

thanks, and happy Diwali

-Sebastien

On Nov 8, 2012, at 8:14 PM, Rohit Yadav wrote:

> Oh, forgot to see that. Yes, now all the cmds are lowercase (except for few params liks
isAsync=) and tab completion is advised.
> 
> Regards.
> ________________________________________
> From: Kishan Kavala [Kishan.Kavala@citrix.com]
> Sent: Thursday, November 08, 2012 11:29 PM
> To: cloudstack-dev@incubator.apache.org
> Cc: cloudstack-dev@incubator.apache.org
> Subject: Re: CLI for CloudStack: cloudmonkey
> 
> Sebastian,
>  Try set apikey in lower case. Same with set secretkey.
> 
> ~kishan
> 
> On 08-Nov-2012, at 10:00 PM, "Sebastien Goasguen" <runseb@gmail.com> wrote:
> 
>> Actually it does not work yet.
>> 
>> Now I can type 'b' but it does not get passed properly:
>> 
>> πŸ™‰ cloudmonkey> set apiKey KEbkKWtYIz_q_fnpOdwnHoZUJt5tiBNiHvf-oApytBd0adU-s-DRP3an1pqL6TutyUCzjRB9UNrBybVr3kcZ6Q
>> 
>> Gives:
>> 
>> INFO  [cloud.api.ApiServer] (92734721@qtp-1601733969-7:) apiKey does not map to a
valid user -- ignoring request, apiKey: KEkKWtYIz_q_fnpOdwnHoZUJt5tiBNiHvf-oApytBd0adU-s-DRP3an1pqL6TutyUCzjRB9UNrByVr3kcZ6Q
>> 
>> On Nov 8, 2012, at 5:19 PM, Sebastien Goasguen <runseb@gmail.com> wrote:
>> 
>>> 
>>> On Nov 8, 2012, at 3:28 PM, Rohit Yadav <rohit.yadav@citrix.com> wrote:
>>> 
>>>> Hi Sebastien,
>>>> 
>>>> Are you using it from pypi/pip, if so do this:
>>>> sudo pip uninstall cloudmonkey
>>>> sudo pip install cloudmonkey
>>> 
>>> no, I am doing: sudo python ./setup.py install from the source tree
>>> 
>>>> I've had this bug on mac osx, fixed it:
>>>> https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.git;a=commit;h=36e7a7884efef7c41ac369549b7bdb93e5122110
>>> 
>>> pulled that and reinstalled…and it works.
>>> 
>>> thanks
>>> 
>>> -sebastien
>>> 
>>> 
>>>> If it still persists for you, checkout  http://superuser.com/questions/297527/cant-type-the-b-letter-in-python-shell-in-os-x
>>>> 
>>>> Let me know if this still fails then.
>>>> 
>>>> Regards.
>>>> 
>>>> ________________________________________
>>>> From: Sebastien Goasguen [runseb@gmail.com]
>>>> Sent: Thursday, November 08, 2012 5:37 PM
>>>> To: cloudstack-dev@incubator.apache.org
>>>> Subject: Re: CLI for CloudStack: cloudmonkey
>>>> 
>>>> Hi,
>>>> 
>>>> I am testing the cli and I have the weirdest issue. When I set the apikey
or secretkey, the lower case 'b' letter does not print at the prompt.
>>>> So if my keys contain 'b' they don't work..
>>>> 
>>>> I tried all the other letters and they work.
>>>> 
>>>> Anyone seeing this,
>>>> 
>>>> -Sebastien
>>>> 
>>>> On Nov 7, 2012, at 7:25 PM, Rohit Yadav <rohit.yadav@citrix.com> wrote:
>>>> 
>>>>> yes, I think I'd mentioned in the thread or somewhere. Just use pip or
easy_install (apt-get install python-setuptools on ubuntu, install python2.6 or above and
pip if you don't have it);
>>>>> 
>>>>> sudo pip install cloudmonkey
>>>>> 
>>>>> or sudo easy_install cloudmonkey
>>>>> 
>>>>> now start cloudmonkey:
>>>>> $ cloudmonkey
>>>>> ...
>>>>> 
>>>>> Will post a blog/screencast this weekend and update doc so everyone can
get help on its usage, though it's pretty intuitive.
>>>>> ________________________________________
>>>>> From: Musayev, Ilya [imusayev@webmd.net]
>>>>> Sent: Wednesday, November 07, 2012 11:41 PM
>>>>> To: cloudstack-dev@incubator.apache.org
>>>>> Subject: RE: CLI for CloudStack: cloudmonkey
>>>>> 
>>>>> Rohit,
>>>>> 
>>>>> Can I get the CLI only without going through the whole source code maven
install? Is it part of any RPM?
>>>>> 
>>>>> Thanks
>>>>> ilya
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Rohit Yadav [mailto:rohit.yadav@citrix.com]
>>>>> Sent: Monday, November 05, 2012 11:35 AM
>>>>> To: cloudstack-dev@incubator.apache.org
>>>>> Subject: Re: CLI for CloudStack: cloudmonkey
>>>>> 
>>>>> Checkout latest code. Few changes to share:
>>>>> 
>>>>> - All lowercase now
>>>>> - Tab tab over verbs to see list of params for that api, example list
users <tab><tab>
>>>>> - This needs improvement but help string, using --help: list user --help
>>>>> - Caching to speedup runtime
>>>>> - Color and Parsing fixes
>>>>> 
>>>>> Last, I'm now able to get the doc strings for each attribute/param, will
see this tomorrow.
>>>>> 
>>>>> Need your help, just incase you want to contribute, these are the TODOs:
>>>>> 
>>>>> - search over history
>>>>> - fix parsing
>>>>> - doc strings for parameters
>>>>> - testing for various kinds of apis (I'm able to deploy a zone with this,
but needs testing)
>>>>> - unicode char monkey, used in prompt may mess up history searching and
text display
>>>>> 
>>>>> 
>>>>> Regards.
>>>>> 
>>>>> On 02-Nov-2012, at 4:58 AM, Edison Su <Edison.su@citrix.com> wrote:
>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> -----Original Message-----
>>>>>>> From: Rohit Yadav [mailto:rohit.yadav@citrix.com]
>>>>>>> Sent: Thursday, November 01, 2012 2:23 PM
>>>>>>> To: cloudstack-dev@incubator.apache.org
>>>>>>> Subject: RE: CLI for CloudStack: cloudmonkey
>>>>>>> 
>>>>>>> After you install the tool, so that cloudmonkey is in your
>>>>>>> /usr/local/bin or in $PATH...
>>>>>>> 
>>>>>>> Two ways;
>>>>>>> 1. As command line tool, on bash/zsh, use the BNF grammar; <command
>>>>>>> line tool
>>>>>>> name>:<separator>:<verb>:<separator>:<action>:<separator>:<params>
>>>>>>> <command line tool name>={'cloudmonkey'} <separator>={'
'}
>>>>>>> <verb>={'list', 'create', 'delete', 'update'.... etc.}
>>>>>>> <action>={'Users'... etc.} <params>={'listall=#'...
etc.} So; $
>>>>>>> cloudmonkey list Users
>>>>>> 
>>>>>> 
>>>>>> Got it, thanks!
>>>>>> 
>>>>>>> 
>>>>>>> 2. file redirector:
>>>>>>> 
>>>>>>> $ cat test-file:
>>>>>>> list Users
>>>>>>> list <some other action>
>>>>>>> <some verb> <some action>
>>>>>>> 
>>>>>>> $ cloudmonkey < test-file
>>>>>>> 
>>>>>>> Note, I'll change the actions (Users, VirtualMachine etc.) to
>>>>>>> lowercase (users, virtualmachine etc.) if that's okay?
>>>>>> 
>>>>>> Please do, nobody wants to type extra keystroke, if it's not necessary.
>>>>>>> 
>>>>>>> Regards.
>>>>>>> 
>>>>>>> ________________________________________
>>>>>>> From: Edison Su [Edison.su@citrix.com]
>>>>>>> Sent: Friday, November 02, 2012 1:55 AM
>>>>>>> To: cloudstack-dev@incubator.apache.org
>>>>>>> Subject: RE: CLI for CloudStack: cloudmonkey
>>>>>>> 
>>>>>>> Oh, it reminds me that how to use the CLI on the bash command
line?
>>>>>>> I think admin may want to call cloudstack API in a bash script,
how
>>>>>>> can I do that?
>>>>>>> 
>>>>>>>> -----Original Message-----
>>>>>>>> From: Marcus Sorensen [mailto:shadowsor@gmail.com]
>>>>>>>> Sent: Thursday, November 01, 2012 1:11 PM
>>>>>>>> To: cloudstack-dev@incubator.apache.org
>>>>>>>> Subject: Re: CLI for CloudStack: cloudmonkey
>>>>>>>> 
>>>>>>>> Yes, I look forward to using it instead of local curl calls
on the
>>>>>>>> command line :-)
>>>>>>>> 
>>>>>>>> On Thu, Nov 1, 2012 at 2:02 PM, Edison Su <Edison.su@citrix.com>
wrote:
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>>> -----Original Message-----
>>>>>>>>>> From: Rohit Yadav [mailto:rohit.yadav@citrix.com]
>>>>>>>>>> Sent: Thursday, November 01, 2012 11:45 AM
>>>>>>>>>> To: cloudstack-dev@incubator.apache.org
>>>>>>>>>> Subject: RE: CLI for CloudStack: cloudmonkey
>>>>>>>>>> 
>>>>>>>>>> Hi Chip, please go ahead if we can fix the http/s
issue. The
>>>>>>>>>> connection is based on marvin, I'm sure using CLI
we'll find out
>>>>>>>>>> more bugs and fix anything in marvin thereby help
maintain
>>>>>>>>>> marvin->tests and
>>>>>>>> CLI.
>>>>>>>>>> Please hack that up on tools/marvin/marvin/cloudstackConnection.py
>>>>>>>>>> 
>>>>>>>>>> Edison, yes I'm working on the completedefault, I've
figured a
>>>>>>>>>> solution to the parsing and tabbing issue to show
params for any
>>>>>>>>>> api and added more verbs to the grammar like deploy,
start etc.
>>>>>>>>>> In the new approach doc strings and params needed
for an api are
>>>>>>>>>> fetched and cached in the class locally to speed
up the loading process.
>>>>>>>>>> Till it gets committed, cloudmonkey (now) will keep
telling the
>>>>>>>>>> user what params they are missing until it gets all
the required ones.
>>>>>>>>> 
>>>>>>>>> Great! Thanks for your awesome CLI, people will like
it.
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> One more thing, for people who may not have unicode
support the
>>>>>>>>>> prompt may appear weird and history search (up, down
) can mess up
>>>>>>>>>> the visuals. For example on Mac it appears as a colorful
emoji,
>>>>>>>>>> but I found that it looks weird on other platforms.
Will probably
>>>>>>>>>> remove it, or the user can custom set their prompt,
using: set
>>>>>>>>>> prompt
>>>>>>>>>> myprompt>
>>>>>>>>>> 
>>>>>>>>>> Regards.
>>>>>>>>>> PS. the set command is full of (fun :)  hacks because
of
>>>>>>>>>> funtional/generic programming, it basically can set
any attribute
>>>>>>>>>> on the class, so one can do something like creating
something
>>>>>>>>>> (var, func). For example set ruler # (so instead
of - you will
>>>>>>>>>> have a #
>>>>>>>>>> separator)
>>>>>>>>>> 
>>>>>>>>>> ________________________________________
>>>>>>>>>> From: Chip Childers [chip.childers@sungard.com]
>>>>>>>>>> Sent: Thursday, November 01, 2012 11:15 PM
>>>>>>>>>> To: cloudstack-dev@incubator.apache.org
>>>>>>>>>> Subject: Re: CLI for CloudStack: cloudmonkey
>>>>>>>>>> 
>>>>>>>>>> On Wed, Oct 31, 2012 at 2:10 PM, Rohit Yadav
>>>>>>>>>> <rohit.yadav@citrix.com>
>>>>>>>>>> wrote:
>>>>>>>>>>> Hi,
>>>>>>>>>>> 
>>>>>>>>>>> I was working on a CLI for cloudstack, it's based
on Marvin (the
>>>>>>>>>>> neglected robot) and called cloudmonkey after
our beloved mascot
>>>>>>>>>>> :D
>>>>>>>>>>> 
>>>>>>>>>>> I've committed that on master, please review:
>>>>>>>>>>> https://git-wip-us.apache.org/repos/asf?p=incubator-cloudstack.gi
>>>>>>>>>>> t; a=c ommit;h=2ceaa3911e792dbeb6c40dfb70961008a01f7e3c
>>>>>>>>>>> 
>>>>>>>>>>> Features:
>>>>>>>>>>> - it's a shell and also a terminal tool, accepts
file redirection
>>>>>>>>>>> and pipes
>>>>>>>>>>> - scalable to find and run old and new APIs
>>>>>>>>>>> - intuitive grammar and verbs
>>>>>>>>>>> - autocompletion (functional hack)
>>>>>>>>>>> - shell execution using ! or shell
>>>>>>>>>>> - cfg support: user defined variables, like prompt,
ruler, host, port etc.
>>>>>>>>>>> - history
>>>>>>>>>>> - colors (disable using set color false)
>>>>>>>>>>> - dynamic API loading and rule generation
>>>>>>>>>>> - leverages Marvin to get latest autogenerated
APIs
>>>>>>>>>>> - emacs like shortcuts on prompt
>>>>>>>>>>> - uses apiKey and secretKey to interact with
mgmt server
>>>>>>>>>>> - logs all client commands
>>>>>>>>>>> - PEP-8 compliant code
>>>>>>>>>>> 
>>>>>>>>>>> FIXMEs:
>>>>>>>>>>> - Reverse search over history
>>>>>>>>>>> - Fix input and output processing
>>>>>>>>>>> 
>>>>>>>>>>> It requires python and clint;
>>>>>>>>>>> pip install clint (or if you have to easy_install
clint) mvn
>>>>>>>>>>> clean install -P developer cd tools/cli/cloudmonkey
python
>>>>>>>>>>> cloudmonkey.py
>>>>>>>>>>> 
>>>>>>>>>>> If you want to have the terminal tool installed;
cd tools/cli
>>>>>>>>>>> python setup.py sdist cd dist pip install
>>>>>>>>>>> cloudmonkey-0.0.4.tar.gz (or easy_install etc.)
>>>>>>>>>>> 
>>>>>>>>>>> You can do stuff like;
>>>>>>>>>>> cloudmonkey < file-with-commands, or cloudmonkey
list Users, or
>>>>>>>>>>> as shell;
>>>>>>>>>>> 
>>>>>>>>>>> (If you see unicode chars cloud and monkey below,
yes they were
>>>>>>>>>>> put intentionally :)
>>>>>>>>>>> 
>>>>>>>>>>> $ cloudmonkey
>>>>>>>>>>> ☁ Apache CloudStack CLI. Type help or ? to
list commands.
>>>>>>>>>>> πŸ™‰ cloudmonkey>  set apiKey <your key
here>
>>>>>>>>>>> πŸ™‰ cloudmonkey>  set secretKey <your
key here>
>>>>>>>>>>> πŸ™‰ cloudmonkey>  <tab><tab>
>>>>>>>>>>> add      api      create   delete   disable 
enable   help     list     quit
>>>>>>> remove
>>>>>>>>>> set      shell    update
>>>>>>>>>>> πŸ™‰ cloudmonkey>  list <tab><tab>
>>>>>>>>>>> Accounts                   Alerts           
         AsyncJobs                  Capabilities
>>>>>>>>>> Capacity                   Clusters             
     Configurations
>>>>>>>>>>> DiskOfferings              DomainChildren   
         Domains                    Events
>>>>>>>>>> EventTypes                 FirewallRules        
     Hosts
>>>>>>>>>>> HypervisorCapabilities     Hypervisors      
         InstanceGroups
>>>>>>>>>> IpForwardingRules          IsoPermissions       
     Isos
>>>>>>>>>> LBStickinessPolicies
>>>>>>>>>>> LoadBalancerRuleInstances  LoadBalancerRules
         NetworkACLs
>>>>>>>>>> NetworkDevice              NetworkOfferings     
     Networks
>>>>>>>>>> NetworkServiceProviders
>>>>>>>>>>> OsCategories               OsTypes          
         PhysicalNetworks           Pods
>>>>>>>>>> PortForwardingRules        PrivateGateways      
     ProjectAccounts
>>>>>>>>>>> ProjectInvitations         Projects         
         PublicIpAddresses
>>>>>>>>>> RemoteAccessVpns           ResourceLimits       
     Routers
>>>>>>>>>> SecurityGroups
>>>>>>>>>>> ServiceOfferings           SnapshotPolicies 
         Snapshots
>>>>>>>>>> SSHKeyPairs                StaticRoutes         
     StorageNetworkIpRange
>>>>>>>>>> StoragePools
>>>>>>>>>>> SupportedNetworkServices   Swifts           
         SystemVms
>>>>>>> Tags
>>>>>>>>>> TemplatePermissions        Templates            
     TrafficTypeImplementors
>>>>>>>>>>> TrafficTypes               Users            
         VirtualMachines
>>>>>>>>>> VirtualRouterElements      VlanIpRanges         
     Volumes
>>>>>>>>>> VPCOfferings
>>>>>>>>>>> VPCs                       VpnConnections   
         VpnCustomerGateways
>>>>>>>>>> VpnGateways                VpnUsers             
     Zones
>>>>>>>>>>> πŸ™‰ cloudmonkey>  list Users
>>>>>>>>>>> …
>>>>>>>>>>> πŸ™‰ cloudmonkey>  !ls
>>>>>>>>>>> # this give you a shell too and one can do things
like
>>>>>>>>>>> πŸ™‰ cloudmonkey>  !for i in Users Account;
do echo `cloudmonkey
>>>>>>>>>>> list $i
>>>>>>>>>>> | grep id`; done;
>>>>>>>>>>> 
>>>>>>>>>>> Example commands to deploy a datacenter; (fill
in dynamic ids
>>>>>>>>>>> etc.) create Zone dns1=8.8.8.8 internaldns1=10.147.28.6
>>>>>>>>>>> name=Zone1 networktype=Basic create PhysicalNetwork
>>>>>>>>>>> name=test-network
>>>>>>>> zoneid=
>>>>>>>>>> add
>>>>>>>>>>> TrafficType traffictype=Guest physicalnetworkid=
add TrafficType
>>>>>>>>>>> traffictype=Management physicalnetworkid= update
PhysicalNetwork
>>>>>>>>>>> state=Enabled id= list NetworkServiceProviders
name=VirtualRouter
>>>>>>>>>>> physicalNetworkId= list VirtualRouterElements
nspid= api
>>>>>>>>>>> configureVirtualRouterElement enabled=true id=
update
>>>>>>>>>>> NetworkServiceProvider state=Enabled id= list
>>>>>>>>>>> NetworkServiceProviders name=SecurityGroupProvider
>>>>>>>>>>> physicalNetworkId= update NetworkServiceProvider
state=Enabled
>>>>>>>>>>> id= create Network zoneid= name=guestNetworkForBasicZone
>>>>>>>>>>> displaytext=guestNetworkForBasicZone
>>>>>>>>>>> networkofferingid= create Pod zoneid= name=Pod1
>>>>>>>> gateway=10.147.28.1
>>>>>>>>>>> netmask=255.255.255.0 startip=10.147.28.220 endip=10.147.28.235
>>>>>>>>>>> create VlanIpRange podid= networkid= gateway=10.147.28.1
>>>>>>>>>>> netmask=255.255.255.0 startip=10.147.28.236 endip=10.147.28.250
>>>>>>>>>>> forVirtualNetwork=false add Cluster zoneid= hypervisor=XenServer
>>>>>>>>>>> clustertype=CloudManaged podid= clustername=Cluster1
add Host
>>>>>>>>>> zoneid=
>>>>>>>>>>> podid= clusterid= hypervisor=XenServer clustertype=CloudManaged
>>>>>>>>>>> username=root password=password url=http://10.147.28.60
create
>>>>>>>>>>> StoragePool zoneid= clusterid= name=NFS1
>>>>>>>>>>> url=nfs://10.147.28.7/export/home/rohit/primary
>>>>>>>>>>> add SecondaryStorage zoneId=
>>>>>>>>>>> url=nfs://10.147.28.7/export/home/rohit/secondary
>>>>>>>>>>> update Zone allocationstate=Enabled id=
>>>>>>>>>>> 
>>>>>>>>>>> After some stabilisation, I can put it on pypi
so any user can
>>>>>>>>>>> just do pip
>>>>>>>>>> install cloudmonkey to get the CLI.
>>>>>>>>>>> 
>>>>>>>>>>> Regards.
>>>>>>>>>>> PS. Marvin the neglected robot and hipster cloudmonkey
should
>>>>>>>>>>> rule the world :D
>>>>>>>>>> 
>>>>>>>>>> Rohit,
>>>>>>>>>> 
>>>>>>>>>> This is really really cool.  It puts the "fun" in
managing
>>>>>>>>>> instances from a command line.  I've been testing
it against a
>>>>>>>>>> production CloudStack environment, and it's working
pretty well.
>>>>>>>>>> 
>>>>>>>>>> If you don't mind, I might hack at the code a bit
to fill in some
>>>>>>>>>> gaps that I'm seeing.  First example is that it assumes
http,
>>>>>>>>>> which doesn't work in a public deployment where the
endpoint is over https.
>>>>>>>>>> 
>>>>>>>>>> -chip
>> 


Mime
View raw message