]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Add missing tenant_id validation in RESOURCE_ATTRIBUTE_MAP
authorYalei Wang <yalei.wang@intel.com>
Wed, 19 Aug 2015 16:09:04 +0000 (00:09 +0800)
committerYalei Wang <yalei.wang@intel.com>
Thu, 20 Aug 2015 08:59:55 +0000 (16:59 +0800)
This patch will add the validation for tenant_id of 255 bytes string.

Change-Id: Iaa8f78d2b70693d3365a41834d29e0f12ad3dd36
Closes-Bug: #1486314

neutron/api/v2/attributes.py
neutron/extensions/metering.py
neutron/extensions/securitygroup.py

index ff0165be431c9ead91b5a5d89d9d2c1dcb7cc1d9..a89810a9e30d0e6d22344834c626410bf7db37f0 100644 (file)
@@ -825,7 +825,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                  'is_visible': True},
         'tenant_id': {'allow_post': True,
                       'allow_put': False,
-                      'validate': {'type:string': None},
+                      'validate': {'type:string': TENANT_ID_MAX_LEN},
                       'required_by_policy': True,
                       'is_visible': True},
         'prefixes': {'allow_post': True,
index 82a24ae7b886740c4ea48c42dd5f6d9dde85ced5..22d67b5e09825214de45912ca290237b09c08166 100644 (file)
@@ -55,6 +55,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                         'is_visible': True, 'default': ''},
         'tenant_id': {'allow_post': True, 'allow_put': False,
                       'required_by_policy': True,
+                      'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
                       'is_visible': True},
         'shared': {'allow_post': True, 'allow_put': False,
                    'is_visible': True, 'default': False,
@@ -78,6 +79,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                              'validate': {'type:subnet': None}},
         'tenant_id': {'allow_post': True, 'allow_put': False,
                       'required_by_policy': True,
+                      'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
                       'is_visible': True}
     }
 }
index f199f12025ab4e768a65f1b03715605485f3c15b..5e32036edb848007a265e8066d6367e40542bbd4 100644 (file)
@@ -217,6 +217,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                         'is_visible': True, 'default': ''},
         'tenant_id': {'allow_post': True, 'allow_put': False,
                       'required_by_policy': True,
+                      'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
                       'is_visible': True},
         'security_group_rules': {'allow_post': False, 'allow_put': False,
                                  'is_visible': True},
@@ -251,6 +252,7 @@ RESOURCE_ATTRIBUTE_MAP = {
                              'convert_to': convert_ip_prefix_to_cidr},
         'tenant_id': {'allow_post': True, 'allow_put': False,
                       'required_by_policy': True,
+                      'validate': {'type:string': attr.TENANT_ID_MAX_LEN},
                       'is_visible': True},
     }
 }