Exemplo n.º 1
0
    def _load_config(self):
        """ Loads the local configuration """
        # avoid loading multiple times
        if UniversalConfig.config is not None:
            return

        # load the global config
        with open(self.config_universal_path, "r",
                  encoding="utf-8") as f_config:
            config = yaml.safe_load(f_config)
        UniversalConfig.config_universal = config

        # Load the local config
        if self.config_global_path:
            with open(self.config_global_path, "r", encoding="utf-8") as f:
                config = yaml.safe_load(f)
        else:
            config = {}
        UniversalConfig.config_global = config

        UniversalConfig.config = merge_config({
            "universal_config":
            UniversalConfig.config_universal,
            "global_config":
            UniversalConfig.config_global,
        })
Exemplo n.º 2
0
    def _load_config(self):
        """ Loads the local configuration """
        # avoid loading multiple times
        if BaseGlobalConfig.config is not None:
            return

        # load the global config
        with open(self.config_global_path, "r") as f_config:
            config = yaml.safe_load(f_config)
        BaseGlobalConfig.config_global = config

        # Load the local config
        if self.config_global_local_path:
            with open(self.config_global_local_path, "r") as f:
                config = yaml.safe_load(f)
        else:
            config = {}
        BaseGlobalConfig.config_global_local = config

        BaseGlobalConfig.config = merge_config({
            "global_config":
            BaseGlobalConfig.config_global,
            "global_local":
            BaseGlobalConfig.config_global_local,
        })
Exemplo n.º 3
0
    def _load_config(self):
        """ Loads the configuration from YAML, if no override config was passed in initially. """

        if (
                self.config
        ):  # any config being pre-set at init will short circuit out, but not a plain {}
            return

        # Verify that we're in a project
        repo_root = self.repo_root
        if not repo_root:
            raise NotInProject(
                "No git repository was found in the current path. You must be in a git repository to set up and use CCI for a project."
            )

        # Verify that the project's root has a config file
        if not self.config_project_path:
            raise ProjectConfigNotFound(
                f"The file {self.config_filename} was not found in the repo root: {repo_root}. Are you in a CumulusCI Project directory?"
            )

        # Load the project's yaml config file
        with open(self.config_project_path, "r") as f_config:
            project_config = cci_safe_load(f_config)

        if project_config:
            self.config_project.update(project_config)

        # Load the local project yaml config file if it exists
        if self.config_project_local_path:
            with open(self.config_project_local_path, "r") as f_local_config:
                local_config = cci_safe_load(f_local_config)
            if local_config:
                self.config_project_local.update(local_config)

        # merge in any additional yaml that was passed along
        if self.additional_yaml:
            additional_yaml_config = yaml.safe_load(self.additional_yaml)
            if additional_yaml_config:
                self.config_additional_yaml.update(additional_yaml_config)

        self.config = merge_config({
            "global_config":
            self.config_global,
            "global_local":
            self.config_global_local,
            "project_config":
            self.config_project,
            "project_local_config":
            self.config_project_local,
            "additional_yaml":
            self.config_additional_yaml,
        })

        self._validate_config()
    def _load_config(self):
        """ Loads the configuration from YAML, if no override config was passed in initially. """

        if (
            self.config
        ):  # any config being pre-set at init will short circuit out, but not a plain {}
            return

        # Verify that we're in a project
        repo_root = self.repo_root
        if not repo_root:
            raise NotInProject(
                "No git repository was found in the current path. You must be in a git repository to set up and use CCI for a project."
            )

        # Verify that the project's root has a config file
        if not self.config_project_path:
            raise ProjectConfigNotFound(
                "The file {} was not found in the repo root: {}. Are you in a CumulusCI Project directory?".format(
                    self.config_filename, repo_root
                )
            )

        # Load the project's yaml config file
        with open(self.config_project_path, "r") as f_config:
            project_config = ordered_yaml_load(f_config)

        if project_config:
            self.config_project.update(project_config)

        # Load the local project yaml config file if it exists
        if self.config_project_local_path:
            with open(self.config_project_local_path, "r") as f_local_config:
                local_config = ordered_yaml_load(f_local_config)
            if local_config:
                self.config_project_local.update(local_config)

        # merge in any additional yaml that was passed along
        if self.additional_yaml:
            additional_yaml_config = ordered_yaml_load(self.additional_yaml)
            if additional_yaml_config:
                self.config_additional_yaml.update(additional_yaml_config)

        self.config = merge_config(
            OrderedDict(
                [
                    ("global_config", self.config_global),
                    ("global_local", self.config_global_local),
                    ("project_config", self.config_project),
                    ("project_local_config", self.config_project_local),
                    ("additional_yaml", self.config_additional_yaml),
                ]
            )
        )
Exemplo n.º 5
0
    def _load_config(self):
        """ Loads the local configuration """
        # load the global config
        with open(self.config_global_path, "r") as f_config:
            config = ordered_yaml_load(f_config)
        self.config_global = config

        # Load the local config
        if self.config_global_local_path:
            config = ordered_yaml_load(open(self.config_global_local_path,
                                            "r"))
            self.config_global_local = config

        self.config = merge_config({
            "global_config": self.config_global,
            "global_local": self.config_global_local,
        })
    def _load_config(self):
        """ Loads the local configuration """
        # load the global config
        with open(self.config_global_path, "r") as f_config:
            config = ordered_yaml_load(f_config)
        self.config_global = config

        # Load the local config
        if self.config_global_local_path:
            config = ordered_yaml_load(open(self.config_global_local_path, "r"))
            self.config_global_local = config

        self.config = merge_config(
            OrderedDict(
                [
                    ("global_config", self.config_global),
                    ("global_local", self.config_global_local),
                ]
            )
        )