Fix the bug of create a resource when use long name

When use tacker create a resource like 'vnffgd-create, vnffg-create,
vnfd-create' .etc. with long name, the server will response a
"internal server error". So we set the NAME_MAX_LEN for resource
name in the "RESOURCE_ATTRIBUTE_MAP".

Change-Id: I3217dec158fdaba415e712f4e4a10468ad2f8ab5
closes-Bug: #1734010
This commit is contained in:
lizhouzhou
2017-11-23 10:19:07 +08:00
parent c7f78ac943
commit 2bb4201173
2 changed files with 9 additions and 7 deletions
+6 -5
View File
@@ -247,6 +247,7 @@ class NSInUse(exceptions.InUse):
class NoTasksException(exceptions.TackerException):
message = _('No tasks to run for %(action)s on %(resource)s')
NAME_MAX_LEN = 255
RESOURCE_ATTRIBUTE_MAP = {
@@ -292,7 +293,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
@@ -357,7 +358,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
@@ -408,7 +409,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
@@ -630,7 +631,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
@@ -685,7 +686,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
+3 -2
View File
@@ -179,6 +179,7 @@ def _validate_service_type_list(data, valid_values=None):
attr.validators['type:service_type_list'] = _validate_service_type_list
NAME_MAX_LEN = 255
RESOURCE_ATTRIBUTE_MAP = {
@@ -200,7 +201,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': None},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {
@@ -276,7 +277,7 @@ RESOURCE_ATTRIBUTE_MAP = {
'name': {
'allow_post': True,
'allow_put': True,
'validate': {'type:string': 255},
'validate': {'type:string': NAME_MAX_LEN},
'is_visible': True,
},
'description': {