Skip to content

Commit

Permalink
fix(schema): Warn if missing dependency (#4616)
Browse files Browse the repository at this point in the history
Previously users that didn't have the python jsonschema dependency
installed would "succeed" to validate a user configuration. Fix it.
  • Loading branch information
holmanb authored Nov 21, 2023
1 parent 0c9fd4e commit 424bacc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cloudinit/config/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,7 @@ def validate_cloudconfig_schema(
"see the schema errors."
)
LOG.warning(details)
return True


class _Annotator:
Expand Down Expand Up @@ -957,9 +958,14 @@ def validate_cloudconfig_file(
)
return False
try:
validate_cloudconfig_schema(
if not validate_cloudconfig_schema(
cloudconfig, schema, strict=True, log_deprecations=False
)
):
print(
f"Skipping {schema_type} schema validation."
" Jsonschema dependency missing."
)
return False
except SchemaValidationError as e:
if e.has_errors():
errors += e.schema_errors
Expand Down

0 comments on commit 424bacc

Please sign in to comment.