Replace validictory with jsonschema
The validictory library will be deprecated in 2018. This patch replaces instances of it with jsonschema.validate. Change-Id: I64e92e23d3eebafdf399ab54200f050fe74f8c31
This commit is contained in:
parent
faf865ec6a
commit
d911e6e0af
@ -4,4 +4,4 @@
|
|||||||
|
|
||||||
pbr>=2.0 # Apache-2.0
|
pbr>=2.0 # Apache-2.0
|
||||||
sushy>=0.1.0 # Apache-2.0
|
sushy>=0.1.0 # Apache-2.0
|
||||||
validictory>=1.0.0
|
jsonschema<3.0.0,>=2.6.0 # MIT
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from jsonschema import validate
|
||||||
import logging
|
import logging
|
||||||
import validictory
|
|
||||||
|
|
||||||
from sushy import exceptions
|
from sushy import exceptions
|
||||||
from sushy.resources import base
|
from sushy.resources import base
|
||||||
@ -413,33 +413,28 @@ class NodeCollection(base.ResourceCollectionBase):
|
|||||||
request['Description'] = description
|
request['Description'] = description
|
||||||
|
|
||||||
if processor_req is not None:
|
if processor_req is not None:
|
||||||
validictory.validate(processor_req,
|
validate(processor_req,
|
||||||
node_schemas.processor_req_schema,
|
node_schemas.processor_req_schema)
|
||||||
required_by_default=False)
|
|
||||||
request['Processors'] = processor_req
|
request['Processors'] = processor_req
|
||||||
|
|
||||||
if memory_req is not None:
|
if memory_req is not None:
|
||||||
validictory.validate(memory_req,
|
validate(memory_req,
|
||||||
node_schemas.memory_req_schema,
|
node_schemas.memory_req_schema)
|
||||||
required_by_default=False)
|
|
||||||
request['Memory'] = memory_req
|
request['Memory'] = memory_req
|
||||||
|
|
||||||
if remote_drive_req is not None:
|
if remote_drive_req is not None:
|
||||||
validictory.validate(remote_drive_req,
|
validate(remote_drive_req,
|
||||||
node_schemas.remote_drive_req_schema,
|
node_schemas.remote_drive_req_schema)
|
||||||
required_by_refault=False)
|
|
||||||
request['RemoteDrives'] = remote_drive_req
|
request['RemoteDrives'] = remote_drive_req
|
||||||
|
|
||||||
if local_drive_req is not None:
|
if local_drive_req is not None:
|
||||||
validictory.validate(local_drive_req,
|
validate(local_drive_req,
|
||||||
node_schemas.local_drive_req_schema,
|
node_schemas.local_drive_req_schema)
|
||||||
required_by_default=False)
|
|
||||||
request['LocalDrives'] = local_drive_req
|
request['LocalDrives'] = local_drive_req
|
||||||
|
|
||||||
if ethernet_interface_req is not None:
|
if ethernet_interface_req is not None:
|
||||||
validictory.validate(ethernet_interface_req,
|
validate(ethernet_interface_req,
|
||||||
node_schemas.ethernet_interface_req_schema,
|
node_schemas.ethernet_interface_req_schema)
|
||||||
required_by_default=False)
|
|
||||||
request['EthernetInterfaces'] = ethernet_interface_req
|
request['EthernetInterfaces'] = ethernet_interface_req
|
||||||
|
|
||||||
return request
|
return request
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
import jsonschema
|
||||||
import mock
|
import mock
|
||||||
import testtools
|
import testtools
|
||||||
import validictory
|
|
||||||
|
|
||||||
from sushy import exceptions
|
from sushy import exceptions
|
||||||
from sushy.resources.system import system
|
from sushy.resources.system import system
|
||||||
@ -422,6 +422,6 @@ class NodeCollectionTestCase(testtools.TestCase):
|
|||||||
self.assertEqual(result, '/redfish/v1/Nodes/1')
|
self.assertEqual(result, '/redfish/v1/Nodes/1')
|
||||||
|
|
||||||
def test_compose_node_invalid_reqs(self):
|
def test_compose_node_invalid_reqs(self):
|
||||||
self.assertRaises(validictory.validator.FieldValidationError,
|
self.assertRaises(jsonschema.exceptions.ValidationError,
|
||||||
self.node_col.compose_node,
|
self.node_col.compose_node,
|
||||||
processor_req='invalid')
|
processor_req='invalid')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user