Defect fix for Shipyard Client list/get API

Fixing issues with shipyard api client to check if
the instance is a list or a dictionary.

Change-Id: I5fe26dc1a6fd67ff6edfeb8314bb976e2d2125f9
This commit is contained in:
Pradeep Kumar 2018-12-11 12:28:12 -06:00 committed by Pradeep Kumar
parent 7d1b41e644
commit 312300d8bf
4 changed files with 21 additions and 6 deletions

View File

@ -37,6 +37,9 @@ class ActionsClient(rest_client.RestClient):
resp, body = self.get('actions')
self.expected_success(200, resp.status)
body = json.loads(body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def create_action(self, action=None):

View File

@ -30,6 +30,9 @@ class AirflowMonitoringClient(rest_client.RestClient):
resp, body = self.get('workflows')
self.expected_success(200, resp.status)
body = json.loads(body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def get_workflow(self, workflow_id=None):

View File

@ -37,6 +37,9 @@ class DocumentStagingClient(rest_client.RestClient):
resp, body = self.get('configdocs')
self.expected_success(200, resp.status)
body = json.loads(body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def create_configdocs(self, collection_id=None):
@ -52,12 +55,18 @@ class DocumentStagingClient(rest_client.RestClient):
resp, body = self.get('configdocs/%s' % collection_id)
self.expected_success(200, resp.status)
body = json.loads(body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def get_renderedconfigdocs(self):
resp, body = self.get('renderedconfigdocs')
self.expected_success(200, resp.status)
body = json.loads(body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def commit_configdocs(self, force=False, dryrun=False):

View File

@ -31,4 +31,4 @@ class LogRetrievalClient(rest_client.RestClient):
self.get('actions/%s/steps/%s/logs' % (action_id, step_id))
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
return rest_client.ResponseBodyData(resp, body)