Add client side support for error_reason
Change-Id: I9bb58c5648f62a4b8eacc2d5b48ff95869cc8ae8 Partial-Bug: #1524214 Depends-On: I4897e7e4ebdb8c887fb9882e693e5b3d3f4664e5
This commit is contained in:
@@ -26,7 +26,7 @@ class ListVNF(tackerV10.ListCommand):
|
|||||||
|
|
||||||
resource = _VNF
|
resource = _VNF
|
||||||
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status',
|
list_columns = ['id', 'name', 'description', 'mgmt_url', 'status',
|
||||||
'vim_id', 'placement_attr']
|
'vim_id', 'placement_attr', 'error_reason']
|
||||||
|
|
||||||
|
|
||||||
class ShowVNF(tackerV10.ShowCommand):
|
class ShowVNF(tackerV10.ShowCommand):
|
||||||
|
@@ -30,6 +30,7 @@ from tackerclient.i18n import _
|
|||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
DEFAULT_DESC_LENGTH = 25
|
DEFAULT_DESC_LENGTH = 25
|
||||||
|
DEFAULT_ERROR_REASON_LENGTH = 100
|
||||||
|
|
||||||
|
|
||||||
def exception_handler_v10(status_code, error_content):
|
def exception_handler_v10(status_code, error_content):
|
||||||
@@ -390,7 +391,15 @@ class Client(ClientBase):
|
|||||||
|
|
||||||
@APIParamsCall
|
@APIParamsCall
|
||||||
def list_vnfs(self, retrieve_all=True, **_params):
|
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
|
@APIParamsCall
|
||||||
def show_vnf(self, vnf, **_params):
|
def show_vnf(self, vnf, **_params):
|
||||||
|
Reference in New Issue
Block a user