git://git.onelab.eu
/
sfa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ad80230
)
guard lookupSliceTag calls. as we ignore some tag types now maybe it's better not...
author
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Tue, 7 Sep 2010 14:26:07 +0000
(14:26 +0000)
committer
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Tue, 7 Sep 2010 14:26:07 +0000
(14:26 +0000)
sfa/plc/network.py
patch
|
blob
|
history
diff --git
a/sfa/plc/network.py
b/sfa/plc/network.py
index
04daa50
..
d20969a
100644
(file)
--- a/
sfa/plc/network.py
+++ b/
sfa/plc/network.py
@@
-125,21
+125,31
@@
class Slice:
def get_multi_tag(self, tagname, node = None):
tags = []
for i in self.slice_tag_ids:
def get_multi_tag(self, tagname, node = None):
tags = []
for i in self.slice_tag_ids:
- tag = self.network.lookupSliceTag(i)
- if tag.tagname == tagname:
- if not (node and node.id != tag.node_id):
- tags.append(tag)
+ try:
+ tag = self.network.lookupSliceTag(i)
+ if tag.tagname == tagname:
+ if not (node and node.id != tag.node_id):
+ tags.append(tag)
+ except InvalidRSpec, e:
+ # As they're not needed, we ignore some tag types from
+ # GetSliceTags call. See Slicetag.ignore_tags
+ pass
return tags
"""
Use with tags that have only one instance
"""
def get_tag(self, tagname, node = None):
return tags
"""
Use with tags that have only one instance
"""
def get_tag(self, tagname, node = None):
- for i in self.slice_tag_ids:
- tag = self.network.lookupSliceTag(i)
- if tag.tagname == tagname:
- if (not node) or (node.id == tag.node_id):
- return tag
+ try:
+ for i in self.slice_tag_ids:
+ tag = self.network.lookupSliceTag(i)
+ if tag.tagname == tagname:
+ if (not node) or (node.id == tag.node_id):
+ return tag
+ except InvalidRSpec, e:
+ # As they're not needed, we ignore some tag types from
+ # GetSliceTags call. See Slicetag.ignore_tags
+ pass
return None
def get_nodes(self):
return None
def get_nodes(self):
@@
-265,6
+275,8
@@
class Slicetag:
class TagType:
class TagType:
+ ignore_tags = ['hmac','ssh_key']
+
def __init__(self, tagtype):
self.id = tagtype['tag_type_id']
self.category = tagtype['category']
def __init__(self, tagtype):
self.id = tagtype['tag_type_id']
self.category = tagtype['category']
@@
-551,7
+563,7
@@
class Network:
Create a list of tagtype obects keyed by tag name
"""
tmp = []
Create a list of tagtype obects keyed by tag name
"""
tmp = []
- for tag in api.plshell.GetTagTypes(self.user_plauth):
+ for tag in api.plshell.GetTagTypes(self.user_plauth
, {'~tagname':TagType.ignore_tags}
):
t = tag['tagname'], TagType(tag)
tmp.append(t)
return dict(tmp)
t = tag['tagname'], TagType(tag)
tmp.append(t)
return dict(tmp)