From b4455605f4ff99633be9144d2e206649b0faf1e9 Mon Sep 17 00:00:00 2001 From: Boden R Date: Thu, 25 May 2017 14:11:02 -0600 Subject: [PATCH] use attribute functions/operations from neutron-lib neutron-lib now contains the functionality from neutron's attributes module. This patch moves the local references over to neturon-lib's implementation. Change-Id: I39c26b85f914f8310f2090c39a0a435300de995a --- vmware_nsx/api_replay/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/vmware_nsx/api_replay/utils.py b/vmware_nsx/api_replay/utils.py index 0c915d8fa5..e243d5f73f 100644 --- a/vmware_nsx/api_replay/utils.py +++ b/vmware_nsx/api_replay/utils.py @@ -15,6 +15,7 @@ from neutron.api.v2 import attributes +from neutron_lib.api import attributes as lib_attrs from oslo_config import cfg from oslo_utils import uuidutils import webob.exc @@ -27,15 +28,16 @@ def _fixup_res_dict(context, attr_name, res_dict, check_allow_post=True): if cfg.CONF.api_replay_mode and 'id' not in res_dict: res_dict['id'] = uuidutils.generate_uuid() attr_info = attributes.RESOURCE_ATTRIBUTE_MAP[attr_name] + attr_ops = lib_attrs.AttributeInfo(attr_info) try: - attributes.populate_tenant_id(context, res_dict, attr_info, True) - attributes.verify_attributes(res_dict, attr_info) + attr_ops.populate_project_id(context, res_dict, True) + attributes.populate_project_info(attr_info) + attr_ops.verify_attributes(res_dict) except webob.exc.HTTPBadRequest as e: # convert webob exception into ValueError as these functions are # for internal use. webob exception doesn't make sense. raise ValueError(e.detail) - attributes.fill_default_value(attr_info, res_dict, - check_allow_post=check_allow_post) - attributes.convert_value(attr_info, res_dict) + attr_ops.fill_post_defaults(res_dict, check_allow_post=check_allow_post) + attr_ops.convert_values(res_dict) return res_dict