Example #1
0
def show_image(kwargs, call=None):
    """
    Show the details of an image
    """
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_image action must be called with -f or --function.')

    name = kwargs['image']
    log.info("Showing image %s", name)
    machine = vb_get_machine(name)

    ret = {machine["name"]: treat_machine_dict(machine)}
    del machine["name"]
    return ret
Example #2
0
def stop(name, call=None):
    """
    Stop a running machine.
    @param name: Machine to stop
    @type name: str
    @param call: Must be "action"
    @type call: str
    """
    if call != 'action':
        raise SaltCloudSystemExit(
            'The instance action must be called with -a or --action.')

    log.info("Stopping machine: %s", name)
    vb_stop_vm(name)
    machine = vb_get_machine(name)
    del machine["name"]
    return treat_machine_dict(machine)
Example #3
0
def start(name, call=None):
    """
    Start a machine.
    @param name: Machine to start
    @type name: str
    @param call: Must be "action"
    @type call: str
    """
    if call != "action":
        raise SaltCloudSystemExit(
            "The instance action must be called with -a or --action.")

    log.info("Starting machine: %s", name)
    vb_start_vm(name)
    machine = vb_get_machine(name)
    del machine["name"]
    return treat_machine_dict(machine)
Example #4
0
def show_image(kwargs, call=None):
    """
    Show the details of an image
    """
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_image action must be called with -f or --function.'
        )

    name = kwargs['image']
    log.info("Showing image %s", name)
    machine = vb_get_machine(name)

    ret = {
        machine["name"]: treat_machine_dict(machine)
    }
    del machine["name"]
    return ret
Example #5
0
def stop(name, call=None):
    """
    Stop a running machine.
    @param name: Machine to stop
    @type name: str
    @param call: Must be "action"
    @type call: str
    """
    if call != 'action':
        raise SaltCloudSystemExit(
            'The instance action must be called with -a or --action.'
        )

    log.info("Stopping machine: %s", name)
    vb_stop_vm(name)
    machine = vb_get_machine(name)
    del machine["name"]
    return treat_machine_dict(machine)