Esempio n. 1
0
def extend(vm, background, all_, sequential, filter, **kwargs):
    """Extend a host's lease time

    COMMAND: broker extend <vm hostname>|<vm name>|<local id>

    :param vm: Hostname, VM Name, or local id of host

    :param background: run a new broker subprocess to carry out command

    :param all_: Click option all

    :param sequential: Flag for whether to run extends sequentially

    :param filter: a filter string matching broker's specification
    """
    broker_args = helpers.clean_dict(kwargs)
    if background:
        helpers.fork_broker()
    inventory = helpers.load_inventory(filter=filter)
    to_extend = []
    for num, host in enumerate(inventory):
        if str(num
               ) in vm or host["hostname"] in vm or host["name"] in vm or all_:
            to_extend.append(VMBroker().reconstruct_host(host))
    broker_inst = VMBroker(hosts=to_extend, **broker_args)
    broker_inst.extend(sequential=sequential)
Esempio n. 2
0
def extend(vm, background, all_):
    """Extend a host's lease time

    COMMAND: broker extend <vm hostname>|<vm name>|<local id>

    :param vm: Hostname, VM Name, or local id of host

    :param background: run a new broker subprocess to carry out command

    :param all_: Click option all
    """
    if background:
        fork_broker()
    inventory = helpers.load_inventory()
    to_extend = []
    for num, host in enumerate(inventory):
        if str(num) in vm or host["hostname"] in vm or host["name"] in vm or all_:
            to_extend.append(VMBroker().reconstruct_host(host))
    broker_inst = VMBroker(hosts=to_extend)
    broker_inst.extend()