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,7 +37,10 @@ class ActionsClient(rest_client.RestClient):
resp, body = self.get('actions')
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, body)
if isinstance(body, list):
return rest_client.ResponseBodyList(resp, body)
else:
return rest_client.ResponseBody(resp, body)
def create_action(self, action=None):
url = 'actions'

View File

@ -30,7 +30,10 @@ class AirflowMonitoringClient(rest_client.RestClient):
resp, body = self.get('workflows')
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, 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):
resp, body = self.get('workflows/%s' % workflow_id)

View File

@ -37,7 +37,10 @@ class DocumentStagingClient(rest_client.RestClient):
resp, body = self.get('configdocs')
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, 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):
url = "configdocs/%s" % collection_id
@ -52,13 +55,19 @@ class DocumentStagingClient(rest_client.RestClient):
resp, body = self.get('configdocs/%s' % collection_id)
self.expected_success(200, resp.status)
body = json.loads(body)
return rest_client.ResponseBody(resp, 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)
return rest_client.ResponseBody(resp, 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):
post_body = json.dumps({"force": force, "dryrun": dryrun})

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)