def checkin(vm, all_): """Checkin or "remove" a VM or series of VM broker instances COMMAND: broker checkin <vm hostname>|<local id>|all :param vm: Hostname or local id of host """ inventory = helpers.load_inventory() to_remove = [] for num, host_export in enumerate(inventory): if str(num) in vm or host_export["hostname"] in vm or all_: to_remove.append(VMBroker.reconstruct_host(host_export)) broker_inst = VMBroker(hosts=to_remove) broker_inst.checkin()
def checkin(vm, background, all_): """Checkin or "remove" a VM or series of VM broker instances COMMAND: broker checkin <vm hostname>|<local id>|all :param vm: Hostname or local id of host :param background: run a new broker subprocess to carry out command """ if background: fork_broker() inventory = helpers.load_inventory() to_remove = [] for num, host_export in enumerate(inventory): if str(num) in vm or host_export["hostname"] in vm or all_: to_remove.append(VMBroker.reconstruct_host(host_export)) broker_inst = VMBroker(hosts=to_remove) broker_inst.checkin()