Esempio n. 1
0
def __get_repo_apps(team_config_git_repo: GitRepo) -> Set[str]:
    team_config_git_repo.clone()
    repo_dir = team_config_git_repo.get_full_file_path(".")
    return {
        name
        for name in os.listdir(repo_dir)
        if os.path.isdir(os.path.join(repo_dir, name))
        and not name.startswith(".")
    }
Esempio n. 2
0
    def test_finalize(self):
        testee = GitRepo(self.__mock_repo_api)

        testee.clone()

        tmp_dir = testee.get_full_file_path("..")
        self.assertTrue(path.exists(tmp_dir))

        testee.finalize()
        self.assertFalse(path.exists(tmp_dir))
Esempio n. 3
0
    def test_enter_and_exit_magic_methods(self):
        testee = GitRepo(self.__mock_repo_api)

        self.assertEqual(testee, testee.__enter__())

        testee.clone()

        tmp_dir = testee.get_full_file_path("..")
        self.assertTrue(path.exists(tmp_dir))

        testee.__exit__(None, None, None)
        self.assertFalse(path.exists(tmp_dir))
Esempio n. 4
0
def __get_bootstrap_entries(root_config_git_repo: GitRepo) -> Any:
    root_config_git_repo.clone()
    bootstrap_values_file = root_config_git_repo.get_full_file_path(
        "bootstrap/values.yaml")
    try:
        bootstrap_yaml = yaml_file_load(bootstrap_values_file)
    except FileNotFoundError as ex:
        raise GitOpsException(
            "File 'bootstrap/values.yaml' not found in root repository."
        ) from ex
    if "bootstrap" not in bootstrap_yaml:
        raise GitOpsException(
            "Cannot find key 'bootstrap' in 'bootstrap/values.yaml'")
    return bootstrap_yaml["bootstrap"]