Skip to content

Commit

Permalink
Add validation for file existence checks in render script
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicaj committed May 6, 2024
1 parent 22853db commit 1250db3
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions catalog_templating/scripts/render_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@
import os
import shutil

from apps_validation.exceptions import ValidationErrors
from catalog_reader.app_utils import get_values
from catalog_templating.render import render_templates


def render_templates_from_path(app_path: str, values_file: str) -> None:
verrors = ValidationErrors()
for k, v in (('app_path', app_path), ('values_file', values_file)):
if not os.path.exists(v):
verrors.add(k, f'{v!r} {k} does not exist')

verrors.check()

rendered_data = render_templates(app_path, get_values(values_file))
write_template_yaml(app_path, rendered_data)

Expand Down

0 comments on commit 1250db3

Please sign in to comment.