Skip to content

Commit

Permalink
Validate that node templates and artifacts assigned the proper TOSCA …
Browse files Browse the repository at this point in the history
…entity type (fixes #342 but disabled for now unless UNFURL_VALIDATION_MODE env var includes "types").

Enable this in unit tests.
  • Loading branch information
aszs committed Oct 25, 2024
1 parent ad58c26 commit e23ca79
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ setenv =
UNFURL_TMPDIR={envtmpdir}
UNFURL_NORUNTIME=1
UNFURL_APPROVE=1
UNFURL_VALIDATION_MODE=additionalProperties
UNFURL_VALIDATION_MODE="additionalProperties types"
UNFURL_RAISE_LOGGING_EXCEPTIONS=1
XDG_CACHE_HOME={envtmpdir}/.cache
XDG_CONFIG_HOME={envtmpdir}/.config
Expand Down
3 changes: 3 additions & 0 deletions unfurl/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,13 @@ def _parse_template(
# need to set a path for the import loader
mode = os.getenv("UNFURL_VALIDATION_MODE")
additionalProperties = False
validate_type_type = False
if mode is not None:
additionalProperties = "additionalProperties" in mode
validate_type_type = "types" in mode
ToscaTemplate.strict = "reqcheck" in mode
EntityTemplate.additionalProperties = additionalProperties
EntityTemplate.validate_type_type = validate_type_type
if resolver:
# hack! set this now so the find_matching_node callback is invoked
resolver.manifest.tosca = self
Expand Down

0 comments on commit e23ca79

Please sign in to comment.