예제 #1
0
def get_zerotier_address(marketplace):
    """ Gets the zerotier IP address from the given marketplace name

    Args:
        marketplace (str): name of the marketplace network to lookup ip

    Returns:
        str: a string representation of the zerotier IP address

    Raises:
        UnloggedException: if the zt network doesn't exist
    """
    logger.info(uxstring.UxString.superuser_password)
    address = zerotier.get_address(marketplace)
    if not address:
        raise UnloggedException(uxstring.UxString.no_zt_network.format(marketplace))

    return address
예제 #2
0
def get_zerotier_address(marketplace):
    """ Gets the zerotier IP address from the given marketplace name

    Args:
        marketplace (str): name of the marketplace network to lookup ip

    Returns:
        str: a string representation of the zerotier IP address

    Raises:
        UnloggedException: if the zt network doesn't exist
    """
    logger.info(uxstring.UxString.superuser_password)
    address = zerotier.get_address(marketplace)
    if not address:
        raise UnloggedException(
            uxstring.UxString.no_zt_network.format(marketplace))

    return address
예제 #3
0
def get_zerotier_address(marketplace):
    """ Gets the zerotier IP address from the given marketplace name

    Args:
        marketplace (str): name of the marketplace network to lookup ip

    Returns:
        str: a string representation of the zerotier IP address

    Raises:
        UnloggedException: if the zt network doesn't exist
    """
    logger.info("You might need to enter your superuser password.")
    address = zerotier.get_address(marketplace)
    if not address:
        join_cmd = click.style("21 join", bold=True, reset=False)
        no_zt_network = click.style(
            "You are not part of the {}. Use {} to join the market.", fg="red")
        raise UnloggedException(no_zt_network.format(marketplace, join_cmd))

    return address
예제 #4
0
def get_zerotier_address(marketplace):
    """ Gets the zerotier IP address from the given marketplace name

    Args:
        marketplace (str): name of the marketplace network to lookup ip

    Returns:
        str: a string representation of the zerotier IP address

    Raises:
        UnloggedException: if the zt network doesn't exist
    """
    logger.info("You might need to enter your superuser password.")
    address = zerotier.get_address(marketplace)
    if not address:
        join_cmd = click.style("21 join", bold=True, reset=False)
        no_zt_network = click.style(
            "You are not part of the {}. Use {} to join the market.",
            fg="red")
        raise UnloggedException(no_zt_network.format(marketplace, join_cmd))

    return address
예제 #5
0
def test_get_address(network_name, get_all_ret_val, outcome):
    """ Tests zerotier.get_address function """
    with mock.patch("two1.commands.util.zerotier.get_all_addresses",
                    return_value=get_all_ret_val):
        assert zerotier.get_address(network_name) == outcome
예제 #6
0
def test_get_address(network_name, get_all_ret_val, outcome):
    """ Tests zerotier.get_address function """
    with mock.patch("two1.commands.util.zerotier.get_all_addresses",
                    return_value=get_all_ret_val):
        assert zerotier.get_address(network_name) == outcome