def __str__(self, prefix="! "): node_string = "" if self.node is not None: node_string = " in {}".format(self.node_to_string(self.node)) if hasattr(self.msg, 'split'): split_msg = self.msg.split("\n") else: split_msg = basestring(self.msg).split("\n") lines = ["{}{}".format(self.type + ' Error', node_string)] + split_msg lines += self.process_stack() return lines[0] + "\n" + "\n".join([" " + line for line in lines[1:]])
def __pull_deps_recursive(self, repos, processed_repos=None, i=0): if processed_repos is None: processed_repos = set() for repo_string in repos: repo, branch = self.__split_at_branch(repo_string) repo_folder = folder_from_git_remote(repo) try: if repo_folder in processed_repos: logger.info( "skipping already processed dependency {}".format( repo_folder)) else: dep_folder = self.__pull_repo(repo, branch) dep_project = project.read_project( os.path.join(self.project['modules-path'], dep_folder, 'dbt_project.yml'), self.project.profiles_dir, profile_to_load=self.project.profile_to_load) processed_repos.add(dep_folder) self.__pull_deps_recursive(dep_project['repositories'], processed_repos, i + 1) except IOError as e: if e.errno == errno.ENOENT: error_string = basestring(e) if 'dbt_project.yml' in error_string: error_string = ( "'{}' is not a valid dbt project - " "dbt_project.yml not found".format(repo)) elif 'git' in error_string: error_string = ("Git CLI is a dependency of dbt, but " "it is not installed!") raise dbt.exceptions.RuntimeException(error_string) else: raise e