fix bug
authorTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 11 Nov 2011 06:14:26 +0000 (01:14 -0500)
committerTony Mack <tmack@paris.CS.Princeton.EDU>
Fri, 11 Nov 2011 06:14:26 +0000 (01:14 -0500)
15 files changed:
sfa/rspecs/elements/bwlimit.py
sfa/rspecs/elements/element.py
sfa/rspecs/elements/execute.py
sfa/rspecs/elements/hardware_type.py
sfa/rspecs/elements/install.py
sfa/rspecs/elements/interface.py
sfa/rspecs/elements/link.py
sfa/rspecs/elements/location.py
sfa/rspecs/elements/login.py
sfa/rspecs/elements/node.py
sfa/rspecs/elements/pltag.py
sfa/rspecs/elements/property.py
sfa/rspecs/elements/services.py
sfa/rspecs/elements/sliver.py
sfa/rspecs/elements/versions/pgv2Services.py

index 027bb5b..6f75161 100644 (file)
@@ -1,8 +1,8 @@
 from sfa.rspecs.elements.element import Element
 
 class BWlimit(Element):
-    fields = { 
-        'units': None,
-        'value': None,
-    }
+    fields = [ 
+        'units',
+        'value',
+    ]
         
index abfb7fc..63bf4d4 100644 (file)
@@ -4,7 +4,7 @@ class Element(dict):
 
     def __init__(self, fields={}, element=None, keys=None):
         self.element = element
-        dict.__init__(self, self.fields)
+        dict.__init__(self, dict.fromkeys(self.fields))
         if not keys:
             keys = fields.keys()
         for key in keys:
index 43e6e62..e7ee706 100644 (file)
@@ -1,7 +1,7 @@
 from sfa.rspecs.elements.element import Element
 
 class Execute(Element):
-    fields = {
-        'shell': None,
-        'command': None,
-    }
+    fields = [
+        'shell',
+        'command',
+    ]
index 8dd959c..5f20c9b 100644 (file)
@@ -2,6 +2,6 @@ from sfa.rspecs.elements.element import Element
 
 class HardwareType(Element):
     
-    fields = {
-        'name': None,
-    }        
+    fields = [
+        'name'
+    ]        
index 1df60b6..227a797 100644 (file)
@@ -1,8 +1,8 @@
 from sfa.rspecs.elements.element import Element
  
 class Install(Element):
-    fields = {
-        'file_type': None,
-        'url': None,
-        'install_path': None,
-    }
+    fields = [
+        'file_type',
+        'url',
+        'install_path',
+    ]
index efa6144..11045df 100644 (file)
@@ -1,12 +1,12 @@
 from sfa.rspecs.elements.element import Element
 
 class Interface(Element):
-    fields = {'component_id': None,
-              'role': None,
-              'client_id': None,
-              'ipv4': None,
-              'bwlimit': None,
-              'node_id': None,
-              'interface_id': None,
-              'mac_address': None,  
-    }    
+    fields = ['component_id',
+              'role',
+              'client_id',
+              'ipv4',
+              'bwlimit',
+              'node_id',
+              'interface_id',
+              'mac_address',  
+    ]    
index 02a8d10..3bbfe2b 100644 (file)
@@ -1,16 +1,16 @@
 from sfa.rspecs.elements.element import Element    
 
 class Link(Element):
-    fields = {
-        'client_id': None
-        'component_id': None,
-        'component_name': None,
-        'component_manager': None,
-        'type': None,
-        'interface1': None,
-        'interface2': None,
-        'capacity': None,
-        'latency': None,
-        'packet_loss': None,
-        'description': None,
-    }
+    fields = [
+        'client_id', 
+        'component_id',
+        'component_name',
+        'component_manager',
+        'type',
+        'interface1',
+        'interface2',
+        'capacity',
+        'latency',
+        'packet_loss',
+        'description',
+    ]
index a5a9260..57bfe0c 100644 (file)
@@ -2,8 +2,8 @@ from sfa.rspecs.elements.element import Element
 
 class Location(Element):
     
-    fields = {
-        'country': None,
-        'longitude': None,
-        'latitude': None,
-    }
+    fields = [
+        'country',
+        'longitude',
+        'latitude',
+    ]
index a64c759..ae42641 100644 (file)
@@ -1,8 +1,8 @@
 from sfa.rspecs.elements.element import Element
 
 class Login(Element):
-    fields = {
-        'authentication': None,
-        'hostname': None,
-        'port': None
-    }
+    fields = [
+        'authentication',
+        'hostname',
+        'port'
+    ]
index f90fff1..7358ee0 100644 (file)
@@ -2,25 +2,25 @@ from sfa.rspecs.elements.element import Element
  
 class Node(Element):
     
-    fields = {
-        'component_id': None,
-        'component_name': None,
-        'component_manager_id': None,
-        'client_id': None,
-        'sliver_id': None,
-        'authority_id': None,    
-        'exclusive': None,
-        'location': None,
-        'bw_unallocated': None,
-        'bw_limit': None,
-        'boot_state': None,    
-        'slivers': [],
-        'hardware_types': [],
-        'disk_images': [],
-        'interfaces': [],
-        'services': [],
-        'tags': [],
-        'pl_initscripts': [],
-    }
+    fields = [
+        'component_id',
+        'component_name',
+        'component_manager_id',
+        'client_id',
+        'sliver_id',
+        'authority_id',    
+        'exclusive',
+        'location',
+        'bw_unallocated',
+        'bw_limit',
+        'boot_state',    
+        'slivers',
+        'hardware_types',
+        'disk_images',
+        'interfaces',
+        'services',
+        'tags',
+        'pl_initscripts',
+    ]
                 
       
index 77e63f6..0868a94 100644 (file)
@@ -2,8 +2,8 @@ from sfa.rspecs.elements.element import Element
 
 class PLTag(Element):
 
-    fields = {
-        'tagname': None,
-        'value': None,
-    }
+    fields = [
+        'tagname',
+        'value',
+    ]
         
index 97a1ffc..472dede 100644 (file)
@@ -2,11 +2,11 @@ from sfa.rspecs.elements.element import Element
 
 class Property(Element):
     
-    fields = {
-        'source_id': None,
-        'dest_id': None,
-        'capacity': None,
-        'latency': None,
-        'packet_loss': None,
-    }
+    fields = [
+        'source_id',
+        'dest_id',
+        'capacity',
+        'latency',
+        'packet_loss',
+    ]
        
index a48be27..df0546d 100644 (file)
@@ -2,9 +2,9 @@ from sfa.rspecs.elements.element import Element
 
 class Services(Element):
 
-    fields = {
-        'install': [],
-        'execute': [],
-        'login': [],
-    }
+    fields = [
+        'install',
+        'execute',
+        'login',
+    ]
 
index 94f2990..8dd6542 100644 (file)
@@ -1,11 +1,11 @@
 from sfa.rspecs.elements.element import Element
 
 class Sliver(Element):
-    fields = {
-        'sliver_id': None,
-        'component_id': None,
-        'client_id': None,
-        'name': None,
-        'type': None,
-        'tags': [],
-    }
+    fields = [
+        'sliver_id',
+        'component_id',
+        'client_id',
+        'name',
+        'type',
+        'tags',
+    ]
index e098963..5a7c70f 100644 (file)
@@ -7,7 +7,7 @@ class PGv2Services:
     @staticmethod
     def add_services(xml, services):
         for service in services:
-            service_elem = xml.add_element('service')
+            service_elem = xml.add_element('services')
             Element.add_elements(service_elem, 'install', service.get('install', []), Install.fields) 
             Element.add_elements(service_elem, 'execute', service.get('execute', []), Execute.fields) 
             Element.add_elements(service_elem, 'login', service.get('login', []), Login.fields)