def get_params(self, backend, path): """Gets the matching parameters from the requested path.""" match = re_config_file.match(path) if match is not None: return get_parameters(match) match = re_other_file.match(path) if match is not None: return get_parameters(match) return None
def match_path(self, backend, path): """Checks path for the configuration file that needs to be generated. :param backend: requesting backend :param path: requested path :return: dict of match params from path, None if no match """ match = re_config_file.match(path) if match is None: return None params = get_parameters(match) # MAC address is in the wrong format, fix it mac = params.get("mac") if mac is not None: params["mac"] = mac.replace(":", "-") # MAAS uses Debian architectures while GRUB uses standard Linux # architectures. arch = params.get("arch") if arch == "x86_64": params["arch"] = "amd64" elif arch in {"powerpc", "ppc64", "ppc64le"}: params["arch"] = "ppc64el" return params
def match_path(self, backend, path): """Checks path for the configuration file that needs to be generated. :param backend: requesting backend :param path: requested path :return: dict of match params from path, None if no match """ match = re_config_file.match(path) if match is None: return None return get_parameters(match)
def match_path(self, backend, path): """Checks path for the configuration file that needs to be generated. :param backend: requesting backend :param path: requested path :return: dict of match params from path, None if no match """ match = re_config_file.match(path) if match is None: return None params = get_parameters(match) # MAC address is in the wrong format, fix it mac = params.get("mac") if mac is not None: params["mac"] = mac.replace(":", "-") return params