Added try catch for request_id null

When the request_id is null, there was an exception generated.
Currently setting the deployment to None for the reports
in case the request_id is null

Change-Id: Idde2178d217ac16f1b3e275c730e3fce68ba9f1b
This commit is contained in:
Priyanka Agrawal 2014-05-27 12:31:03 +05:30
parent 8a0f06ac79
commit 655d9acf0a
1 changed files with 4 additions and 1 deletions

View File

@ -95,7 +95,10 @@ def _get_exists(beginning, ending):
def cell_and_compute(instance, launched_at):
usage = InstanceUsage.find(instance, launched_at)[0]
deployment = usage.latest_deployment_for_request_id()
try:
deployment = usage.latest_deployment_for_request_id()
except IndexError:
deployment = None
cell = (deployment and deployment.name) or '-'
compute = usage.host() or '-'
return cell, compute