Commit 1804a9df authored by Zuul's avatar Zuul Committed by Gerrit Code Review

Merge "Migrate object to OVO (7)"

parents 989cc2b2 b215bf69
......@@ -152,8 +152,7 @@ class Audit(NotificationPlugin):
changes = []
for arg in arglist:
if isinstance(arg, (objects.DesignateObject,
objects.OVODesignateObject)):
if isinstance(arg, objects.DesignateObject):
for change in arg.obj_what_changed():
if change != 'records':
old_value = arg.obj_get_original_value(change)
......
......@@ -13,13 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects.base import DesignateObject # noqa
from designate.objects.ovo_base import DesignateObject as OVODesignateObject # noqa
from designate.objects.base import ListObjectMixin # noqa
from designate.objects.ovo_base import ListObjectMixin as OVOListObjectMixin # noqa
from designate.objects.base import DictObjectMixin # noqa
from designate.objects.ovo_base import DictObjectMixin as OVODictObjectMixin # noqa
from designate.objects.base import PagedListObjectMixin # noqa
from designate.objects.ovo_base import PagedListObjectMixin as OVOPagedListObjectMixin # noqa
from designate.objects.blacklist import Blacklist, BlacklistList # noqa
from designate.objects.zone import Zone, ZoneList # noqa
from designate.objects.zone_attribute import ZoneAttribute, ZoneAttributeList # noqa
......
......@@ -15,8 +15,7 @@ from six.moves.urllib import parse
from oslo_config import cfg
from designate.objects.adapters import base
from designate.objects import base as obj_base
from designate.objects import ovo_base as ovoobj_base
from designate.objects import base as ovoobj_base
from designate import exceptions
......@@ -45,8 +44,7 @@ class APIv2Adapter(base.DesignateAdapter):
r_list['links'] = cls._get_collection_links(
list_object, kwargs['request'])
# Check if we should include metadata
if isinstance(list_object, (obj_base.PagedListObjectMixin,
ovoobj_base.PagedListObjectMixin)):
if isinstance(list_object, ovoobj_base.PagedListObjectMixin):
metadata = {}
if list_object.total_count is not None:
metadata['total_count'] = list_object.total_count
......
......@@ -78,8 +78,7 @@ class ValidationErrorAPIv2Adapter(base.APIv2Adapter):
# Check if the object is a list - lists will just have an index as a
# value, ands this can't be renamed
if issubclass(obj_adapter.ADAPTER_OBJECT,
(objects.ListObjectMixin, objects.OVOListObjectMixin)):
if issubclass(obj_adapter.ADAPTER_OBJECT, objects.ListObjectMixin):
obj_adapter = cls.get_object_adapter(
cls.ADAPTER_FORMAT,
obj_adapter.ADAPTER_OBJECT.LIST_ITEM_TYPE.obj_name())
......@@ -110,7 +109,7 @@ class ValidationErrorAPIv2Adapter(base.APIv2Adapter):
obj_adapter = cls.get_object_adapter(
cls.ADAPTER_FORMAT, obj_cls)
object = objects.OVODesignateObject.obj_cls_from_name(obj_cls)() # noqa
object = objects.DesignateObject.obj_cls_from_name(obj_cls)() # noqa
# Recurse down into this object
path_segment, obj_adapter = cls._rename_path_segment(
obj_adapter, object, path_segment)
......
......@@ -60,8 +60,7 @@ class DesignateAdapter(object):
@classmethod
def get_object_adapter(cls, format_, object):
if isinstance(object, (objects.DesignateObject,
objects.OVODesignateObject)):
if isinstance(object, objects.DesignateObject):
key = '%s:%s' % (format_, object.obj_name())
else:
key = '%s:%s' % (format_, object)
......@@ -82,8 +81,7 @@ class DesignateAdapter(object):
@classmethod
def render(cls, format_, object, *args, **kwargs):
if isinstance(object, (objects.ListObjectMixin,
objects.OVOListObjectMixin)):
if isinstance(object, objects.ListObjectMixin):
# type_ = 'list'
return cls.get_object_adapter(
format_, object)._render_list(object, *args, **kwargs)
......@@ -177,8 +175,7 @@ class DesignateAdapter(object):
LOG.debug(output_object)
try:
if isinstance(output_object, (objects.ListObjectMixin,
objects.OVOListObjectMixin)):
if isinstance(output_object, objects.ListObjectMixin):
# type_ = 'list'
return cls.get_object_adapter(
format_,
......@@ -260,7 +257,7 @@ class DesignateAdapter(object):
check_field, 'objname'):
# (daidv): Check if field is OVO field and have a relation
obj_class_name = output_object.FIELDS.get(obj_key).objname
obj_class = objects.OVODesignateObject.obj_cls_from_name(
obj_class = objects.DesignateObject.obj_cls_from_name(
obj_class_name)
obj = cls.get_object_adapter(
cls.ADAPTER_FORMAT, obj_class_name).parse(
......
This diff is collapsed.
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -165,8 +165,18 @@ class IPV4AndV6AddressField(ovoo_fields.IPV4AndV6AddressField):
return str(value)
class EnumField(ovoo_fields.EnumField):
pass
class Enum(ovoo_fields.Enum):
def get_schema(self):
return {
'enum': self._valid_values,
'type': 'any'
}
class EnumField(ovoo_fields.BaseEnumField):
def __init__(self, valid_values, **kwargs):
self.AUTO_TYPE = Enum(valid_values=valid_values)
super(EnumField, self).__init__(**kwargs)
class DomainField(StringFields):
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
This diff is collapsed.
......@@ -14,7 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from designate import utils
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -22,7 +22,7 @@ from oslo_versionedobjects import exception as ovo_exc
from designate import exceptions
from designate import utils
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
from designate.objects.validation_error import ValidationError
from designate.objects.validation_error import ValidationErrorList
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -14,7 +14,7 @@
# under the License.
from designate.objects.record import Record
from designate.objects.record import RecordList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -11,7 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -12,7 +12,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -11,7 +11,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -16,7 +16,7 @@ from designate import utils
from designate import exceptions
from designate.objects.validation_error import ValidationError
from designate.objects.validation_error import ValidationErrorList
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -16,7 +16,7 @@
from oslo_versionedobjects import base as ovoo_base
from designate import utils
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -13,7 +13,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from designate.objects import ovo_base as base
from designate.objects import base
from designate.objects import fields
......
......@@ -131,10 +131,7 @@ class DesignateObjectSerializer(messaging.NoOpSerializer):
def deserialize_entity(self, context, entity):
if isinstance(entity, dict) and 'designate_object.name' in entity:
if 'designate_object.version' in entity:
entity = objects.OVODesignateObject.from_primitive(entity)
else:
entity = objects.DesignateObject.from_primitive(entity)
entity = objects.DesignateObject.from_primitive(entity)
elif isinstance(entity, (tuple, list, set)):
entity = self._process_iterable(context, self.deserialize_entity,
entity)
......
......@@ -21,6 +21,7 @@ import oslotest.base
from oslo_utils import timeutils
from designate import objects
from designate.objects import base
from designate.objects import adapters
......@@ -37,6 +38,7 @@ class DesignateTestAdapter(adapters.DesignateAdapter):
}
@base.DesignateRegistry.register
class DesignateTestPersistentObject(
objects.DesignateObject, objects.base.PersistentObjectMixin):
pass
......
......@@ -37,17 +37,6 @@ def debug(*a, **kw):
LOG.debug("%s: %s", k, repr(kw[k]))
class TestRecordSet(objects.RecordSet):
FIELDS = {
'id': {},
'name': {},
'records': {
'relation': True,
'relation_cls': 'RecordList',
},
}
def create_test_recordset():
rs = objects.RecordSet(
name='www.example.org.',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment