Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating error messaging on failed manifest paths #582

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")