Skip to content

Commit

Permalink
Merge pull request #582 from dgraeber/feature/broken-paths
Browse files Browse the repository at this point in the history
updating error messaging on failed manifest paths
  • Loading branch information
dgraeber authored May 14, 2024
2 parents fc0c755 + 53f201c commit 6d06cb2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a Ch
### New

### Changes

- adding local path of manifests that fail to load to the actual final string printed
- this is already being done, but moving closer to last line of output
### Fixes

## v3.5.0 (2024-05-09)
Expand Down
8 changes: 6 additions & 2 deletions seedfarmer/commands/_deployment_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,11 +661,15 @@ def apply(
try:
with open(os.path.join(config.OPS_ROOT, module_group.path)) as manifest_file:
module_group.modules = [ModuleManifest(**m) for m in yaml.safe_load_all(manifest_file)]
except FileNotFoundError as fe:
_logger.error(fe)
_logger.error(f"Cannot parse a file at {os.path.join(config.OPS_ROOT, module_group.path)}")
_logger.error("Verify (in deployment manifest) that relative path to the module manifest is correct")
raise seedfarmer.errors.InvalidPathError(f"Cannot parse manifest file path at {module_group.path}")
except Exception as e:
_logger.error(e)
_logger.error(f"Cannot parse a file at {os.path.join(config.OPS_ROOT, module_group.path)}")
_logger.error("Verify that elements are filled out and yaml compliant")
raise seedfarmer.errors.InvalidPathError("Cannot parse manifest file path")
raise seedfarmer.errors.InvalidManifestError("Cannot parse manifest properly")
deployment_manifest.validate_and_set_module_defaults()

prime_target_accounts(
Expand Down
2 changes: 1 addition & 1 deletion seedfarmer/mgmt/module_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,5 +833,5 @@ def get_modulestack_path(module_path: str) -> Any:
def get_deployspec_path(module_path: str) -> str:
p = os.path.join(config.OPS_ROOT, module_path, "deployspec.yaml")
if not os.path.exists(p):
raise seedfarmer.errors.InvalidPathError("No deployspec.yaml file found in module directory: %s", p)
raise seedfarmer.errors.InvalidPathError(f"No deployspec.yaml file found in module directory: {p}")
return os.path.join(config.OPS_ROOT, module_path, "deployspec.yaml")

0 comments on commit 6d06cb2

Please sign in to comment.