Revision 5231a38a api/util.py
b/api/util.py | ||
---|---|---|
19 | 19 |
from django.template.loader import render_to_string |
20 | 20 |
from django.utils import simplejson as json |
21 | 21 |
|
22 |
from synnefo.api.faults import Fault, BadRequest, ItemNotFound, ServiceUnavailable, Unauthorized |
|
22 |
from synnefo.api.faults import (Fault, BadRequest, BuildInProgress, ItemNotFound, |
|
23 |
ServiceUnavailable, Unauthorized) |
|
23 | 24 |
from synnefo.db.models import (SynnefoUser, Flavor, Image, ImageMetadata, |
24 | 25 |
VirtualMachine, VirtualMachineMetadata) |
25 | 26 |
|
... | ... | |
214 | 215 |
resp = func(request, *args, **kwargs) |
215 | 216 |
update_response_headers(request, resp) |
216 | 217 |
return resp |
217 |
|
|
218 |
except VirtualMachine.DeletedError: |
|
219 |
fault = BadRequest('Server has been deleted.') |
|
220 |
return render_fault(request, fault) |
|
221 |
except VirtualMachine.BuildingError: |
|
222 |
fault = BuildInProgress('Server is being built.') |
|
223 |
return render_fault(request, fault) |
|
218 | 224 |
except Fault, fault: |
219 | 225 |
return render_fault(request, fault) |
220 | 226 |
except BaseException, e: |
Also available in: Unified diff