protect against void bwlimit
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 3 May 2011 06:17:48 +0000 (08:17 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Tue, 3 May 2011 06:17:48 +0000 (08:17 +0200)
sfa/rspecs/sfa_rspec.py

index 1f997ee..7663e0c 100755 (executable)
@@ -188,12 +188,13 @@ class SfaRSpec(RSpec):
                 hostname_tag = etree.SubElement(node_tag, 'hostname').text = node['hostname']
             if 'interfaces' in node:
                 for interface in node['interfaces']:
-                    if 'bwlimit' in interface:
+                    if 'bwlimit' in interface and interface['bwlimit']:
                         bwlimit = etree.SubElement(node_tag, 'bwlimit', units='kbps').tet = str(interface['bwlimit']/1000)
             if 'tags' in node:
                 for tag in node['tags']:
                    if tag['tagname'] in ['fcdistro', 'arch']:
                         tag_element = etree.SubElement(node_tag, tag['tagname'], value=tag['value'])           
+
     def add_interfaces(self, interfaces):
         pass