fix value of 'component_manager_id' node attribute in PG RSpec
[sfa.git] / sfa / rspecs / pg_rspec.py
index bc8d19f..57381b4 100755 (executable)
@@ -9,10 +9,7 @@ from sfa.util.config import Config
 
 class PGRSpec(RSpec):
     header = '<?xml version="1.0"?>\n'
-    template = """
-<rspec xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.protogeni.net/resources/rspec/0.2" xsi:schemaLocation="http://www.protogeni.net/resources/rspec/0.2 http://www.protogeni.net/resources/rspec/0.2/ad.xsd">\n
-</rspec>
-"""
+    template = """<rspec xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.protogeni.net/resources/rspec/0.2" xsi:schemaLocation="http://www.protogeni.net/resources/rspec/0.2 http://www.protogeni.net/resources/rspec/0.2/ad.xsd"></rspec>"""
     namespaces = {'rspecv2':'http://www.protogeni.net/resources/rspec/0.2',
                   'xsi': 'http://www.w3.org/2001/XMLSchema-instance'
                  }
@@ -59,8 +56,8 @@ class PGRSpec(RSpec):
                 continue
                 
             node_tag = etree.SubElement(self.xml, 'node')
-            if 'network' in node:
-                node_tag.set('component_manager_id', network)
+            if 'network_urn' in node:
+                node_tag.set('component_manager_id', node['network_urn'])
             if 'urn' in node:
                 node_tag.set('component_id', node['urn'])
             if 'hostname' in node:
@@ -71,9 +68,9 @@ class PGRSpec(RSpec):
             location_tag = etree.SubElement(node_tag, 'location', location="US")
             if 'site' in node:
                 if 'longitude' in node['site']:
-                    location_tag.set('longitude', site['longitude'])
+                    location_tag.set('longitude', str(node['site']['longitude']))
                 if 'latitude' in node['site']:
-                    location_tag.set('latitude', site['latitude'])
+                    location_tag.set('latitude', str(node['site']['latitude']))
             #if 'interfaces' in node: