@@ -1277,22 +1277,33 @@ def layers_create(self, args):
12771277 """
12781278 Create a layer of nodes
12791279
1280- Usage: deis layers:create <formation> <id> <flavor> [--proxy --runtime] [options]
1281-
1282- SSH Options:
1280+ Usage: deis layers:create <formation> <id> <flavor> [options]
12831281
1282+ Options:
1283+ --proxy=<yn> layer can be used for proxy [default: y]
1284+ --runtime=<yn> layer can be used for runtime [default: y]
12841285 --ssh_username=USERNAME username for ssh connections [default: ubuntu]
12851286 --ssh_private_key=PRIVATE_KEY private key for ssh comm (default: auto-gen)
12861287 --ssh_public_key=PUBLIC_KEY public key for ssh comm (default: auto-gen)
1288+ --ssh_port=<port> port number for ssh comm (default: 22)
12871289
12881290 """
12891291 formation = args .get ('<formation>' )
12901292 body = {'id' : args ['<id>' ], 'flavor' : args ['<flavor>' ]}
1291- for opt in ('--formation' , '--proxy ' , '--runtime ' ,
1292- '--ssh_username' , '--ssh_private_key' , '-- ssh_public_key' ):
1293+ for opt in ('--formation' , '--ssh_username ' , '--ssh_private_key ' ,
1294+ '--ssh_public_key' ):
12931295 o = args .get (opt )
12941296 if o :
12951297 body .update ({opt .strip ('-' ): o })
1298+ o = args .get ('--ssh_port' )
1299+ if o :
1300+ body .update ({'ssh_port' : int (o )})
1301+ for opt in ('--proxy' , '--runtime' ):
1302+ o = args .get (opt )
1303+ if o and o .lower () in ['n' , 'no' , 'f' , 'false' , '0' , 'off' ]:
1304+ body .update ({opt .strip ('-' ): False })
1305+ else :
1306+ body .update ({opt .strip ('-' ): True })
12961307 sys .stdout .write ("Creating {} layer... " .format (args ['<id>' ]))
12971308 sys .stdout .flush ()
12981309 try :
@@ -1365,6 +1376,51 @@ def layers_list(self, args):
13651376 else :
13661377 raise ResponseError (response )
13671378
1379+ def layers_update (self , args ):
1380+ """
1381+ Create a layer of nodes
1382+
1383+ Usage: deis layers:update <formation> <id> [options]
1384+
1385+ Options:
1386+
1387+ --proxy=<yn> layer can be used for proxy [default: y]
1388+ --runtime=<yn> layer can be used for runtime [default: y]
1389+ --ssh_username=USERNAME username for ssh connections [default: ubuntu]
1390+ --ssh_private_key=PRIVATE_KEY private key for ssh comm (default: auto-gen)
1391+ --ssh_public_key=PUBLIC_KEY public key for ssh comm (default: auto-gen)
1392+ --ssh_port=<port> port number for ssh comm (default: 22)
1393+
1394+ """
1395+ formation = args .get ('<formation>' )
1396+ layer = args ['<id>' ] # noqa
1397+ body = {'id' : args ['<id>' ]}
1398+ for opt in ('--ssh_username' , '--ssh_private_key' , '--ssh_public_key' ,
1399+ '--ssh_port' ):
1400+ o = args .get (opt )
1401+ if o :
1402+ body .update ({opt .strip ('-' ): o })
1403+ o = args .get ('--ssh_port' )
1404+ if o :
1405+ body .update ({'ssh_port' : int (o )})
1406+ for opt in ('--proxy' , '--runtime' ):
1407+ o = args .get (opt )
1408+ if o is not None :
1409+ if o .lower () in ['n' , 'no' , 'f' , 'false' , '0' , 'off' ]:
1410+ body .update ({opt .strip ('-' ): False })
1411+ else :
1412+ body .update ({opt .strip ('-' ): True })
1413+ sys .stdout .write ("Updating {} layer... " .format (args ['<id>' ]))
1414+ sys .stdout .flush ()
1415+ response = self ._dispatch (
1416+ 'patch' , "/api/formations/{formation}/layers/{layer}" .format (** locals ()),
1417+ json .dumps (body ))
1418+ if response .status_code == requests .codes .ok : # @UndefinedVariable
1419+ print ('done.' )
1420+ print (json .dumps (response .json (), indent = 2 ))
1421+ else :
1422+ raise ResponseError (response )
1423+
13681424 def nodes (self , args ):
13691425 """
13701426 Valid commands for nodes:
0 commit comments