git://git.onelab.eu
/
plstackapi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dee21fb
)
return APIException for sliceplus errors instead of valueerror
author
Scott Baker
<smbaker@gmail.com>
Sat, 24 Jan 2015 08:01:29 +0000
(
00:01
-0800)
committer
Scott Baker
<smbaker@gmail.com>
Sat, 24 Jan 2015 08:01:29 +0000
(
00:01
-0800)
planetstack/core/xoslib/objects/sliceplus.py
patch
|
blob
|
history
diff --git
a/planetstack/core/xoslib/objects/sliceplus.py
b/planetstack/core/xoslib/objects/sliceplus.py
index
d3e618d
..
0c66258
100644
(file)
--- a/
planetstack/core/xoslib/objects/sliceplus.py
+++ b/
planetstack/core/xoslib/objects/sliceplus.py
@@
-1,6
+1,7
@@
from core.models import Slice, SlicePrivilege, SliceRole, Sliver, Site, Node, User
from plus import PlusObjectMixin
from operator import itemgetter, attrgetter
from core.models import Slice, SlicePrivilege, SliceRole, Sliver, Site, Node, User
from plus import PlusObjectMixin
from operator import itemgetter, attrgetter
+from rest_framework.exceptions import APIException
class SlicePlus(Slice, PlusObjectMixin):
class Meta:
class SlicePlus(Slice, PlusObjectMixin):
class Meta:
@@
-195,7
+196,7
@@
class SlicePlus(Slice, PlusObjectMixin):
nodes = self.get_node_allocation([site])
if (not nodes):
nodes = self.get_node_allocation([site])
if (not nodes):
- raise
ValueError(
"no nodes in site %s" % site_name)
+ raise
APIException(detail=
"no nodes in site %s" % site_name)
while (len(slivers) < desired_allocation):
# pick the least allocated node
while (len(slivers) < desired_allocation):
# pick the least allocated node
@@
-273,7
+274,7
@@
class SlicePlus(Slice, PlusObjectMixin):
# uh oh, we didn't find a network
# uh oh, we didn't find a network
- raise
ValueError(
"No network was found that ports could be set on")
+ raise
APIException(detail=
"No network was found that ports could be set on")