diff --git a/src/coordinator.py b/src/coordinator.py index cb011f1..948a03a 100644 --- a/src/coordinator.py +++ b/src/coordinator.py @@ -47,13 +47,18 @@ class Coordinator: env_files.append(EnvFile(env_path=env_path, config=config, env_type=env_type)) return env_files - def _get_dependency_rules(self, env_files: list[EnvFile]): + def _get_dependency_rules(self, env_files: list[EnvFile]) -> list[DependencyRule]: + dependency_rules: list[DependencyRule] = [] for env_file in env_files: child_runner_class = RUNNER_DICT[env_file.env_type] print(child_runner_class.name) for dependency in child_runner_class.dependencies: print("dependency", dependency.name) + dependency_rule = DependencyRule(child=child_runner_class.name, dependency=dependency.name) + dependency_rules.append(dependency_rule) + print(dependency_rules) exit() + return dependency_rules def setup_test(self) -> None: logger.info("calling setup_test()") diff --git a/src/env_file_helper.py b/src/env_file_helper.py index 361dca0..944651e 100644 --- a/src/env_file_helper.py +++ b/src/env_file_helper.py @@ -12,12 +12,12 @@ class EnvFile(NamedTuple): class DependencyRule(NamedTuple): child: str - parent: str + dependency: str def _is_rule_satisfied(in_list: list, rule: DependencyRule) -> bool: child_index = in_list.index(rule.child) - parent_index = in_list.index(rule.parent) + parent_index = in_list.index(rule.dependency) return parent_index < child_index @@ -36,7 +36,7 @@ def sort_env_files_by_rule(env_list: list, rules: list[DependencyRule]) -> list: rule_satisfied.append(True) else: rule_satisfied.append(False) - parent_index = in_list.index(rule.parent) + parent_index = in_list.index(rule.dependency) swap_item_with_previous(in_list, parent_index) if all(rule_satisfied): return in_list