[libvirt-ci PATCH 06/13] lcitool: Introduce methods to load and validate the TOML config
Andrea Bolognani
abologna at redhat.com
Tue Apr 28 07:41:56 UTC 2020
On Wed, 2020-04-22 at 15:28 +0200, Erik Skultety wrote:
> + @staticmethod
> + def _fill_default_options(cfg):
> + flavor = cfg.get("install").get("flavor", "test")
> + cfg["install"]["flavor"] = flavor
> +
> + if flavor == "gitlab":
> + url = cfg.get("gitlab").get("gitlab_url", "https://gitlab.com")
> + cfg["gitlab"]["gitlab_url"] = url
The key should be "url" here...
> + def _validate(self):
> +
> + # verify the [install] section and its mandatory options
> + self._validate_section(self.dict, "install", "root_password")
> +
> + # we need to check flavor here, because later validations depend on it
> + flavor = self.dict.get("install").get("flavor", "test")
> + if flavor not in ["test", "jenkins", "gitlab"]:
> + raise ValueError(
> + "Invalid value '{}' for 'install.flavor'".format(flavor)
> + )
> +
> + # verify the optional [gitlab] section and its mandatory options
> + if flavor == "gitlab":
> + self._validate_section(self.dict, "gitlab", "gitlab_runner_secret")
... and "runner_secret" here.
--
Andrea Bolognani / Red Hat / Virtualization
More information about the libvir-list
mailing list