forked from uncloud/uncloud
++hack / list products
Signed-off-by: Nico Schottelius <nico@nico-notebook.schottelius.org>
This commit is contained in:
parent
3b508fc87d
commit
5da6dbb32e
3 changed files with 35 additions and 5 deletions
|
|
@ -9,6 +9,7 @@ from uncloud.hack.mac import MAC
|
|||
from uncloud.hack.net import VXLANBridge, DNSRA
|
||||
|
||||
from uncloud import UncloudException
|
||||
from uncloud.hack.product import ProductOrder
|
||||
|
||||
arg_parser = argparse.ArgumentParser('hack', add_help=False)
|
||||
#description="Commands that are unfinished - use at own risk")
|
||||
|
|
@ -41,6 +42,7 @@ arg_parser.add_argument('--hackprefix', help="hackprefix, if you need it you kno
|
|||
|
||||
# order based commands => later to be shifted below "order"
|
||||
arg_parser.add_argument('--order', action='store_true')
|
||||
arg_parser.add_argument('--list-orders', help="List all orders", action='store_true')
|
||||
arg_parser.add_argument('--product', choices=["dualstack-vm"])
|
||||
arg_parser.add_argument('--os-image-name', help="Name of OS image (successor to --image)")
|
||||
arg_parser.add_argument('--os-image-size', help="Size of OS image in GB", type=int, default=10)
|
||||
|
|
@ -48,6 +50,9 @@ arg_parser.add_argument('--os-image-size', help="Size of OS image in GB", type=i
|
|||
arg_parser.add_argument('--username')
|
||||
arg_parser.add_argument('--password')
|
||||
|
||||
arg_parser.add_argument('--api', help="Run the API")
|
||||
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
|
@ -79,6 +84,7 @@ def order(config):
|
|||
|
||||
# create DB entry for VM
|
||||
vm = VM(config)
|
||||
vm.product.db_entry["owner"] = config.arguments['username']
|
||||
vm.product.place_order()
|
||||
|
||||
|
||||
|
|
@ -86,9 +92,17 @@ def order(config):
|
|||
def main(arguments):
|
||||
config = Config(arguments)
|
||||
|
||||
if arguments['api']:
|
||||
api = API()
|
||||
api.run()
|
||||
|
||||
if arguments['order']:
|
||||
order(config)
|
||||
|
||||
if arguments['list_orders']:
|
||||
p = ProductOrder(config)
|
||||
p.list_orders()
|
||||
|
||||
if arguments['create_vm']:
|
||||
vm = VM(config)
|
||||
vm.create()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue