Replace static v2 Image model with warlock model
* Add warlock v0.1.0 as a dependency * Generate a pythonic, self-validating Image model using warlock * Add raw method to Schema model * Related to bp glance-client-v2 Change-Id: Ib98e912a7af0bb570b4fd738733edd9b837d1a04
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
import logging
|
||||
|
||||
import warlock
|
||||
|
||||
from glanceclient.common import http
|
||||
from glanceclient.v2 import images
|
||||
from glanceclient.v2 import schemas
|
||||
@@ -36,5 +38,10 @@ class Client(object):
|
||||
def __init__(self, endpoint, token=None, timeout=600, **kwargs):
|
||||
self.http_client = http.HTTPClient(
|
||||
endpoint, token=token, timeout=timeout)
|
||||
self.images = images.Controller(self.http_client)
|
||||
self.schemas = schemas.Controller(self.http_client)
|
||||
self.images = images.Controller(self.http_client,
|
||||
self._get_image_model())
|
||||
|
||||
def _get_image_model(self):
|
||||
schema = self.schemas.get('image')
|
||||
return warlock.model_factory(schema.raw())
|
||||
|
||||
Reference in New Issue
Block a user