summaryrefslogtreecommitdiffstats
path: root/keystone/catalog
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2012-11-06 17:01:59 +0000
committerDolph Mathews <dolph.mathews@gmail.com>2012-11-06 17:01:59 +0000
commitdf148a09fc1c7d44f2134a2dc6566ef1dbe772df (patch)
treee1f3d95563ba26f43c82a9bfcc0c5055943a8fb6 /keystone/catalog
parenta6ef09d94300718197a4fa8757fd3a7a45876963 (diff)
downloadkeystone-df148a09fc1c7d44f2134a2dc6566ef1dbe772df.tar.gz
keystone-df148a09fc1c7d44f2134a2dc6566ef1dbe772df.tar.xz
keystone-df148a09fc1c7d44f2134a2dc6566ef1dbe772df.zip
Return non-indexed attrs, not 'extra' (bug 1075376)
(most of this is pulled from the v3 branch) Change-Id: Id1118e7a2b245fb7ec95e41ec297c87036953db2
Diffstat (limited to 'keystone/catalog')
-rw-r--r--keystone/catalog/backends/sql.py34
1 files changed, 2 insertions, 32 deletions
diff --git a/keystone/catalog/backends/sql.py b/keystone/catalog/backends/sql.py
index 6876bdec..b2012c69 100644
--- a/keystone/catalog/backends/sql.py
+++ b/keystone/catalog/backends/sql.py
@@ -28,29 +28,15 @@ CONF = config.CONF
class Service(sql.ModelBase, sql.DictBase):
__tablename__ = 'service'
+ attributes = ['id', 'type']
id = sql.Column(sql.String(64), primary_key=True)
type = sql.Column(sql.String(255))
extra = sql.Column(sql.JsonBlob())
- @classmethod
- def from_dict(cls, service_dict):
- extra = {}
- for k, v in service_dict.copy().iteritems():
- if k not in ['id', 'type', 'extra']:
- extra[k] = service_dict.pop(k)
-
- service_dict['extra'] = extra
- return cls(**service_dict)
-
- def to_dict(self):
- extra_copy = self.extra.copy()
- extra_copy['id'] = self.id
- extra_copy['type'] = self.type
- return extra_copy
-
class Endpoint(sql.ModelBase, sql.DictBase):
__tablename__ = 'endpoint'
+ attributes = ['id', 'region', 'service_id']
id = sql.Column(sql.String(64), primary_key=True)
region = sql.Column('region', sql.String(255))
service_id = sql.Column(sql.String(64),
@@ -58,22 +44,6 @@ class Endpoint(sql.ModelBase, sql.DictBase):
nullable=False)
extra = sql.Column(sql.JsonBlob())
- @classmethod
- def from_dict(cls, endpoint_dict):
- extra = {}
- for k, v in endpoint_dict.copy().iteritems():
- if k not in ['id', 'region', 'service_id', 'extra']:
- extra[k] = endpoint_dict.pop(k)
- endpoint_dict['extra'] = extra
- return cls(**endpoint_dict)
-
- def to_dict(self):
- extra_copy = self.extra.copy()
- extra_copy['id'] = self.id
- extra_copy['region'] = self.region
- extra_copy['service_id'] = self.service_id
- return extra_copy
-
class Catalog(sql.Base, catalog.Driver):
def db_sync(self):