def render_config(): c = login_from_env() t = Template(filename=os.getenv("BHR_TEMPLATE")) path_to_bhr_client_exabgp_loop = find_executable("bhr-client-exabgp-loop") if not path_to_bhr_client_exabgp_loop: raise RuntimeError("Can not find bhr-client-exabgp-loop in $PATH") ipv4, ipv6 = get_ips() context = { "blocked": [], 'ip': ipv4, 'ipv6': ipv6, "path_to_bhr_client_exabgp_loop": path_to_bhr_client_exabgp_loop, } return t.render(**context)
def __init__(self): self.t = Template(filename=os.getenv("BHR_TEMPLATE")) self.block = self.t.get_def('block') self.ipv4, self.ipv6 = get_ips()