libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1410809 [2/4] - in /libcloud/branches/0.11.x: ./ libcloud/ libcloud/common/ libcloud/compute/ libcloud/compute/drivers/ libcloud/data/ libcloud/dns/ libcloud/dns/drivers/ libcloud/loadbalancer/ libcloud/loadbalancer/drivers/ libcloud/stora...
Date Sun, 18 Nov 2012 01:23:01 GMT
Modified: libcloud/branches/0.11.x/libcloud/compute/types.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/compute/types.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/compute/types.py (original)
+++ libcloud/branches/0.11.x/libcloud/compute/types.py Sun Nov 18 01:22:54 2012
@@ -63,6 +63,7 @@ class Provider(object):
     @cvar CLOUDSIGMA_US: CloudSigma US Las Vegas
     @cvar RACKSPACE_NOVA_BETA: Rackspace Nova Private Beta (ORD)
     @cvar RACKSPACE_NOVA_DFW: Rackspace Nova Private DFW (DFW)
+    @cvar RACKSPACE_NOVA_ORD: Rackspace Nova Private ORD (ORD)
     @cvar RACKSPACE_NOVA_LON: Rackspace Nova Private LON (LON)
     @cvar LIBVIRT: Libvirt driver
     @cvar JOYENT: Joyent driver
@@ -122,6 +123,7 @@ class Provider(object):
     KTUCLOUD = 47
     RACKSPACE_NOVA_LON = 48
     GRIDSPOT = 49
+    RACKSPACE_NOVA_ORD = 50
 
 
 class NodeState(object):

Modified: libcloud/branches/0.11.x/libcloud/data/pricing.json
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/data/pricing.json?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/data/pricing.json (original)
+++ libcloud/branches/0.11.x/libcloud/data/pricing.json Sun Nov 18 01:22:54 2012
@@ -18,6 +18,16 @@
             "8": 1.800
         },
 
+        "rackspacenovaus": {
+            "2": 0.022,
+            "3": 0.060,
+            "4": 0.120,
+            "5": 0.240,
+            "6": 0.480,
+            "7": 0.960,
+            "8": 1.200
+        },
+
         "dreamhost": {
             "minimum": 15,
             "maximum": 200,

Modified: libcloud/branches/0.11.x/libcloud/dns/base.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/base.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/base.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/base.py Sun Nov 18 01:22:54 2012
@@ -19,7 +19,6 @@ __all__ = [
     'DNSDriver'
 ]
 
-
 from libcloud.common.base import ConnectionUserAndKey, BaseDriver
 from libcloud.dns.types import RecordType
 
@@ -133,9 +132,26 @@ class DNSDriver(BaseDriver):
     name = None
     website = None
 
-    def __init__(self, key, secret=None, secure=True, host=None, port=None, **kwargs):
+    def __init__(self, key, secret=None, secure=True, host=None, port=None,
+                 **kwargs):
         """
-        @requires: key, secret
+        @param    key: API key or username to used (required)
+        @type     key: C{str}
+
+        @param    secret: Secret password to be used (required)
+        @type     secret: C{str}
+
+        @param    secure: Weither to use HTTPS or HTTP. Note: Some providers
+                only support HTTPS, and it is on by default.
+        @type     secure: C{bool}
+
+        @param    host: Override hostname used for connections.
+        @type     host: C{str}
+
+        @param    port: Override port used for connections.
+        @type     port: C{int}
+
+        @rtype: C{None}
         """
         super(DNSDriver, self).__init__(key=key, secret=secret, secure=secure,
                                         host=host, port=port, **kwargs)
@@ -144,7 +160,7 @@ class DNSDriver(BaseDriver):
         """
         Return a list of RecordType objects supported by the provider.
 
-        @return: A list of C{RecordType} instances.
+        @rtype: C{list} of L{RecordType}
         """
         return list(self.RECORD_TYPE_MAP.keys())
 
@@ -152,7 +168,7 @@ class DNSDriver(BaseDriver):
         """
         Return a list of zones.
 
-        @return: A list of C{Zone} instances.
+        @rtype: C{list} of L{Zone}
         """
         raise NotImplementedError(
             'list_zones not implemented for this driver')
@@ -161,10 +177,10 @@ class DNSDriver(BaseDriver):
         """
         Return a list of records for the provided zone.
 
-        @type zone: C{Zone}
         @param zone: Zone to list records for.
+        @type zone: L{Zone}
 
-        @return: A list of C{Record} instances.
+        @rtype: C{list} of L{Record}
         """
         raise NotImplementedError(
             'list_records not implemented for this driver')
@@ -173,7 +189,10 @@ class DNSDriver(BaseDriver):
         """
         Return a Zone instance.
 
-        @return: C{Zone} instance.
+        @param zone_id: ID of the required zone
+        @type  zone_id: C{str}
+
+        @rtype: L{Zone}
         """
         raise NotImplementedError(
             'get_zone not implemented for this driver')
@@ -182,7 +201,13 @@ class DNSDriver(BaseDriver):
         """
         Return a Record instance.
 
-        @return: C{Record} instance.
+        @param zone_id: ID of the required zone
+        @type  zone_id: C{str}
+
+        @param record_id: ID of the required record
+        @type  record_id: C{str}
+
+        @rtype: L{Record}
         """
         raise NotImplementedError(
             'get_record not implemented for this driver')
@@ -191,17 +216,19 @@ class DNSDriver(BaseDriver):
         """
         Create a new zone.
 
-        @type domain: C{string}
         @param domain: Zone domain name.
+        @type domain: C{str}
 
-        @type type: C{string}
         @param type: Zone type (master / slave).
+        @type  type: C{str}
 
-        @param ttl: C{int}
         @param ttl: (optional) TTL for new records.
+        @type  ttl: C{int}
 
-        @type extra: C{dict}
         @param extra: (optional) Extra attributes (driver specific).
+        @type extra: C{dict}
+
+        @rtype: L{Zone}
         """
         raise NotImplementedError(
             'create_zone not implemented for this driver')
@@ -210,20 +237,22 @@ class DNSDriver(BaseDriver):
         """
         Update en existing zone.
 
-        @type zone: C{Zone}
         @param zone: Zone to update.
+        @type  zone: L{Zone}
 
-        @type domain: C{string}
         @param domain: Zone domain name.
+        @type  domain: C{str}
 
-        @type type: C{string}
         @param type: Zone type (master / slave).
+        @type  type: C{str}
 
-        @param ttl: C{int}
         @param ttl: (optional) TTL for new records.
+        @type  ttl: C{int}
 
-        @type extra: C{dict}
         @param extra: (optional) Extra attributes (driver specific).
+        @type  extra: C{dict}
+
+        @rtype: L{Zone}
         """
         raise NotImplementedError(
             'update_zone not implemented for this driver')
@@ -232,20 +261,22 @@ class DNSDriver(BaseDriver):
         """
         Create a new record.
 
-        @param name: C{string}
-        @type name: Hostname or FQDN.
+        @param name: Hostname or FQDN.
+        @type  name: C{str}
 
-        @type zone: C{Zone}
         @param zone: Zone where the requested record is created.
+        @type  zone: L{Zone}
 
-        @type type: C{RecordType}
         @param type: DNS record type (A, AAAA, ...).
+        @type  type: L{RecordType}
 
-        @type data: C{str}
         @param data: Data for the record (depends on the record type).
+        @type  data: C{str}
 
-        @type extra: C{dict}
         @param extra: (optional) Extra attributes (driver specific).
+        @type extra: C{dict}
+
+        @rtype: L{Record}
         """
         raise NotImplementedError(
             'create_record not implemented for this driver')
@@ -254,20 +285,22 @@ class DNSDriver(BaseDriver):
         """
         Update an existing record.
 
-        @param record: C{Record}
-        @type record: Record to update.
+        @param record: Record to update.
+        @type  record: L{Record}
 
-        @param name: C{string}
-        @type name: Hostname or FQDN.
+        @param name: Hostname or FQDN.
+        @type  name: C{str}
 
-        @type type: C{RecordType}
         @param type: DNS record type (A, AAAA, ...).
+        @type  type: L{RecordType}
 
-        @type data: C{str}
         @param data: Data for the record (depends on the record type).
+        @type  data: C{str}
 
-        @type extra: C{dict}
         @param extra: (optional) Extra attributes (driver specific).
+        @type  extra: C{dict}
+
+        @rtype: L{Record}
         """
         raise NotImplementedError(
             'update_record not implemented for this driver')
@@ -278,8 +311,10 @@ class DNSDriver(BaseDriver):
 
         Note: This will delete all the records belonging to this zone.
 
-        @param zone: C{Zone}
-        @type zone: Zone to delete.
+        @param zone: Zone to delete.
+        @type  zone: L{Zone}
+
+        @rtype: C{bool}
         """
         raise NotImplementedError(
             'delete_zone not implemented for this driver')
@@ -288,8 +323,10 @@ class DNSDriver(BaseDriver):
         """
         Delete a record.
 
-        @param record: C{Record}
-        @type record: Record to delete.
+        @param record: Record to delete.
+        @type  record: L{Record}
+
+        @rtype: C{bool}
         """
         raise NotImplementedError(
             'delete_record not implemented for this driver')

Modified: libcloud/branches/0.11.x/libcloud/dns/drivers/dummy.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/drivers/dummy.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/drivers/dummy.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/drivers/dummy.py Sun Nov 18 01:22:54 2012
@@ -35,7 +35,13 @@ class DummyDNSDriver(DNSDriver):
 
     def __init__(self, api_key, api_secret):
         """
-        @requires: api_key, api_secret
+        @param    api_key:    API key or username to used (required)
+        @type     api_key:    C{str}
+
+        @param    api_secret: Secret password to be used (required)
+        @type     api_secret: C{str}
+
+        @rtype: C{None}
         """
         self._zones = {}
 
@@ -44,6 +50,8 @@ class DummyDNSDriver(DNSDriver):
         >>> driver = DummyDNSDriver('key', 'secret')
         >>> driver.list_record_types()
         [0]
+
+        @inherits: L{DNSDriver.list_record_types}
         """
         return [RecordType.A]
 
@@ -52,6 +60,8 @@ class DummyDNSDriver(DNSDriver):
         >>> driver = DummyDNSDriver('key', 'secret')
         >>> driver.list_zones()
         []
+
+        @inherits: L{DNSDriver.list_zones}
         """
 
         return [zone['zone'] for zone in list(self._zones.values())]
@@ -66,6 +76,8 @@ class DummyDNSDriver(DNSDriver):
         ... #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ZoneDoesNotExistError:
+
+        @inherits: L{DNSDriver.get_zone}
         """
 
         if zone_id not in self._zones:
@@ -81,6 +93,8 @@ class DummyDNSDriver(DNSDriver):
         ... #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ZoneDoesNotExistError:
+
+        @inherits: L{DNSDriver.get_record}
         """
 
         self.get_zone(zone_id=zone_id)
@@ -104,6 +118,8 @@ class DummyDNSDriver(DNSDriver):
         ... #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ZoneAlreadyExistsError:
+
+        @inherits: L{DNSDriver.create_zone}
         """
 
         id = 'id-%s' % (domain)
@@ -114,7 +130,7 @@ class DummyDNSDriver(DNSDriver):
         zone = Zone(id=id, domain=domain, type=type, ttl=ttl, extra={},
                     driver=self)
         self._zones[id] = {'zone': zone,
-                            'records': {}}
+                           'records': {}}
         return zone
 
     def create_record(self, name, zone, type, data, extra=None):
@@ -131,6 +147,8 @@ class DummyDNSDriver(DNSDriver):
         ... #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         RecordAlreadyExistsError:
+
+        @inherits: L{DNSDriver.create_record}
         """
         id = 'id-%s' % (name)
 
@@ -155,6 +173,8 @@ class DummyDNSDriver(DNSDriver):
         >>> driver.delete_zone(zone) #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         ZoneDoesNotExistError:
+
+        @inherits: L{DNSDriver.delete_zone}
         """
         self.get_zone(zone_id=zone.id)
 
@@ -173,6 +193,8 @@ class DummyDNSDriver(DNSDriver):
         >>> driver.delete_record(record) #doctest: +IGNORE_EXCEPTION_DETAIL
         Traceback (most recent call last):
         RecordDoesNotExistError:
+
+        @inherits: L{DNSDriver.delete_record}
         """
         self.get_record(zone_id=record.zone.id, record_id=record.id)
 

Modified: libcloud/branches/0.11.x/libcloud/dns/drivers/linode.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/drivers/linode.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/drivers/linode.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/drivers/linode.py Sun Nov 18 01:22:54 2012
@@ -17,7 +17,6 @@ __all__ = [
     'LinodeDNSDriver'
 ]
 
-
 from libcloud.utils.misc import merge_valid_keys, get_new_obj
 from libcloud.common.linode import (API_ROOT, LinodeException,
                                     LinodeConnection, LinodeResponse)
@@ -41,13 +40,13 @@ class LinodeDNSResponse(LinodeResponse):
 
             if context['resource'] == 'zone':
                 result = ZoneDoesNotExistError(value='',
-                                            driver=self.connection.driver,
-                                            zone_id=context['id'])
+                                               driver=self.connection.driver,
+                                               zone_id=context['id'])
 
             elif context['resource'] == 'record':
                 result = RecordDoesNotExistError(value='',
-                                            driver=self.connection.driver,
-                                            record_id=context['id'])
+                                                 driver=self.connection.driver,
+                                                 record_id=context['id'])
         return result
 
 
@@ -99,7 +98,7 @@ class LinodeDNSDriver(DNSDriver):
     def get_record(self, zone_id, record_id):
         zone = self.get_zone(zone_id=zone_id)
         params = {'api_action': 'domain.resource.list', 'DomainID': zone_id,
-                   'ResourceID': record_id}
+                  'ResourceID': record_id}
         data = self.connection.request(API_ROOT, params=params).objects[0]
         records = self._to_records(items=data, zone=zone)
 
@@ -114,6 +113,8 @@ class LinodeDNSDriver(DNSDriver):
         Create a new zone.
 
         API docs: http://www.linode.com/api/dns/domain.create
+
+        @inherits: C{DNSDriver.create_zone}
         """
         params = {'api_action': 'domain.create', 'Type': type,
                   'Domain': domain}
@@ -134,6 +135,8 @@ class LinodeDNSDriver(DNSDriver):
         Update an existing zone.
 
         API docs: http://www.linode.com/api/dns/domain.update
+
+        @inherits: C{DNSDriver.update_zone}
         """
         params = {'api_action': 'domain.update', 'DomainID': zone.id}
 
@@ -151,9 +154,9 @@ class LinodeDNSDriver(DNSDriver):
                                   extra=extra)
         self.connection.request(API_ROOT, params=params).objects[0]
         updated_zone = get_new_obj(obj=zone, klass=Zone,
-                                  attributes={'domain': domain,
-                                              'type': type, 'ttl': ttl,
-                                              'extra': merged})
+                                   attributes={'domain': domain,
+                                               'type': type, 'ttl': ttl,
+                                               'extra': merged})
         return updated_zone
 
     def create_record(self, name, zone, type, data, extra=None):
@@ -161,6 +164,8 @@ class LinodeDNSDriver(DNSDriver):
         Create a new record.
 
         API docs: http://www.linode.com/api/dns/domain.resource.create
+
+        @inherits: C{DNSDriver.create_record}
         """
         params = {'api_action': 'domain.resource.create', 'DomainID': zone.id,
                   'Name': name, 'Target': data,
@@ -180,6 +185,8 @@ class LinodeDNSDriver(DNSDriver):
         Update an existing record.
 
         API docs: http://www.linode.com/api/dns/domain.resource.update
+
+        @inherits: C{DNSDriver.update_record}
         """
         params = {'api_action': 'domain.resource.update',
                   'ResourceID': record.id, 'DomainID': record.zone.id}
@@ -239,7 +246,7 @@ class LinodeDNSDriver(DNSDriver):
         Build an Zone object from the item dictionary.
         """
         extra = {'SOA_Email': item['SOA_EMAIL'], 'status': item['STATUS'],
-                  'description': item['DESCRIPTION']}
+                 'description': item['DESCRIPTION']}
         zone = Zone(id=item['DOMAINID'], domain=item['DOMAIN'],
                     type=item['TYPE'], ttl=item['TTL_SEC'], driver=self,
                     extra=extra)
@@ -261,7 +268,7 @@ class LinodeDNSDriver(DNSDriver):
         Build a Record object from the item dictionary.
         """
         extra = {'protocol': item['PROTOCOL'], 'ttl_sec': item['TTL_SEC'],
-                  'port': item['PORT'], 'weight': item['WEIGHT']}
+                 'port': item['PORT'], 'weight': item['WEIGHT']}
         type = self._string_to_record_type(item['TYPE'])
         record = Record(id=item['RESOURCEID'], name=item['NAME'], type=type,
                         data=item['TARGET'], zone=zone, driver=self,

Modified: libcloud/branches/0.11.x/libcloud/dns/drivers/rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/drivers/rackspace.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/drivers/rackspace.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/drivers/rackspace.py Sun Nov 18 01:22:54 2012
@@ -80,7 +80,7 @@ class RackspaceDNSConnection(OpenStack_1
     def get_poll_request_kwargs(self, response, context, request_kwargs):
         job_id = response.object['jobId']
         kwargs = {'action': '/status/%s' % (job_id),
-                'params': {'showDetails': True}}
+                  'params': {'showDetails': True}}
         return kwargs
 
     def has_completed(self, response):
@@ -104,13 +104,13 @@ class RackspaceDNSConnection(OpenStack_1
             return self._construct_dns_endpoint_from_servers_endpoint(ep)
         elif "2.0" in self._auth_version:
             ep = self.service_catalog.get_endpoint(name="cloudServers",
-                service_type="compute",
-                region=None)
+                                                   service_type="compute",
+                                                   region=None)
 
             return self._construct_dns_endpoint_from_servers_endpoint(ep)
         else:
-            raise LibcloudError("Auth version %s not supported" % \
-                self._auth_version)
+            raise LibcloudError("Auth version %s not supported" %
+                                (self._auth_version))
 
     def _construct_dns_endpoint_from_servers_endpoint(self, ep):
         if 'publicURL' in ep:
@@ -131,9 +131,6 @@ class RackspaceDNSDriver(DNSDriver, Open
     website = 'http://www.rackspace.com/'
 
     def __init__(self, *args, **kwargs):
-        """
-        @requires: key, secret
-        """
         OpenStackDriverMixin.__init__(self, *args, **kwargs)
         super(RackspaceDNSDriver, self).__init__(*args, **kwargs)
 

Modified: libcloud/branches/0.11.x/libcloud/dns/drivers/route53.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/drivers/route53.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/drivers/route53.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/drivers/route53.py Sun Nov 18 01:22:54 2012
@@ -52,7 +52,7 @@ class Route53Error(LibcloudError):
 
     def __repr__(self):
         return('<Route53 response code=%s>' %
-                (self.code, len(self.errors)))
+               (self.code, len(self.errors)))
 
 
 class Route53DNSResponse(AWSBaseResponse):
@@ -79,7 +79,7 @@ class Route53DNSResponse(AWSBaseResponse
                     messages.append(message['Message'])
 
                 raise Route53Error('InvalidChangeBatch message(s): %s ',
-                        messages)
+                                   messages)
 
 
 class Route53Connection(ConnectionUserAndKey):
@@ -164,7 +164,7 @@ class Route53DNSDriver(DNSDriver):
     def _to_zone(self, elem):
         name = findtext(element=elem, xpath='Name', namespace=NAMESPACE)
         id = findtext(element=elem, xpath='Id',
-                namespace=NAMESPACE).replace('/hostedzone/', '')
+                      namespace=NAMESPACE).replace('/hostedzone/', '')
         comment = findtext(element=elem, xpath='Config/Comment',
                            namespace=NAMESPACE)
         resource_record_count = int(findtext(element=elem,
@@ -172,7 +172,7 @@ class Route53DNSDriver(DNSDriver):
                                              namespace=NAMESPACE))
 
         extra = {'Comment': comment, 'ResourceRecordSetCount':
-                resource_record_count}
+                 resource_record_count}
 
         zone = Zone(id=id, domain=name, type='master', ttl=0, driver=self,
                     extra=extra)
@@ -180,24 +180,24 @@ class Route53DNSDriver(DNSDriver):
 
     def _to_records(self, data, zone):
         records = []
-        for elem in \
-        data.findall(fixxpath(xpath='ResourceRecordSets/ResourceRecordSet',
-            namespace=NAMESPACE)):
+        for elem in data.findall(
+            fixxpath(xpath='ResourceRecordSets/ResourceRecordSet',
+                     namespace=NAMESPACE)):
             records.append(self._to_record(elem, zone))
 
         return records
 
     def _to_record(self, elem, zone):
         name = findtext(element=elem, xpath='Name',
-                namespace=NAMESPACE)
+                        namespace=NAMESPACE)
         type = self._string_to_record_type(findtext(element=elem, xpath='Type',
-                namespace=NAMESPACE))
+                                                    namespace=NAMESPACE))
         ttl = findtext(element=elem, xpath='TTL', namespace=NAMESPACE)
 
         # TODO: Support records with multiple values
         value_elem = elem.findall(
-                fixxpath(xpath='ResourceRecords/ResourceRecord',
-                         namespace=NAMESPACE))[0]
+            fixxpath(xpath='ResourceRecords/ResourceRecord',
+                     namespace=NAMESPACE))[0]
         data = findtext(element=(value_elem), xpath='Value',
                         namespace=NAMESPACE)
 

Modified: libcloud/branches/0.11.x/libcloud/dns/drivers/zerigo.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/dns/drivers/zerigo.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/dns/drivers/zerigo.py (original)
+++ libcloud/branches/0.11.x/libcloud/dns/drivers/zerigo.py Sun Nov 18 01:22:54 2012
@@ -55,9 +55,8 @@ class ZerigoError(LibcloudError):
         return 'Errors: %s' % (', '.join(self.errors))
 
     def __repr__(self):
-        return ('<ZerigoError response code=%s, errors count=%s>' %
-                                                          (self.code,
-                                                           len(self.errors)))
+        return ('<ZerigoError response code=%s, errors count=%s>' % (
+            self.code, len(self.errors)))
 
 
 class ZerigoDNSResponse(XmlResponse):
@@ -173,6 +172,8 @@ class ZerigoDNSDriver(DNSDriver):
 
         Provider API docs:
         https://www.zerigo.com/docs/apis/dns/1.1/zones/create
+
+        @inherits: L{DNSDriver.create_zone}
         """
         path = API_ROOT + 'zones.xml'
         zone_elem = self._to_zone_elem(domain=domain, type=type, ttl=ttl,
@@ -189,6 +190,8 @@ class ZerigoDNSDriver(DNSDriver):
 
         Provider API docs:
         https://www.zerigo.com/docs/apis/dns/1.1/zones/update
+
+        @inherits: L{DNSDriver.update_zone}
         """
         if domain:
             raise LibcloudError('Domain cannot be changed', driver=self)
@@ -197,8 +200,8 @@ class ZerigoDNSDriver(DNSDriver):
         zone_elem = self._to_zone_elem(domain=domain, type=type, ttl=ttl,
                                        extra=extra)
         response = self.connection.request(action=path,
-                                       data=ET.tostring(zone_elem),
-                                       method='PUT')
+                                           data=ET.tostring(zone_elem),
+                                           method='PUT')
         assert response.status == httplib.OK
 
         merged = merge_valid_keys(params=copy.deepcopy(zone.extra),
@@ -216,6 +219,8 @@ class ZerigoDNSDriver(DNSDriver):
 
         Provider API docs:
         https://www.zerigo.com/docs/apis/dns/1.1/hosts/create
+
+        @inherits: L{DNSDriver.create_record}
         """
         path = API_ROOT + 'zones/%s/hosts.xml' % (zone.id)
         record_elem = self._to_record_elem(name=name, type=type, data=data,
@@ -261,6 +266,11 @@ class ZerigoDNSDriver(DNSDriver):
     def ex_get_zone_by_domain(self, domain):
         """
         Retrieve a zone object by the domain name.
+
+        @param domain: The domain which should be used
+        @type  domain: C{str}
+
+        @rtype: L{Zone}
         """
         path = API_ROOT + 'zones/%s.xml' % (domain)
         self.connection.set_context({'resource': 'zone', 'id': domain})
@@ -271,6 +281,11 @@ class ZerigoDNSDriver(DNSDriver):
     def ex_force_slave_axfr(self, zone):
         """
         Force a zone transfer.
+
+        @param zone: Zone which should be used.
+        @type  zone: L{Zone}
+
+        @rtype: L{Zone}
         """
         path = API_ROOT + 'zones/%s/force_slave_axfr.xml' % (zone.id)
         self.connection.set_context({'resource': 'zone', 'id': zone.id})
@@ -308,7 +323,7 @@ class ZerigoDNSDriver(DNSDriver):
 
                 ns_type_elem.text = 'pri'
                 slave_nameservers_elem = ET.SubElement(zone_elem,
-                                                      'slave-nameservers')
+                                                       'slave-nameservers')
                 slave_nameservers_elem.text = extra['slave-nameservers']
 
         if ttl:
@@ -383,9 +398,9 @@ class ZerigoDNSDriver(DNSDriver):
         tags = tags.split(' ') if tags else []
 
         extra = {'hostmaster': hostmaster, 'custom-ns': custom_ns,
-                'custom-nameservers': custom_nameservers, 'notes': notes,
-                'nx-ttl': nx_ttl, 'slave-nameservers': slave_nameservers,
-                'tags': tags}
+                 'custom-nameservers': custom_nameservers, 'notes': notes,
+                 'nx-ttl': nx_ttl, 'slave-nameservers': slave_nameservers,
+                 'tags': tags}
         zone = Zone(id=str(id), domain=domain, type=type, ttl=int(ttl),
                     driver=self, extra=extra)
         return zone

Modified: libcloud/branches/0.11.x/libcloud/httplib_ssl.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/httplib_ssl.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/httplib_ssl.py (original)
+++ libcloud/branches/0.11.x/libcloud/httplib_ssl.py Sun Nov 18 01:22:54 2012
@@ -121,9 +121,10 @@ class LibcloudHTTPSConnection(httplib.HT
 
         # replace * with alphanumeric and dash
         # replace . with literal .
+        # http://www.dns.net/dnsrd/trick.html#legal-hostnames
         valid_patterns = [
             re.compile('^' + pattern.replace(r".", r"\.") \
-                                    .replace(r"*", r"[0-9A-Za-z]+") + '$')
+                                    .replace(r"*", r"[0-9A-Za-z\-]+") + '$')
             for pattern in (set(common_name) | set(alt_names))]
 
         return any(

Modified: libcloud/branches/0.11.x/libcloud/loadbalancer/base.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/loadbalancer/base.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/loadbalancer/base.py (original)
+++ libcloud/branches/0.11.x/libcloud/loadbalancer/base.py Sun Nov 18 01:22:54 2012
@@ -17,24 +17,25 @@ from libcloud.common.base import Connect
 from libcloud.common.types import LibcloudError
 
 __all__ = [
-        "Member",
-        "LoadBalancer",
-        "Driver",
-        "Algorithm"
-        ]
+    "Member",
+    "LoadBalancer",
+    "Driver",
+    "Algorithm"
+]
 
 
 class Member(object):
 
-    def __init__(self, id, ip, port, extra=None):
+    def __init__(self, id, ip, port, balancer=None, extra=None):
         self.id = str(id) if id else None
         self.ip = ip
         self.port = port
+        self.balancer = balancer
         self.extra = extra or {}
 
     def __repr__(self):
         return ('<Member: id=%s, address=%s:%s>' % (self.id,
-            self.ip, self.port))
+                                                    self.ip, self.port))
 
 
 class Algorithm(object):
@@ -52,6 +53,9 @@ class LoadBalancer(object):
     Provide a common interface for handling Load Balancers.
     """
 
+    name = None
+    website = None
+
     def __init__(self, id, name, state, ip, port, driver, extra=None):
         self.id = str(id) if id else None
         self.name = name
@@ -96,138 +100,167 @@ class Driver(BaseDriver):
     _ALGORITHM_TO_VALUE_MAP = {}
     _VALUE_TO_ALGORITHM_MAP = {}
 
-    def __init__(self, key, secret=None, secure=True, host=None, port=None, **kwargs):
+    def __init__(self, key, secret=None, secure=True, host=None,
+                 port=None, **kwargs):
         super(Driver, self).__init__(key=key, secret=secret, secure=secure,
                                      host=host, port=port, **kwargs)
 
     def list_protocols(self):
         """
         Return a list of supported protocols.
-        """
 
+        @rtype: C{list} of C{str}
+        """
         raise NotImplementedError(
-                'list_protocols not implemented for this driver')
+            'list_protocols not implemented for this driver')
 
     def list_balancers(self):
         """
         List all loadbalancers
 
-        @return: C{list} of L{LoadBalancer} objects
-
+        @rtype: C{list} of L{LoadBalancer}
         """
-
         raise NotImplementedError(
-                'list_balancers not implemented for this driver')
+            'list_balancers not implemented for this driver')
 
     def create_balancer(self, name, port, protocol, algorithm, members):
         """
         Create a new load balancer instance
 
-        @keyword name: Name of the new load balancer (required)
-        @type name: C{str}
-        @keyword members: C{list} ofL{Member}s to attach to balancer
-        @type: C{list} of L{Member}s
-        @keyword protocol: Loadbalancer protocol, defaults to http.
-        @type: C{str}
-        @keyword port: Port the load balancer should listen on, defaults to 80
-        @type port: C{str}
-        @keyword algorithm: Load balancing algorithm, defaults to
-                            LBAlgorithm.ROUND_ROBIN
-        @type algorithm: C{LBAlgorithm}
+        @param name: Name of the new load balancer (required)
+        @type  name: C{str}
 
-        """
+        @param port: Port the load balancer should listen on, defaults to 80
+        @type  port: C{str}
+
+        @param protocol: Loadbalancer protocol, defaults to http.
+        @type  protocol: C{str}
+
+        @param members: list of Members to attach to balancer
+        @type  members: C{list} of L{Member}
+
+        @param algorithm: Load balancing algorithm, defaults to ROUND_ROBIN
+        @type algorithm: L{Algorithm}
 
+        @rtype: L{LoadBalancer}
+        """
         raise NotImplementedError(
-                'create_balancer not implemented for this driver')
+            'create_balancer not implemented for this driver')
 
     def destroy_balancer(self, balancer):
         """Destroy a load balancer
 
-        @return: C{bool} True if the destroy was successful, otherwise False
+        @param balancer: LoadBalancer which should be used
+        @type  balancer: L{LoadBalancer}
 
+        @return: True if the destroy was successful, otherwise False
+        @rtype: C{bool}
         """
 
         raise NotImplementedError(
-                'destroy_balancer not implemented for this driver')
+            'destroy_balancer not implemented for this driver')
 
     def get_balancer(self, balancer_id):
         """
-        Return a C{LoadBalancer} object.
+        Return a L{LoadBalancer} object.
 
-        @keyword balancer_id: id of a load balancer you want to fetch
-        @type balancer_id: C{str}
+        @param balancer_id: id of a load balancer you want to fetch
+        @type  balancer_id: C{str}
 
-        @return: C{LoadBalancer}
+        @rtype: L{LoadBalancer}
         """
 
         raise NotImplementedError(
-                'get_balancer not implemented for this driver')
+            'get_balancer not implemented for this driver')
 
     def update_balancer(self, balancer, **kwargs):
         """
         Sets the name, algorithm, protocol, or port on a load balancer.
 
-        @keyword    name: New load balancer name
-        @type       metadata: C{str}
+        @param   balancer: LoadBalancer which should be used
+        @type    balancer: L{LoadBalancer}
+
+        @keyword name: New load balancer name
+        @type    name: C{str}
+
+        @keyword algorithm: New load balancer algorithm
+        @type    algorithm: L{Algorithm}
 
-        @keyword    algorithm: New load balancer algorithm
-        @type       metadata: C{libcloud.loadbalancer.base.Algorithm}
+        @keyword protocol: New load balancer protocol
+        @type    protocol: C{str}
 
-        @keyword    protocol: New load balancer protocol
-        @type       metadata: C{str}
+        @keyword port: New load balancer port
+        @type    port: C{int}
 
-        @keyword    port: New load balancer port
-        @type       metadata: C{int}
+        @rtype: L{LoadBalancer}
         """
         raise NotImplementedError(
-                'update_balancer not implemented for this driver')
+            'update_balancer not implemented for this driver')
 
     def balancer_attach_compute_node(self, balancer, node):
         """
         Attach a compute node as a member to the load balancer.
 
-        @keyword node: Member to join to the balancer
-        @type member: C{libcloud.compute.base.Node}
-        @return {Member} Member after joining the balancer.
+        @param balancer: LoadBalancer which should be used
+        @type  balancer: L{LoadBalancer}
+
+        @param node: Node to join to the balancer
+        @type  node: L{Node}
+
+        @return: Member after joining the balancer.
+        @rtype: L{Member}
         """
 
-        return self.balancer_attach_member(balancer, Member(None,
-                                           node.public_ips[0],
-                                           balancer.port))
+        return self.balancer_attach_member(balancer, Member(id=None,
+                                                            ip=node.public_ips[0],
+                                                            port=balancer.port))
 
     def balancer_attach_member(self, balancer, member):
         """
         Attach a member to balancer
 
-        @keyword member: Member to join to the balancer
-        @type member: C{Member}
-        @return {Member} Member after joining the balancer.
+        @param balancer: LoadBalancer which should be used
+        @type  balancer: L{LoadBalancer}
+
+        @param member: Member to join to the balancer
+        @type member: L{Member}
+
+        @return: Member after joining the balancer.
+        @rtype: L{Member}
         """
 
         raise NotImplementedError(
-                'balancer_attach_member not implemented for this driver')
+            'balancer_attach_member not implemented for this driver')
 
     def balancer_detach_member(self, balancer, member):
         """
         Detach member from balancer
 
-        @return: C{bool} True if member detach was successful, otherwise False
+        @param balancer: LoadBalancer which should be used
+        @type  balancer: L{LoadBalancer}
 
+        @param member: Member which should be used
+        @type member: L{Member}
+
+        @return: True if member detach was successful, otherwise False
+        @rtype: C{bool}
         """
 
         raise NotImplementedError(
-                'balancer_detach_member not implemented for this driver')
+            'balancer_detach_member not implemented for this driver')
 
     def balancer_list_members(self, balancer):
         """
         Return list of members attached to balancer
 
-        @return: C{list} of L{Member}s
+        @param balancer: LoadBalancer which should be used
+        @type  balancer: L{LoadBalancer}
 
+        @rtype: C{list} of L{Member}
         """
 
         raise NotImplementedError(
-                'balancer_list_members not implemented for this driver')
+            'balancer_list_members not implemented for this driver')
 
     def _value_to_algorithm(self, value):
         """
@@ -252,5 +285,7 @@ class Driver(BaseDriver):
     def list_supported_algorithms(self):
         """
         Return algorithms supported by this driver.
+
+        @rtype: C{list} of C{str}
         """
         return list(self._ALGORITHM_TO_VALUE_MAP.keys())

Modified: libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/brightbox.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/brightbox.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/brightbox.py (original)
+++ libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/brightbox.py Sun Nov 18 01:22:54 2012
@@ -28,6 +28,7 @@ class BrightboxLBDriver(Driver):
     connectionCls = BrightboxConnection
 
     name = 'Brightbox'
+    website = 'http://www.brightbox.co.uk/'
 
     LB_STATE_MAP = {
         'creating': State.PENDING,
@@ -55,13 +56,14 @@ class BrightboxLBDriver(Driver):
         return list(map(self._to_balancer, data))
 
     def create_balancer(self, name, port, protocol, algorithm, members):
-        response = self._post('/%s/load_balancers' % API_VERSION, {
-          'name': name,
-          'nodes': list(map(self._member_to_node, members)),
-          'policy': self._algorithm_to_value(algorithm),
-          'listeners': [{'in': port, 'out': port, 'protocol': protocol}],
-          'healthcheck': {'type': protocol, 'port': port}
-        })
+        response = self._post(
+            '/%s/load_balancers' % API_VERSION,
+            {'name': name,
+             'nodes': list(map(self._member_to_node, members)),
+             'policy': self._algorithm_to_value(algorithm),
+             'listeners': [{'in': port, 'out': port, 'protocol': protocol}],
+             'healthcheck': {'type': protocol, 'port': port}}
+        )
 
         return self._to_balancer(response.object)
 
@@ -73,9 +75,8 @@ class BrightboxLBDriver(Driver):
         return response.status == httplib.ACCEPTED
 
     def get_balancer(self, balancer_id):
-        data = self.connection.request('/%s/load_balancers/%s' % (API_VERSION,
-                                                         balancer_id)).object
-
+        data = self.connection.request(
+            '/%s/load_balancers/%s' % (API_VERSION, balancer_id)).object
         return self._to_balancer(data)
 
     def balancer_attach_compute_node(self, balancer, node):
@@ -101,7 +102,8 @@ class BrightboxLBDriver(Driver):
 
         data = self.connection.request(path).object
 
-        return list(map(self._node_to_member, data['nodes']))
+        func = lambda data: self._node_to_member(data, balancer)
+        return list(map(func, data['nodes']))
 
     def _post(self, path, data={}):
         headers = {'Content-Type': 'application/json'}
@@ -122,8 +124,8 @@ class BrightboxLBDriver(Driver):
     def _member_to_node(self, member):
         return {'node': member.id}
 
-    def _node_to_member(self, data):
-        return Member(data['id'], None, None)
+    def _node_to_member(self, data, balancer):
+        return Member(id=data['id'], ip=None, port=None, balancer=balancer)
 
     def _public_ip(self, data):
         if len(data['cloud_ips']) > 0:

Modified: libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/cloudstack.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/cloudstack.py (original)
+++ libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/cloudstack.py Sun Nov 18 01:22:54 2012
@@ -19,10 +19,13 @@ from libcloud.loadbalancer.base import D
 from libcloud.loadbalancer.types import State
 from libcloud.utils.misc import reverse_dict
 
+
 class CloudStackLBDriver(CloudStackDriverMixIn, Driver):
     """Driver for CloudStack load balancers."""
 
     api_name = 'cloudstack_lb'
+    name = 'CloudStack'
+    website = 'http://cloudstack.org/'
 
     _VALUE_TO_ALGORITHM_MAP = {
         'roundrobin': Algorithm.ROUND_ROBIN,
@@ -34,9 +37,19 @@ class CloudStackLBDriver(CloudStackDrive
         'Active': State.RUNNING,
     }
 
+    def __init__(self, *args, **kwargs):
+        """
+        @inherits: L{Driver.__init__}
+        """
+        super(CloudStackLBDriver, self).__init__(*args, **kwargs)
+
     def list_protocols(self):
-        """We don't actually have any protocol awareness beyond TCP."""
-        return [ 'tcp' ]
+        """
+        We don't actually have any protocol awareness beyond TCP.
+
+        @rtype: C{list} of C{str}
+        """
+        return ['tcp']
 
     def list_balancers(self):
         balancers = self._sync_request('listLoadBalancerRules')
@@ -53,6 +66,15 @@ class CloudStackLBDriver(CloudStackDrive
     def create_balancer(self, name, members, protocol='http', port=80,
                         algorithm=DEFAULT_ALGORITHM, location=None,
                         private_port=None):
+        """
+        @inherits: L{Driver.create_balancer}
+
+        @param location: Location
+        @type  location: L{NodeLocation}
+
+        @param private_port: Private port
+        @type  private_port: C{int}
+        """
         if location is None:
             locations = self._sync_request('listZones')
             location = locations['zone'][0]['id']
@@ -64,7 +86,8 @@ class CloudStackLBDriver(CloudStackDrive
         result = self._async_request('associateIpAddress', zoneid=location)
         public_ip = result['ipaddress']
 
-        result = self._sync_request('createLoadBalancerRule',
+        result = self._sync_request(
+            'createLoadBalancerRule',
             algorithm=self._ALGORITHM_TO_VALUE_MAP[algorithm],
             name=name,
             privateport=private_port,
@@ -99,7 +122,8 @@ class CloudStackLBDriver(CloudStackDrive
         members = self._sync_request('listLoadBalancerRuleInstances',
                                      id=balancer.id)
         members = members['loadbalancerruleinstance']
-        return [self._to_member(m, balancer.ex_private_port) for m in members]
+        return [self._to_member(m, balancer.ex_private_port, balancer) \
+                for m in members]
 
     def _to_balancer(self, obj):
         balancer = LoadBalancer(
@@ -114,9 +138,10 @@ class CloudStackLBDriver(CloudStackDrive
         balancer.ex_public_ip_id = obj['publicipid']
         return balancer
 
-    def _to_member(self, obj, port):
+    def _to_member(self, obj, port, balancer):
         return Member(
             id=obj['id'],
             ip=obj['nic'][0]['ipaddress'],
-            port=port
+            port=port,
+            balancer=balancer
         )

Modified: libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/gogrid.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/gogrid.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/gogrid.py (original)
+++ libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/gogrid.py Sun Nov 18 01:22:54 2012
@@ -25,11 +25,13 @@ except ImportError:
 
 from libcloud.utils.misc import reverse_dict
 from libcloud.common.types import LibcloudError
-from libcloud.common.gogrid import GoGridConnection, GoGridResponse, BaseGoGridDriver
+from libcloud.common.gogrid import GoGridConnection, GoGridResponse,\
+    BaseGoGridDriver
 from libcloud.loadbalancer.base import LoadBalancer, Member, Driver, Algorithm
 from libcloud.loadbalancer.base import DEFAULT_ALGORITHM
 from libcloud.loadbalancer.types import State, LibcloudLBImmutableError
 
+
 class GoGridLBResponse(GoGridResponse):
     def success(self):
         if self.status == httplib.INTERNAL_SERVER_ERROR:
@@ -37,42 +39,55 @@ class GoGridLBResponse(GoGridResponse):
             # "unexpected server error"
             body = json.loads(self.body)
             if body['method'] == '/grid/loadbalancer/add' and \
-               len(body['list']) >= 1 and \
-               body['list'][0]['message'].find('unexpected server error') != -1:
-                raise LibcloudError(value='You mostly likely tried to add a '
-                                         + 'member with an IP address not assigned '
-                                         +  'to your account', driver=self)
+                len(body['list']) >= 1 and \
+                body['list'][0]['message'].find(
+                    'unexpected server error') != -1:
+                raise LibcloudError(
+                    value='You mostly likely tried to add a member with an IP'
+                          ' address not assigned to your account', driver=self)
         return super(GoGridLBResponse, self).success()
 
+
 class GoGridLBConnection(GoGridConnection):
     """
     Connection class for the GoGrid load-balancer driver.
     """
     responseCls = GoGridLBResponse
 
+
 class GoGridLBDriver(BaseGoGridDriver, Driver):
     connectionCls = GoGridLBConnection
     api_name = 'gogrid_lb'
     name = 'GoGrid LB'
+    website = 'http://www.gogrid.com/'
 
-    LB_STATE_MAP = { 'On': State.RUNNING,
-                     'Unknown': State.UNKNOWN }
+    LB_STATE_MAP = {'On': State.RUNNING,
+                    'Unknown': State.UNKNOWN}
     _VALUE_TO_ALGORITHM_MAP = {
         'round robin': Algorithm.ROUND_ROBIN,
         'least connect': Algorithm.LEAST_CONNECTIONS
     }
     _ALGORITHM_TO_VALUE_MAP = reverse_dict(_VALUE_TO_ALGORITHM_MAP)
 
+    def __init__(self, *args, **kwargs):
+        """
+        @inherits: L{Driver.__init__}
+        """
+        super(GoGridLBDriver, self).__init__(*args, **kwargs)
+
     def list_protocols(self):
         # GoGrid only supports http
-        return [ 'http' ]
+        return ['http']
 
     def list_balancers(self):
         return self._to_balancers(
-                self.connection.request('/api/grid/loadbalancer/list').object)
+            self.connection.request('/api/grid/loadbalancer/list').object)
 
-    def ex_create_balancer_nowait(self, name, members, protocol='http', port=80,
-                                  algorithm=DEFAULT_ALGORITHM):
+    def ex_create_balancer_nowait(self, name, members, protocol='http',
+                                  port=80, algorithm=DEFAULT_ALGORITHM):
+        """
+        @inherits: L{Driver.create_balancer}
+        """
         algorithm = self._algorithm_to_value(algorithm)
 
         params = {'name': name,
@@ -82,8 +97,8 @@ class GoGridLBDriver(BaseGoGridDriver, D
         params.update(self._members_to_params(members))
 
         resp = self.connection.request('/api/grid/loadbalancer/add',
-                method='GET',
-                params=params)
+                                       method='GET',
+                                       params=params)
         return self._to_balancers(resp.object)[0]
 
     def create_balancer(self, name, members, protocol='http', port=80,
@@ -112,13 +127,14 @@ class GoGridLBDriver(BaseGoGridDriver, D
 
     def destroy_balancer(self, balancer):
         try:
-            resp = self.connection.request('/api/grid/loadbalancer/delete',
-                    method='POST', params={'id': balancer.id})
+            resp = self.connection.request(
+                '/api/grid/loadbalancer/delete', method='POST',
+                params={'id': balancer.id})
         except Exception:
             e = sys.exc_info()[1]
             if "Update request for LoadBalancer" in str(e):
-                raise LibcloudLBImmutableError("Cannot delete immutable object",
-                        GoGridLBDriver)
+                raise LibcloudLBImmutableError(
+                    "Cannot delete immutable object", GoGridLBDriver)
             else:
                 raise
 
@@ -134,7 +150,7 @@ class GoGridLBDriver(BaseGoGridDriver, D
             params['id'] = balancer_id
 
         resp = self.connection.request('/api/grid/loadbalancer/get',
-                params=params)
+                                       params=params)
 
         return self._to_balancers(resp.object)[0]
 
@@ -147,10 +163,9 @@ class GoGridLBDriver(BaseGoGridDriver, D
         params.update(self._members_to_params(members))
 
         resp = self._update_balancer(params)
-
-        return [ m for m in
-                self._to_members(resp.object["list"][0]["realiplist"])
-                if m.ip == member.ip ][0]
+        return [m for m in
+               self._to_members(resp.object["list"][0]["realiplist"], balancer)
+               if m.ip == member.ip][0]
 
     def balancer_detach_member(self, balancer, member):
         members = self.balancer_list_members(balancer)
@@ -166,18 +181,19 @@ class GoGridLBDriver(BaseGoGridDriver, D
 
     def balancer_list_members(self, balancer):
         resp = self.connection.request('/api/grid/loadbalancer/get',
-                params={'id': balancer.id})
-        return self._to_members(resp.object["list"][0]["realiplist"])
+                                       params={'id': balancer.id})
+        return self._to_members(resp.object["list"][0]["realiplist"], balancer)
 
     def _update_balancer(self, params):
         try:
             return self.connection.request('/api/grid/loadbalancer/edit',
-                    method='POST',
-                    params=params)
+                                           method='POST',
+                                           params=params)
         except Exception:
             e = sys.exc_info()[1]
             if "Update already pending" in str(e):
-                raise LibcloudLBImmutableError("Balancer is immutable", GoGridLBDriver)
+                raise LibcloudLBImmutableError(
+                    "Balancer is immutable", GoGridLBDriver)
 
         raise LibcloudError(value='Exception: %s' % str(e), driver=self)
 
@@ -199,23 +215,24 @@ class GoGridLBDriver(BaseGoGridDriver, D
         return params
 
     def _to_balancers(self, object):
-        return [ self._to_balancer(el) for el in object["list"] ]
+        return [self._to_balancer(el) for el in object["list"]]
 
     def _to_balancer(self, el):
         lb = LoadBalancer(id=el.get("id"),
-                name=el["name"],
-                state=self.LB_STATE_MAP.get(
-                    el["state"]["name"], State.UNKNOWN),
-                ip=el["virtualip"]["ip"]["ip"],
-                port=el["virtualip"]["port"],
-                driver=self.connection.driver)
+                          name=el["name"],
+                          state=self.LB_STATE_MAP.get(
+                              el["state"]["name"], State.UNKNOWN),
+                          ip=el["virtualip"]["ip"]["ip"],
+                          port=el["virtualip"]["port"],
+                          driver=self.connection.driver)
         return lb
 
-    def _to_members(self, object):
-        return [ self._to_member(el) for el in object ]
+    def _to_members(self, object, balancer=None):
+        return [self._to_member(el, balancer) for el in object]
 
-    def _to_member(self, el):
+    def _to_member(self, el, balancer=None):
         member = Member(id=el["ip"]["id"],
-                ip=el["ip"]["ip"],
-                port=el["port"])
+                        ip=el["ip"]["ip"],
+                        port=el["port"],
+                        balancer=balancer)
         return member

Modified: libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/ninefold.py
URL: http://svn.apache.org/viewvc/libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/ninefold.py?rev=1410809&r1=1410808&r2=1410809&view=diff
==============================================================================
--- libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/ninefold.py (original)
+++ libcloud/branches/0.11.x/libcloud/loadbalancer/drivers/ninefold.py Sun Nov 18 01:22:54 2012
@@ -17,6 +17,7 @@ from libcloud.loadbalancer.providers imp
 
 from libcloud.loadbalancer.drivers.cloudstack import CloudStackLBDriver
 
+
 class NinefoldLBDriver(CloudStackLBDriver):
     "Driver for load balancers on Ninefold's Compute platform."
 
@@ -25,3 +26,4 @@ class NinefoldLBDriver(CloudStackLBDrive
 
     type = Provider.NINEFOLD
     name = 'Ninefold LB'
+    website = 'http://ninefold.com/'



Mime
View raw message