From: Tony Mack Date: Fri, 11 Nov 2011 06:14:26 +0000 (-0500) Subject: fix bug X-Git-Tag: sfa-1.1-3~30 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=efca608fa1ee689f80af5f546f12fca076a94b95;p=sfa.git fix bug --- diff --git a/sfa/rspecs/elements/bwlimit.py b/sfa/rspecs/elements/bwlimit.py index 027bb5b3..6f75161c 100644 --- a/sfa/rspecs/elements/bwlimit.py +++ b/sfa/rspecs/elements/bwlimit.py @@ -1,8 +1,8 @@ from sfa.rspecs.elements.element import Element class BWlimit(Element): - fields = { - 'units': None, - 'value': None, - } + fields = [ + 'units', + 'value', + ] diff --git a/sfa/rspecs/elements/element.py b/sfa/rspecs/elements/element.py index abfb7fcc..63bf4d4a 100644 --- a/sfa/rspecs/elements/element.py +++ b/sfa/rspecs/elements/element.py @@ -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: diff --git a/sfa/rspecs/elements/execute.py b/sfa/rspecs/elements/execute.py index 43e6e626..e7ee7067 100644 --- a/sfa/rspecs/elements/execute.py +++ b/sfa/rspecs/elements/execute.py @@ -1,7 +1,7 @@ from sfa.rspecs.elements.element import Element class Execute(Element): - fields = { - 'shell': None, - 'command': None, - } + fields = [ + 'shell', + 'command', + ] diff --git a/sfa/rspecs/elements/hardware_type.py b/sfa/rspecs/elements/hardware_type.py index 8dd959c2..5f20c9bb 100644 --- a/sfa/rspecs/elements/hardware_type.py +++ b/sfa/rspecs/elements/hardware_type.py @@ -2,6 +2,6 @@ from sfa.rspecs.elements.element import Element class HardwareType(Element): - fields = { - 'name': None, - } + fields = [ + 'name' + ] diff --git a/sfa/rspecs/elements/install.py b/sfa/rspecs/elements/install.py index 1df60b68..227a7972 100644 --- a/sfa/rspecs/elements/install.py +++ b/sfa/rspecs/elements/install.py @@ -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', + ] diff --git a/sfa/rspecs/elements/interface.py b/sfa/rspecs/elements/interface.py index efa61441..11045df8 100644 --- a/sfa/rspecs/elements/interface.py +++ b/sfa/rspecs/elements/interface.py @@ -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', + ] diff --git a/sfa/rspecs/elements/link.py b/sfa/rspecs/elements/link.py index 02a8d102..3bbfe2bb 100644 --- a/sfa/rspecs/elements/link.py +++ b/sfa/rspecs/elements/link.py @@ -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', + ] diff --git a/sfa/rspecs/elements/location.py b/sfa/rspecs/elements/location.py index a5a92603..57bfe0c1 100644 --- a/sfa/rspecs/elements/location.py +++ b/sfa/rspecs/elements/location.py @@ -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', + ] diff --git a/sfa/rspecs/elements/login.py b/sfa/rspecs/elements/login.py index a64c7598..ae42641b 100644 --- a/sfa/rspecs/elements/login.py +++ b/sfa/rspecs/elements/login.py @@ -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' + ] diff --git a/sfa/rspecs/elements/node.py b/sfa/rspecs/elements/node.py index f90fff1b..7358ee03 100644 --- a/sfa/rspecs/elements/node.py +++ b/sfa/rspecs/elements/node.py @@ -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', + ] diff --git a/sfa/rspecs/elements/pltag.py b/sfa/rspecs/elements/pltag.py index 77e63f6c..0868a941 100644 --- a/sfa/rspecs/elements/pltag.py +++ b/sfa/rspecs/elements/pltag.py @@ -2,8 +2,8 @@ from sfa.rspecs.elements.element import Element class PLTag(Element): - fields = { - 'tagname': None, - 'value': None, - } + fields = [ + 'tagname', + 'value', + ] diff --git a/sfa/rspecs/elements/property.py b/sfa/rspecs/elements/property.py index 97a1ffcb..472dedeb 100644 --- a/sfa/rspecs/elements/property.py +++ b/sfa/rspecs/elements/property.py @@ -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', + ] diff --git a/sfa/rspecs/elements/services.py b/sfa/rspecs/elements/services.py index a48be27a..df0546d4 100644 --- a/sfa/rspecs/elements/services.py +++ b/sfa/rspecs/elements/services.py @@ -2,9 +2,9 @@ from sfa.rspecs.elements.element import Element class Services(Element): - fields = { - 'install': [], - 'execute': [], - 'login': [], - } + fields = [ + 'install', + 'execute', + 'login', + ] diff --git a/sfa/rspecs/elements/sliver.py b/sfa/rspecs/elements/sliver.py index 94f2990f..8dd65425 100644 --- a/sfa/rspecs/elements/sliver.py +++ b/sfa/rspecs/elements/sliver.py @@ -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', + ] diff --git a/sfa/rspecs/elements/versions/pgv2Services.py b/sfa/rspecs/elements/versions/pgv2Services.py index e0989638..5a7c70fa 100644 --- a/sfa/rspecs/elements/versions/pgv2Services.py +++ b/sfa/rspecs/elements/versions/pgv2Services.py @@ -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)