Limit description length in vnfd-list

Change-Id: I2d8ce85edeca1a76525e8bb2c9cb20f2ff913539
Closes-Bug: #1501482
This commit is contained in:
Bharath Thiruveedula 2015-10-06 17:03:38 +05:30
parent 27c0176640
commit 9a389194fb

View File

@ -30,6 +30,7 @@ from tackerclient.i18n import _
_logger = logging.getLogger(__name__)
DEFAULT_DESC_LENGTH = 25
def exception_handler_v10(status_code, error_content):
@ -411,10 +412,15 @@ class Client(ClientBase):
@APIParamsCall
def list_vnfds(self, retrieve_all=True, **_params):
return self.list(self._VNFD + 's',
self.vnfds_path,
retrieve_all,
**_params)
vnfds_dict = self.list(self._VNFD + 's',
self.vnfds_path,
retrieve_all,
**_params)
for vnfd in vnfds_dict['vnfds']:
if len(vnfd['description']) > DEFAULT_DESC_LENGTH:
vnfd['description'] = vnfd['description'][:DEFAULT_DESC_LENGTH]
vnfd['description'] += '...'
return vnfds_dict
@APIParamsCall
def show_vnfd(self, vnfd, **_params):