Add client side support for error_reason

Change-Id: I9bb58c5648f62a4b8eacc2d5b48ff95869cc8ae8
Partial-Bug: #1524214
Depends-On: I4897e7e4ebdb8c887fb9882e693e5b3d3f4664e5
This commit is contained in:
Bharath Thiruveedula
2015-12-11 15:32:26 +05:30
parent 05ac550251
commit fc363ee49a
2 changed files with 11 additions and 2 deletions

View File

@@ -26,7 +26,7 @@ class ListVNF(tackerV10.ListCommand):
resource = _VNF
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status',
'vim_id', 'placement_attr']
'vim_id', 'placement_attr', 'error_reason']
class ShowVNF(tackerV10.ShowCommand):

View File

@@ -30,6 +30,7 @@ from tackerclient.i18n import _
_logger = logging.getLogger(__name__)
DEFAULT_DESC_LENGTH = 25
DEFAULT_ERROR_REASON_LENGTH = 100
def exception_handler_v10(status_code, error_content):
@@ -390,7 +391,15 @@ class Client(ClientBase):
@APIParamsCall
def list_vnfs(self, retrieve_all=True, **_params):
return self.list('vnfs', self.vnfs_path, retrieve_all, **_params)
vnfs = self.list('vnfs', self.vnfs_path, retrieve_all, **_params)
for vnf in vnfs['vnfs']:
error_reason = vnf.get('error_reason', None)
if error_reason and \
len(error_reason) > DEFAULT_ERROR_REASON_LENGTH:
vnf['error_reason'] = error_reason[
:DEFAULT_ERROR_REASON_LENGTH]
vnf['error_reason'] += '...'
return vnfs
@APIParamsCall
def show_vnf(self, vnf, **_params):