diff --git a/kas/config.py b/kas/config.py index 236d106..091e727 100644 --- a/kas/config.py +++ b/kas/config.py @@ -41,23 +41,22 @@ class Config: self._override_target = target self._override_task = task self._config = {} - if filename: - self.filenames = [os.path.abspath(configfile) - for configfile in filename.split(':')] - self.top_repo_path = Repo.get_root_path( - os.path.dirname(self.filenames[0])) + if not filename: + filename = os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE) - repo_paths = [Repo.get_root_path(os.path.dirname(configfile), - fallback=False) - for configfile in self.filenames] + self.filenames = [os.path.abspath(configfile) + for configfile in filename.split(':')] + self.top_repo_path = Repo.get_root_path( + os.path.dirname(self.filenames[0])) - if len(set(repo_paths)) > 1: - raise IncludeException('All concatenated config files must ' - 'belong to the same repository or all ' - 'must be outside of versioning control') - else: - self.filenames = [os.path.join(ctx.kas_work_dir, CONFIG_YAML_FILE)] - self.top_repo_path = Repo.get_root_path(ctx.kas_work_dir) + repo_paths = [Repo.get_root_path(os.path.dirname(configfile), + fallback=False) + for configfile in self.filenames] + + if len(set(repo_paths)) > 1: + raise IncludeException('All concatenated config files must ' + 'belong to the same repository or all ' + 'must be outside of versioning control') self.handler = IncludeHandler(self.filenames, self.top_repo_path) self.repo_dict = self._get_repo_dict()