Skip schema validation on GET /v2/images/%s

These are server-generated, not user-generated, and schema validation
should not be necessary.

Rework a unit test that enforces this; bad data should be blocked
at ingest, not blocked on reads.

Co-authored-by: Stuart McLaren <stuart.mclaren@hp.com>
Change-Id: Ib1926fec0e858b6eed43c7931a6d6c3a1708e70e
Closes-Bug: 1501046
This commit is contained in:
Nicolas Simonds
2015-09-30 09:42:31 -07:00
committed by Stuart McLaren
parent dd588b475b
commit 214dbffc92
2 changed files with 6 additions and 9 deletions
+3 -2
View File
@@ -182,7 +182,7 @@ class Controller(object):
# NOTE(bcwaldon): remove 'self' for now until we have an elegant
# way to pass it into the model constructor without conflict
body.pop('self', None)
return self.model(**body)
return self.unvalidated_model(**body)
def data(self, image_id, do_checksum=True):
"""Retrieve data of an image.
@@ -255,7 +255,8 @@ class Controller(object):
:param remove_props: List of property names to remove
:param \*\*kwargs: Image attribute names and their new values.
"""
image = self.get(image_id)
unvalidated_image = self.get(image_id)
image = self.model(**unvalidated_image)
for (key, value) in kwargs.items():
try:
setattr(image, key, value)