def apply_defaults(cfg): if "DEFAULT" not in cfg: return cfg defaults = cfg["DEFAULT"] not_defaults = cfg[~eq("DEFAULT")] for c in not_defaults: for d in defaults.grandchildren: if d.name not in c: c.children.append(d) cfg.children = list(not_defaults) return cfg
def _desugar_match_ignore(self, match, ignore): if match is None: match = TRUE elif isinstance(match, str): if match in self: match = eq(dr.get_name(self[match])) else: match = matches(match) if ignore is None: ignore = FALSE elif isinstance(ignore, str): ignore = matches(ignore) return (match, ignore)
def __init__(self, confs): super(NginxConfTree, self).__init__(confs, "nginx.conf", eq("include"))
def __init__(self, confs): include = eq("include") main_file = "logrotate.conf" super(LogRotateConfTree, self).__init__(confs, main_file, include)
def __init__(self, confs): include = eq("conf-dir") main_file = "dnsmasq.conf" super(DnsmasqConfTree, self).__init__(confs, main_file, include)