summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-08-12 15:15:46 +0000
committerGerrit Code Review <review@openstack.org>2016-08-12 15:15:46 +0000
commit5de07c339503c90634e27de342d23276a8833111 (patch)
tree358e27216dc8d30c9f3b48fbaf7a81091112d212
parent9e84185a6da0bf14f039859814a2ce66247240bf (diff)
parentd7db97c92605a11e312d17cdcdd8ac363bc10924 (diff)
downloadpython-glanceclient-2.4.0.tar.gz
Merge "Fix warlock model creation"2.4.0
-rw-r--r--glanceclient/tests/unit/v2/test_schemas.py2
-rw-r--r--glanceclient/v2/image_tags.py3
-rw-r--r--glanceclient/v2/images.py8
-rw-r--r--glanceclient/v2/metadefs.py15
-rw-r--r--glanceclient/v2/tasks.py3
5 files changed, 19 insertions, 12 deletions
diff --git a/glanceclient/tests/unit/v2/test_schemas.py b/glanceclient/tests/unit/v2/test_schemas.py
index 60442a8..c01d8bd 100644
--- a/glanceclient/tests/unit/v2/test_schemas.py
+++ b/glanceclient/tests/unit/v2/test_schemas.py
@@ -130,7 +130,7 @@ class TestSchemaBasedModel(testtools.TestCase):
def setUp(self):
super(TestSchemaBasedModel, self).setUp()
self.model = warlock.model_factory(_SCHEMA.raw(),
- schemas.SchemaBasedModel)
+ base_class=schemas.SchemaBasedModel)
def test_patch_should_replace_missing_core_properties(self):
obj = {
diff --git a/glanceclient/v2/image_tags.py b/glanceclient/v2/image_tags.py
index bcecd01..deebce2 100644
--- a/glanceclient/v2/image_tags.py
+++ b/glanceclient/v2/image_tags.py
@@ -27,7 +27,8 @@ class Controller(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('image')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def update(self, image_id, tag_value):
"""Update an image with the given tag.
diff --git a/glanceclient/v2/images.py b/glanceclient/v2/images.py
index a9a5e99..f69fed5 100644
--- a/glanceclient/v2/images.py
+++ b/glanceclient/v2/images.py
@@ -39,16 +39,16 @@ class Controller(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('image')
- warlock_model = warlock.model_factory(schema.raw(),
- schemas.SchemaBasedModel)
+ warlock_model = warlock.model_factory(
+ schema.raw(), base_class=schemas.SchemaBasedModel)
return warlock_model
@utils.memoized_property
def unvalidated_model(self):
"""A model which does not validate the image against the v2 schema."""
schema = self.schema_client.get('image')
- warlock_model = warlock.model_factory(schema.raw(),
- schemas.SchemaBasedModel)
+ warlock_model = warlock.model_factory(
+ schema.raw(), base_class=schemas.SchemaBasedModel)
warlock_model.validate = lambda *args, **kwargs: None
return warlock_model
diff --git a/glanceclient/v2/metadefs.py b/glanceclient/v2/metadefs.py
index 28d0db6..4bee224 100644
--- a/glanceclient/v2/metadefs.py
+++ b/glanceclient/v2/metadefs.py
@@ -34,7 +34,8 @@ class NamespaceController(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('metadefs/namespace')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def create(self, **kwargs):
"""Create a namespace.
@@ -186,7 +187,8 @@ class ResourceTypeController(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('metadefs/resource_type')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def associate(self, namespace, **kwargs):
"""Associate a resource type with a namespace."""
@@ -234,7 +236,8 @@ class PropertyController(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('metadefs/property')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def create(self, namespace, **kwargs):
"""Create a property.
@@ -314,7 +317,8 @@ class ObjectController(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('metadefs/object')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def create(self, namespace, **kwargs):
"""Create an object.
@@ -397,7 +401,8 @@ class TagController(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('metadefs/tag')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def create(self, namespace, tag_name):
"""Create a tag.
diff --git a/glanceclient/v2/tasks.py b/glanceclient/v2/tasks.py
index 90b62e5..9c78020 100644
--- a/glanceclient/v2/tasks.py
+++ b/glanceclient/v2/tasks.py
@@ -35,7 +35,8 @@ class Controller(object):
@utils.memoized_property
def model(self):
schema = self.schema_client.get('task')
- return warlock.model_factory(schema.raw(), schemas.SchemaBasedModel)
+ return warlock.model_factory(schema.raw(),
+ base_class=schemas.SchemaBasedModel)
def list(self, **kwargs):
"""Retrieve a listing of Task objects.