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