From 49b6c320584b46321d5d49f929ec0acc8b045d37 Mon Sep 17 00:00:00 2001 From: Patrick Robertson Date: Thu, 20 Feb 2025 11:29:36 +0000 Subject: [PATCH] Fix the 'full' mode which creates a complete config file --- src/auto_archiver/core/config.py | 2 +- src/auto_archiver/core/module.py | 6 ++++-- src/auto_archiver/core/orchestrator.py | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/auto_archiver/core/config.py b/src/auto_archiver/core/config.py index 79ce7e2..2e5d273 100644 --- a/src/auto_archiver/core/config.py +++ b/src/auto_archiver/core/config.py @@ -22,8 +22,8 @@ DEFAULT_CONFIG_FILE = "orchestration.yaml" EMPTY_CONFIG = _yaml.load(""" # Auto Archiver Configuration -# Steps are the modules that will be run in the order they are defined +# Steps are the modules that will be run in the order they are defined steps:""" + "".join([f"\n {module}s: []" for module in MODULE_TYPES]) + \ """ diff --git a/src/auto_archiver/core/module.py b/src/auto_archiver/core/module.py index 9556621..9f20084 100644 --- a/src/auto_archiver/core/module.py +++ b/src/auto_archiver/core/module.py @@ -134,7 +134,6 @@ class LazyBaseModule: """ name: str - type: list description: str path: str module_factory: ModuleFactory @@ -148,6 +147,10 @@ class LazyBaseModule: self.path = path self.module_factory = factory + @property + def type(self): + return self.manifest['type'] + @property def entry_point(self): if not self._entry_point and not self.manifest['entry_point']: @@ -186,7 +189,6 @@ class LazyBaseModule: logger.error(f"Error loading manifest from file {self.path}/{MANIFEST_FILE}: {e}") self._manifest = manifest - self.type = manifest['type'] self._entry_point = manifest['entry_point'] self.description = manifest['description'] self.version = manifest['version'] diff --git a/src/auto_archiver/core/orchestrator.py b/src/auto_archiver/core/orchestrator.py index ba84d28..f4086e9 100644 --- a/src/auto_archiver/core/orchestrator.py +++ b/src/auto_archiver/core/orchestrator.py @@ -125,7 +125,13 @@ class ArchivingOrchestrator: yaml_config['steps'].setdefault(f"{module_type}s", []).append(module.name) else: # load all modules, they're not using the 'simple' mode - self.add_individual_module_args(self.module_factory.available_modules(), parser) + all_modules = self.module_factory.available_modules() + # add all the modules to the steps + for module in all_modules: + for module_type in module.type: + yaml_config['steps'].setdefault(f"{module_type}s", []).append(module.name) + + self.add_individual_module_args(all_modules, parser) parser.set_defaults(**to_dot_notation(yaml_config)) @@ -379,7 +385,7 @@ class ArchivingOrchestrator: self.setup(args) return self.feed() except Exception as e: - logger.exception(e) + logger.error(e) exit(1) def cleanup(self) -> None: