Example #1
0
def cli():
    # Set up command line arguments
    parser = argparse.ArgumentParser(
        description='Perform common vSphere API tasks'
    )
    subparsers = parser.add_subparsers(help='Command', dest='mode')

    # set up each command section
    add_params(subparsers)

    # parse arguments
    args = parser.parse_args()

    # initialize ezmomi instance
    ez = EZMomi(**vars(args))

    kwargs = vars(args)

    # choose your adventure
    if kwargs['mode'] == 'list':
        ez.list_objects()
    elif kwargs['mode'] == 'clone':
        ez.clone()
    elif kwargs['mode'] == 'destroy':
        ez.destroy()
Example #2
0
def cli():
    # Set up command line arguments
    parser = argparse.ArgumentParser(
        description='Perform common vSphere API tasks'
    )
    subparsers = parser.add_subparsers(help='Command', dest='mode')

    # set up each command section
    add_params(subparsers)

    # parse arguments
    args = parser.parse_args()

    # initialize ezmomi instance
    ez = EZMomi(**vars(args))

    kwargs = vars(args)

    # choose your adventure
    if kwargs['mode'] == 'list':
        ez.list_objects()
    elif kwargs['mode'] == 'clone':
        ez.clone()
    elif kwargs['mode'] == 'destroy':
        ez.destroy()
    elif kwargs['mode'] == 'status':
        ez.status()
    elif kwargs['mode'] == 'shutdown':
        ez.shutdown()
    elif kwargs['mode'] == 'powerOff':
        ez.powerOff()
    elif kwargs['mode'] == 'powerOn':
        ez.powerOn()
Example #3
0
def cli():
    args = arg_setup()

    # initialize ezmomi instance
    ez = EZMomi(**vars(args))

    kwargs = vars(args)

    # choose your adventure
    if kwargs['mode'] == 'list':
        ez.list_objects()
    elif kwargs['mode'] == 'clone':
        ez.clone()
    elif kwargs['mode'] == 'destroy':
        ez.destroy()
    elif kwargs['mode'] == 'listSnapshots':
        ez.listSnapshots()
    elif kwargs['mode'] == 'createSnapshot':
        ez.createSnapshot()
    elif kwargs['mode'] == 'removeSnapshot':
        ez.removeSnapshot()
    elif kwargs['mode'] == 'revertSnapshot':
        ez.revertSnapshot()
    elif kwargs['mode'] == 'status':
        ez.status()
    elif kwargs['mode'] == 'shutdown':
        ez.shutdown()
    elif kwargs['mode'] == 'powerOff':
        ez.powerOff()
    elif kwargs['mode'] == 'powerOn':
        ez.powerOn()
    elif kwargs['mode'] == 'syncTimeWithHost':
        ez.syncTimeWithHost()
Example #4
0
File: cli.py Project: czee/ezmomi
def cli():
    # Set up command line arguments
    parser = argparse.ArgumentParser(
        description='Perform common vSphere API tasks'
    )
    subparsers = parser.add_subparsers(help='Command', dest='mode')

    # set up each command section
    add_params(subparsers)

    # parse arguments
    args = parser.parse_args()

    # initialize ezmomi instance
    ez = EZMomi(**vars(args))

    kwargs = vars(args)

    # choose your adventure
    if kwargs['mode'] == 'list':
        ez.list_objects()
    elif kwargs['mode'] == 'clone':
        ez.clone()
    elif kwargs['mode'] == 'destroy':
        ez.destroy()
    elif kwargs['mode'] == 'listSnapshots':
        ez.listSnapshots()
    elif kwargs['mode'] == 'createSnapshot':
        ez.createSnapshot()
    elif kwargs['mode'] == 'removeSnapshot':
        ez.removeSnapshot()
    elif kwargs['mode'] == 'revertSnapshot':
        ez.revertSnapshot()
    elif kwargs['mode'] == 'status':
        ez.status()
    elif kwargs['mode'] == 'shutdown':
        ez.shutdown()
    elif kwargs['mode'] == 'powerOff':
        ez.powerOff()
    elif kwargs['mode'] == 'powerOn':
        ez.powerOn()
Example #5
0
def cli():
    args = arg_setup()

    # initialize ezmomi instance
    ez = EZMomi(**vars(args))

    kwargs = vars(args)

    # choose your adventure
    if kwargs['mode'] == 'list':
        ez.list_objects()
    elif kwargs['mode'] == 'clone':
        ez.clone()
    elif kwargs['mode'] == 'destroy':
        ez.destroy()
    elif kwargs['mode'] == 'listSnapshots':
        ez.listSnapshots()
    elif kwargs['mode'] == 'createSnapshot':
        ez.createSnapshot()
    elif kwargs['mode'] == 'removeSnapshot':
        ez.removeSnapshot()
    elif kwargs['mode'] == 'revertSnapshot':
        ez.revertSnapshot()
    elif kwargs['mode'] == 'status':
        ez.status()
    elif kwargs['mode'] == 'shutdown':
        ez.shutdown()
    elif kwargs['mode'] == 'powerOff':
        ez.powerOff()
    elif kwargs['mode'] == 'powerOn':
        ez.powerOn()
    elif kwargs['mode'] == 'reconfig':
        ez.reconfig()
    elif kwargs['mode'] == 'createDatacenter':
        ez.createDatacenter()
    elif kwargs['mode'] == 'createCluster':
        ez.createCluster()
    elif kwargs['mode'] == 'addHost':
        ez.addHost()
    elif kwargs['mode'] == 'queryPerf':
        ez.queryPerf()
    elif kwargs['mode'] == 'queryHostPerf':
        ez.queryHostPerf()