Added a check for attachment['instance']

The problem, described in the ticket occurs
while you try to attach a volume to instance,
while at the same time terminating the instance(
I've succeeded to reproduce it that way).
As seen from the stack trace - the error comes
after an AJAX call for updating the table rows.
In normal situations with loading the page,
this error should not appear. Anyway, now there
is a check to prevent this error.

Fixes bug 999502

Change-Id: Ifccc2cf724fe14098c74b55e65f8fbdd8c5434dc
This commit is contained in:
Tihomir Trifonov 2012-06-05 18:11:01 +03:00
parent 8fd77f047f
commit 58762cda5a

View File

@ -93,7 +93,8 @@ def get_attachment(volume):
args=(attachment["server_id"],))
# TODO(jake): Make "instance" the instance name
vals = {"url": url,
"name": attachment["instance"].name,
"name": attachment["instance"].name
if "instance" in attachment else None,
"instance": attachment["server_id"],
"dev": attachment["device"]}
attachments.append(link % vals)