summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2021-10-22 22:06:51 -0500
committerGitHub <noreply@github.com>2021-10-22 21:06:51 -0600
commit2db713346d656c3486228678ad020b56440c1e34 (patch)
tree5191e071a845328405caa5ee6a65878612898cd2
parent6cf9dc870f69f8d910388193a4a59474117915b7 (diff)
downloadvyos-cloud-init-2db713346d656c3486228678ad020b56440c1e34.tar.gz
vyos-cloud-init-2db713346d656c3486228678ad020b56440c1e34.zip
Remove pin in dependencies for jsonschema (#1078)
In jsonschema 4, hostname validation was changed to have an optional dependency on the fqdn package. Since we don't have this dependency in cloud-init, attempting this validation will no longer fail for a string that isn't a valid hostname.
-rw-r--r--requirements.txt2
-rw-r--r--test-requirements.txt2
-rw-r--r--tests/unittests/test_handler/test_schema.py10
-rw-r--r--tox.ini2
4 files changed, 8 insertions, 8 deletions
diff --git a/requirements.txt b/requirements.txt
index 27cef184..c4adc455 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -31,7 +31,7 @@ requests
jsonpatch
# For validating cloud-config sections per schema definitions
-jsonschema==3.2.0
+jsonschema
# Used by DataSourceVMware to inspect the host's network configuration during
# the "setup()" function.
diff --git a/test-requirements.txt b/test-requirements.txt
index 61fb9b03..06dfbbec 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -5,4 +5,4 @@ pytest-cov
# Only really needed on older versions of python
setuptools
-jsonschema==3.2.0
+jsonschema
diff --git a/tests/unittests/test_handler/test_schema.py b/tests/unittests/test_handler/test_schema.py
index 6b0b1f74..6f37ceb7 100644
--- a/tests/unittests/test_handler/test_schema.py
+++ b/tests/unittests/test_handler/test_schema.py
@@ -108,11 +108,11 @@ class ValidateCloudConfigSchemaTest(CiTestCase):
def test_validateconfig_schema_honors_formats(self):
"""With strict True, validate_cloudconfig_schema errors on format."""
schema = {
- 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}}
+ 'properties': {'p1': {'type': 'string', 'format': 'email'}}}
with self.assertRaises(SchemaValidationError) as context_mgr:
validate_cloudconfig_schema({'p1': '-1'}, schema, strict=True)
self.assertEqual(
- "Cloud config schema errors: p1: '-1' is not a 'hostname'",
+ "Cloud config schema errors: p1: '-1' is not a 'email'",
str(context_mgr.exception))
@@ -189,12 +189,12 @@ class ValidateCloudConfigFileTest(CiTestCase):
def test_validateconfig_file_sctrictly_validates_schema(self):
"""validate_cloudconfig_file raises errors on invalid schema."""
schema = {
- 'properties': {'p1': {'type': 'string', 'format': 'hostname'}}}
- write_file(self.config_file, '#cloud-config\np1: "-1"')
+ 'properties': {'p1': {'type': 'string', 'format': 'string'}}}
+ write_file(self.config_file, '#cloud-config\np1: -1')
with self.assertRaises(SchemaValidationError) as context_mgr:
validate_cloudconfig_file(self.config_file, schema)
self.assertEqual(
- "Cloud config schema errors: p1: '-1' is not a 'hostname'",
+ "Cloud config schema errors: p1: -1 is not of type 'string'",
str(context_mgr.exception))
diff --git a/tox.ini b/tox.ini
index f0c22cdb..874d3f20 100644
--- a/tox.ini
+++ b/tox.ini
@@ -77,7 +77,7 @@ deps =
pyserial==3.0.1
configobj==5.0.6
requests==2.9.1
- jsonschema==3.2.0
+ jsonschema
# test-requirements
pytest-catchlog==1.2.1