From 9a389194fb1a002dbce16d4a1bec9b654a95b04a Mon Sep 17 00:00:00 2001 From: Bharath Thiruveedula Date: Tue, 6 Oct 2015 17:03:38 +0530 Subject: [PATCH] Limit description length in vnfd-list Change-Id: I2d8ce85edeca1a76525e8bb2c9cb20f2ff913539 Closes-Bug: #1501482 --- tackerclient/v1_0/client.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tackerclient/v1_0/client.py b/tackerclient/v1_0/client.py index d590859c..13beb850 100644 --- a/tackerclient/v1_0/client.py +++ b/tackerclient/v1_0/client.py @@ -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):