11#!/usr/bin/env python
22"""
3- This Deis command-line client issues API calls to a Deis controller.
3+ The Deis command-line client issues API calls to a Deis controller.
44
5- Usage: deis <command> [--app=<app> | --formation=<formation>] [ <args>...]
5+ Usage: deis <command> [<args>...]
66
77Auth commands::
88
1313Subcommands, use ``deis help [subcommand]`` to learn more::
1414
1515 formations manage formations used to host applications
16- layers manage layers of nodes used to configure nodes
16+ layers manage layers used for node configuration
1717 nodes manage nodes used to host containers and proxies
1818
19- apps manage applications used to service end-users
20- containers manage containers used to service applications
19+ apps manage applications used to provide services
20+ containers manage containers used to handle requests and jobs
2121 config manage environment variables that define app config
2222 builds manage builds created using `git push`
2323 releases manage releases of an application
2929Developer shortcut commands::
3030
3131 create create a new application
32- scale scale process types (web=2, worker=1)
32+ scale scale containers by type (web=2, worker=1)
3333 open open a URL to the app in a browser
3434 logs view aggregated log info for the app
3535 run run a command in an ephemeral app container
@@ -325,8 +325,12 @@ def apps(self, args):
325325 Valid commands for apps:
326326
327327 apps:create create a new application
328- apps:destroy destroy an application
329328 apps:list list accessible applications
329+ apps:info view info about an application
330+ apps:open open the application in a browser
331+ apps:logs view aggregated application logs
332+ apps:run run a command in an ephemeral app container
333+ apps:destroy destroy an application
330334
331335 Use `deis help [command]` to learn more
332336 """
@@ -369,7 +373,7 @@ def apps_create(self, args):
369373 sys .exit (1 )
370374 try :
371375 self ._session .get_app ()
372- print ('Deis remote already exists in this directory, skipping.. ' )
376+ print ('Deis remote already exists' )
373377 sys .exit (1 )
374378 except EnvironmentError :
375379 pass
@@ -657,19 +661,19 @@ def config(self, args):
657661 """
658662 Valid commands for config:
659663
660- config:list list environment variables for a formation
661- config:set set environment variables for a formation
662- config:unset unset environment variables for a formation
664+ config:list list environment variables for an app
665+ config:set set environment variables for an app
666+ config:unset unset environment variables for an app
663667
664668 Use `deis help [command]` to learn more
665669 """
666670 return self .config_list (args )
667671
668672 def config_list (self , args ):
669673 """
670- List environment variables for a formation
674+ List environment variables for an application
671675
672- Usage: deis config:list
676+ Usage: deis config:list [--app=<app>]
673677 """
674678 app = args .get ('--app' )
675679 if not app :
@@ -690,7 +694,7 @@ def config_list(self, args):
690694
691695 def config_set (self , args ):
692696 """
693- Set environment variables for a formation
697+ Set environment variables for an application
694698
695699 Usage: deis config:set <var>=<value>... [--app=<app>]
696700 """
@@ -716,7 +720,7 @@ def config_set(self, args):
716720
717721 def config_unset (self , args ):
718722 """
719- Unset an environment variable for a formation
723+ Unset an environment variable for an application
720724
721725 Usage: deis config:unset <key>... [--app=<app>]
722726 """
@@ -747,16 +751,16 @@ def containers(self, args):
747751 """
748752 Valid commands for containers:
749753
750- containers:list list containers for a formation
751- containers:scale scale a formation's containers (i.e web=4 worker=2)
754+ containers:list list application containers
755+ containers:scale scale app containers (e.g. web=4 worker=2)
752756
753757 Use `deis help [command]` to learn more
754758 """
755759 return self .containers_list (args )
756760
757761 def containers_list (self , args ):
758762 """
759- List containers for a formation
763+ List containers servicing an application
760764
761765 Usage: deis containers:list [--app=<app>]
762766 """
@@ -833,20 +837,10 @@ def flavors_create(self, args):
833837 """
834838 Create a new node flavor
835839
836- Usage: deis flavors:create --id=<id> --provider=<provider> --params=<params> [options]
837-
838- Options:
839-
840- --params=PARAMS provider-specific parameters (size, region, zone, etc.)
841- --init=INIT override Ubuntu cloud-init with custom YAML
840+ Usage: deis flavors:create <id> --provider=<provider> --params=<params>
842841 """
843- body = {'id' : args .get ('--id' ), 'provider' : args .get ('--provider' )}
844- fields = ('params' , 'init' , 'ssh_username' , 'ssh_private_key' ,
845- 'ssh_public_key' )
846- for fld in fields :
847- opt = args .get ('--' + fld )
848- if opt :
849- body .update ({fld : opt })
842+ body = {'id' : args .get ('<id>' ), 'provider' : args .get ('--provider' ),
843+ 'params' : args .get ('--params' , json .dumps ({}))}
850844 response = self ._dispatch ('post' , '/api/flavors' , json .dumps (body ))
851845 if response .status_code == requests .codes .created : # @UndefinedVariable
852846 print ("{0[id]}" .format (response .json ()))
@@ -901,11 +895,12 @@ def formations(self, args):
901895 """
902896 Valid commands for formations:
903897
904- formations:create create a new container formation from scratch
905- formations:update update formation fields including domain
898+ formations:create create a new container formation
899+ formations:list list accessible formations
900+ formations:update update formation fields
906901 formations:info print a represenation of the formation
907902 formations:converge force-converge all nodes in the formation
908- formations:calculate recalculate and update the formation databag
903+ formations:calculate calculate and display the formation databag
909904 formations:destroy destroy a container formation
910905
911906 Use `deis help [command]` to learn more
@@ -914,10 +909,10 @@ def formations(self, args):
914909
915910 def formations_calculate (self , args , quiet = False ):
916911 """
917- Recalculate the formation's databag
912+ Calculate and display the formation's databag
918913
919- This command will recalculate the databag, update the Chef server
920- and return the databag JSON.
914+ This command will calculate the databag and return
915+ its JSON representation .
921916
922917 Usage: deis formations:calculate <formation>
923918 """
@@ -936,9 +931,8 @@ def formations_converge(self, args):
936931 """
937932 Force converge a formation
938933
939- Converging a formation will force a Chef converge on
940- all nodes in the formation, ensuring the formation is
941- completely up-to-date.
934+ Converging a formation will force a converge on all nodes in the
935+ formation, ensuring it is completely up-to-date.
942936
943937 Usage: deis formations:converge <id>
944938 """
@@ -963,10 +957,9 @@ def formations_converge(self, args):
963957
964958 def formations_create (self , args ):
965959 """
966- Create a new formation
960+ Create a new container formation
967961
968- A globally unique formation ID must be provided along
969- with a domain used as the root for applications.
962+ A globally unique formation ID must be provided.
970963
971964 If a flavor is provided, a default layer will be initialized
972965 with dual proxy and runtime capability, faciliating a simple
@@ -975,6 +968,13 @@ def formations_create(self, args):
975968 The name of the default layer is "runtime" unless overriden
976969 with the --layer=<layer> option.
977970
971+ The domain field is required for a single formation to host
972+ multiple applications. Note this requires wildcard DNS
973+ configuration on the provided domain.
974+
975+ For example: --domain=deisapp.com requires that
976+ *.deisapp.com resolve to the formation's proxy nodes.
977+
978978 Usage: deis formations:create <id> [--flavor=<flavor>] [--domain=<domain> --layer=<layer>]
979979 """
980980 body = {'id' : args ['<id>' ], 'domain' : args .get ('--domain' )}
@@ -1028,7 +1028,6 @@ def formations_info(self, args):
10281028 print ()
10291029 self .nodes_list (args )
10301030 print ()
1031- self .containers_list (args )
10321031 else :
10331032 raise ResponseError (response )
10341033
@@ -1194,8 +1193,8 @@ def layers(self, args):
11941193 Valid commands for node layers:
11951194
11961195 layers:create create a layer of nodes for a formation
1197- layers:scale scale nodes in a layer (e.g. proxy=1 runtime=2)
11981196 layers:list list layers in a formation
1197+ layers:info print info about a particular layer
11991198 layers:destroy destroy a layer of nodes in a formation
12001199
12011200 Use `deis help [command]` to learn more
@@ -1210,12 +1209,6 @@ def layers_create(self, args):
12101209
12111210 Usage: deis layers:create <formation> <id> <flavor> [--proxy --runtime] [options]
12121211
1213- Chef Options:
1214-
1215- --run_list=RUN_LIST run-list to use when bootstrapping nodes
1216- --environment=ENVIRONMENT chef environment to place nodes [default: _default]
1217- --attributes=INITIAL_ATTRS initial attributes for nodes
1218-
12191212 SSH Options:
12201213
12211214 --ssh_username=USERNAME username for ssh connections [default: ubuntu]
@@ -1226,19 +1219,10 @@ def layers_create(self, args):
12261219 formation = args .get ('<formation>' )
12271220 body = {'id' : args ['<id>' ], 'flavor' : args ['<flavor>' ]}
12281221 for opt in ('--formation' , '--proxy' , '--runtime' ,
1229- '--environment' , '--initial_attributes' , '--run_list' ,
12301222 '--ssh_username' , '--ssh_private_key' , '--ssh_public_key' ):
12311223 o = args .get (opt )
12321224 if o :
12331225 body .update ({opt .strip ('-' ): o })
1234- # provide default run_list for runtime and proxy
1235- if not 'run_list' in body :
1236- run_list = ['recipe[deis]' ]
1237- if body ['runtime' ] is True :
1238- run_list .append ('recipe[deis::runtime]' )
1239- if body ['proxy' ] is True :
1240- run_list .append ('recipe[deis::proxy]' )
1241- body ['run_list' ] = ',' .join (run_list )
12421226 sys .stdout .write ("Creating {} layer... " .format (args ['<id>' ]))
12431227 sys .stdout .flush ()
12441228 try :
@@ -1281,7 +1265,7 @@ def layers_destroy(self, args):
12811265
12821266 def layers_info (self , args ):
12831267 """
1284- Print info about a particular layer
1268+ Print info about a layer of nodes
12851269
12861270 Usage: deis layers:info <formation> <id>
12871271 """
@@ -1295,7 +1279,7 @@ def layers_info(self, args):
12951279
12961280 def layers_list (self , args ):
12971281 """
1298- List layers for a formation
1282+ List a formation's layers
12991283
13001284 Usage: deis layers:list <formation>
13011285 """
@@ -1305,7 +1289,7 @@ def layers_list(self, args):
13051289 if response .status_code == requests .codes .ok : # @UndefinedVariable
13061290 print ("=== {} Layers" .format (formation ))
13071291 data = response .json ()
1308- format_str = "{id}"
1292+ format_str = "{id} => flavor: {flavor}, proxy: {proxy}, runtime: {runtime} "
13091293 for item in data ['results' ]:
13101294 print (format_str .format (** item ))
13111295 else :
@@ -1315,8 +1299,11 @@ def nodes(self, args):
13151299 """
13161300 Valid commands for nodes:
13171301
1318- nodes:list list nodes for a formation
1302+ nodes:list list nodes in a formation
13191303 nodes:info print info for a given node
1304+ nodes:scale scale nodes by layer (e.g. runtime=4)
1305+ nodes:converge force-converge a node and return the output
1306+ nodes:ssh ssh directly into a node
13201307 nodes:destroy destroy a node by ID
13211308
13221309 Use `deis help [command]` to learn more
@@ -1340,7 +1327,7 @@ def nodes_info(self, args):
13401327
13411328 def nodes_list (self , args ):
13421329 """
1343- List nodes for this formation
1330+ List nodes in a formation
13441331
13451332 Usage: deis nodes:list <formation>
13461333 """
@@ -1384,7 +1371,10 @@ def nodes_scale(self, args):
13841371 Scale nodes in a formation
13851372
13861373 Scaling nodes will launch or terminate nodes to meet the
1387- requested structure.
1374+ requested structure. For example, to scale up to 4 nodes
1375+ in the "dev" formation's runtime layer:
1376+
1377+ ``deis nodes:scale dev runtime=4``
13881378
13891379 Usage: deis nodes:scale <formation> <type=num>...
13901380 """
@@ -1414,7 +1404,7 @@ def nodes_converge(self, args):
14141404 """
14151405 Force converge a node
14161406
1417- Converging a node will force a client -client run and
1407+ Converging a node will force a chef -client run and
14181408 return its output
14191409
14201410 Usage: deis nodes:converge <id>
@@ -1440,7 +1430,7 @@ def nodes_converge(self, args):
14401430
14411431 def nodes_ssh (self , args ):
14421432 """
1443- SSH into a node
1433+ SSH into a node and optionally run a command
14441434
14451435 Usage: deis nodes:ssh <node> [<command>...]
14461436 """
@@ -1589,7 +1579,7 @@ def releases(self, args):
15891579 """
15901580 Valid commands for releases:
15911581
1592- releases:list list a formation 's release history
1582+ releases:list list an application 's release history
15931583 releases:info print information about a specific release
15941584 releases:rollback coming soon!
15951585
@@ -1616,7 +1606,7 @@ def releases_info(self, args):
16161606
16171607 def releases_list (self , args ):
16181608 """
1619- List release history for a formation
1609+ List release history for an application
16201610
16211611 Usage: deis releases:list [--app=<app>]
16221612 """
0 commit comments