コード例 #1
0
ファイル: machines.py プロジェクト: vkefallinos/mist.client
def machine_action(args):

    client = authenticate()

    if args.action == "list-machines":
        if args.backend or args.backend_id or args.backend_name:
            backend = return_backend(client, args)
        else:
            backend = None

        pretty = args.pretty
        metadata = args.metadata

        list_machines(client, backend, metadata, pretty)

    elif args.action == "describe-machine":
        machine = choose_machine(client, args)

        display_machine(machine)

    elif args.action == "create-machine":
        backend = return_backend(client, args)
        create_machine(client, backend, args)
        print "Created machine %s" % args.machine_name

    elif args.action in ["start", "stop", "reboot", "destroy", "probe"]:
        machine = choose_machine(client, args)

        machine_take_action(machine, args.action)
    elif args.action == "enable-monitoring":
        machine = choose_machine(client, args)
        machine.enable_monitoring()
        print "Enabled monitoring to machine %s" % machine.name

    elif args.action == "disable-monitoring":
        machine = choose_machine(client, args)
        machine.disable_monitoring()
        print "Disabled monitoring to machine %s" % machine.name

    elif args.action == "tag":
        machine = choose_machine(client, args)

        if machine.info["can_tag"]:
            machine.tag(tag=args.new_tag)
            print "Add tag %s to machine %s" % (args.new_tag, machine.name)
        else:
            print "Cannot tag machine on provider %s" % machine.backend.title
            sys.exit(0)
コード例 #2
0
ファイル: machines.py プロジェクト: vkefallinos/mist.client
def machine_action(args):

    client = authenticate()

    if args.action == 'list-machines':
        if args.backend or args.backend_id or args.backend_name:
            backend = return_backend(client, args)
        else:
            backend = None

        pretty = args.pretty
        metadata = args.metadata

        list_machines(client, backend, metadata, pretty)

    elif args.action == 'describe-machine':
        machine = choose_machine(client, args)

        display_machine(machine)

    elif args.action == 'create-machine':
        backend = return_backend(client, args)
        create_machine(client, backend, args)
        print "Created machine %s" % args.machine_name

    elif args.action in ['start', 'stop', 'reboot', 'destroy', 'probe']:
        machine = choose_machine(client, args)

        machine_take_action(machine, args.action)
    elif args.action == 'enable-monitoring':
        machine = choose_machine(client, args)
        machine.enable_monitoring()
        print "Enabled monitoring to machine %s" % machine.name

    elif args.action == 'disable-monitoring':
        machine = choose_machine(client, args)
        machine.disable_monitoring()
        print "Disabled monitoring to machine %s" % machine.name

    elif args.action == 'tag':
        machine = choose_machine(client, args)

        if machine.info['can_tag']:
            machine.tag(tag=args.new_tag)
            print "Add tag %s to machine %s" % (args.new_tag, machine.name)
        else:
            print "Cannot tag machine on provider %s" % machine.backend.title
            sys.exit(0)
コード例 #3
0
ファイル: networks.py プロジェクト: chvalean/mist.client
def network_action(args):
    if args.action == 'list-networks':
        client = authenticate()
        backend = return_backend(client, args)
        pretty = args.pretty

        list_networks(backend, pretty)
コード例 #4
0
ファイル: networks.py プロジェクト: vkefallinos/mist.client
def network_action(args):
    if args.action == 'list-networks':
        client = authenticate()
        backend = return_backend(client, args)
        pretty = args.pretty

        list_networks(backend, pretty)
コード例 #5
0
ファイル: machines.py プロジェクト: chvalean/mist.client
def machine_action(args):

    client = authenticate()

    if args.action == 'list-machines':
        if args.backend or args.backend_id or args.backend_name:
            backend = return_backend(client, args)
        else:
            backend = None

        pretty = args.pretty

        list_machines(client, backend, pretty)

    elif args.action == 'describe-machine':
        machine = choose_machine(client, args)

        display_machine(machine)

    elif args.action == 'create-machine':
        backend = return_backend(client, args)
        create_machine(client, backend, args)
        print "Created machine %s" % args.machine_name

    elif args.action in ['start', 'stop', 'reboot', 'destroy', 'probe']:
        machine = choose_machine(client, args)

        machine_take_action(machine, args.action)
    elif args.action == 'enable-monitoring':
        machine = choose_machine(client, args)
        machine.enable_monitoring()
        print "Enabled monitoring to machine %s" % machine.name

    elif args.action == 'disable-monitoring':
        machine = choose_machine(client, args)
        machine.disable_monitoring()
        print "Disabled monitoring to machine %s" % machine.name

    elif args.action == 'tag':
        machine = choose_machine(client, args)

        if machine.info['can_tag']:
            machine.tag(tag=args.new_tag)
            print "Add tag %s to machine %s" % (args.new_tag, machine.name)
        else:
            print "Cannot tag machine on provider %s" % machine.backend.title
            sys.exit(0)
コード例 #6
0
ファイル: sizes.py プロジェクト: vkefallinos/mist.client
def size_action(args):

    if args.action == "list-sizes":
        client = authenticate()
        backend = return_backend(client, args)

        pretty = args.pretty
        list_sizes(backend, pretty)
コード例 #7
0
def location_action(args):

    if args.action == 'list-locations':
        client = authenticate()
        backend = return_backend(client, args)
        pretty = args.pretty

        list_locations(backend, pretty)
コード例 #8
0
ファイル: sizes.py プロジェクト: vkefallinos/mist.client
def size_action(args):

    if args.action == 'list-sizes':
        client = authenticate()
        backend = return_backend(client, args)

        pretty = args.pretty
        list_sizes(backend, pretty)
コード例 #9
0
def image_action(args):

    if args.action == 'list-images':
        client = authenticate()
        backend = return_backend(client, args)
        search_term = args.search
        pretty = args.pretty

        list_images(backend, search_term, pretty)