def parse()

in container-images/gerrit-init/tools/gerrit-initializer/initializer/config/init_config.py [0:0]


    def parse(self, config_file):
        if not os.path.exists(config_file):
            raise FileNotFoundError("Could not find config file: %s" % config_file)

        with open(config_file, "r") as f:
            config = yaml.load(f, Loader=yaml.SafeLoader)

        if config is None:
            raise ValueError("Invalid config-file: %s" % config_file)

        if "downloadedPlugins" in config:
            self.downloaded_plugins = config["downloadedPlugins"]
        if "packagedPlugins" in config:
            self.packaged_plugins = set(config["packagedPlugins"])
        if "installAsLibrary" in config:
            self.install_as_library = set(config["installAsLibrary"])
        if "pluginCache" in config:
            self.plugin_cache_enabled = config["pluginCache"]
        if "pluginCacheDir" in config and config["pluginCacheDir"]:
            self.plugin_cache_dir = config["pluginCacheDir"]

        if "caCertPath" in config:
            self.ca_cert_path = config["caCertPath"]

        return self