def setup_ips(ips, label):
    existing = set(loopback_ips(label))
    toadd = set(ips) - existing
    for ip in toadd:
        logger.debug("Setup loopback IP address %s", ip)
        with open(os.devnull, "w") as fnull:
            cmd = ["ip", "address", "add", str(ip), "dev", "lo"]
            if label:
                cmd += ["label", "lo:{0}".format(label)]
            subprocess.check_call(
                cmd, stdout=fnull, stderr=fnull)

    # If we setup IPs we should also remove them on SIGTERM
    def sigterm_handler(signum, frame): # pylint: disable=W0612,W0613
        remove_ips(ips, label)

    signal.signal(signal.SIGTERM, sigterm_handler)
Appends a new redaction rule to this instance.
dataset/ETHPy150Open Exa-Networks/exabgp/lib/exabgp/application/healthcheck.py/setup_ips--crossover with--dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/log_processing.py/LogLineRedacter.add_redaction_rule