Ejemplo n.º 1
0
def _get_vm_from_node(node: Node) -> str:
    """
    Return the container which represents the given ``node``.
    """
    lines = vertigo_py.ls(option='vms').decode().strip().split('\n')
    vm_names = set(line.split(' ')[0][1:-1] for line in lines)
    [node_vm] = [
        vm_name for vm_name in vm_names
        if _ip_from_vm_name(vm_name=vm_name) == node.private_ip_address
    ]
    return node_vm
Ejemplo n.º 2
0
def _get_vm_from_node(node: Node) -> str:  # pragma: no cover
    """
    Return the container which represents the given ``node``.
    """
    ls_result = bytes(vertigo_py.ls(option='vms'))  # type: ignore
    lines = ls_result.decode().strip().split('\n')
    vm_names = set(line.split(' ')[0][1:-1] for line in lines)
    [node_vm] = [
        vm_name for vm_name in vm_names
        if _ip_from_vm_name(vm_name=vm_name) == node.private_ip_address
    ]
    return str(node_vm)