You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2013/10/17 22:10:37 UTC

[01/16] git commit: Move Joyent compute driver to a single class + region argument model.

Updated Branches:
  refs/heads/trunk 573100712 -> 7cb7423f3


Move Joyent compute driver to a single class + region argument model.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/66386bce
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/66386bce
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/66386bce

Branch: refs/heads/trunk
Commit: 66386bce123176294f2eb7d7e4d216af4a6076df
Parents: 5731007
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 18:01:21 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 19:58:32 2013 +0200

----------------------------------------------------------------------
 CHANGES                              |  7 ++++++
 libcloud/compute/drivers/joyent.py   | 37 ++++++++++++++--------------
 libcloud/test/compute/test_joyent.py | 41 ++++++++++++++++++++++---------
 3 files changed, 55 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/66386bce/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 3895fee..ac5ea27 100644
--- a/CHANGES
+++ b/CHANGES
@@ -140,6 +140,13 @@ Changes with Apache Libcloud in development
       (LIBCLOUD-409)
       [Oleg Suharev]
 
+    - Align Joyent driver with other drivers and deprecate "location" argument
+      in the driver constructor in favor of "region" argument.
+
+      Note: Deprecated argument will continue to work until the next major
+      release.
+      [Tomaz Muraus]
+
   *) Storage
 
     - Deprecate CLOUDFILES_US and CLOUDFILES_UK provider constant and replace

http://git-wip-us.apache.org/repos/asf/libcloud/blob/66386bce/libcloud/compute/drivers/joyent.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/joyent.py b/libcloud/compute/drivers/joyent.py
index f972c94..f3c0132 100644
--- a/libcloud/compute/drivers/joyent.py
+++ b/libcloud/compute/drivers/joyent.py
@@ -46,8 +46,8 @@ NODE_STATE_MAP = {
     'deleted': NodeState.TERMINATED
 }
 
-LOCATIONS = ['us-east-1', 'us-west-1', 'us-sw-1', 'eu-ams-1']
-DEFAULT_LOCATION = LOCATIONS[0]
+VALID_REGIONS = ['us-east-1', 'us-west-1', 'us-sw-1', 'eu-ams-1']
+DEFAULT_REGION = 'us-east-1'
 
 
 class JoyentResponse(JsonResponse):
@@ -59,7 +59,7 @@ class JoyentResponse(JsonResponse):
                             httplib.NO_CONTENT]
 
     def parse_error(self):
-        if self.status == 401:
+        if self.status == httplib.UNAUTHORIZED:
             data = self.parse_body()
             raise InvalidCredsError(data['code'] + ': ' + data['message'])
         return self.body
@@ -96,23 +96,22 @@ class JoyentNodeDriver(NodeDriver):
     connectionCls = JoyentConnection
     features = {'create_node': ['generates_password']}
 
-    def __init__(self, *args, **kwargs):
-        """
-        @inherits: :class:`NodeDriver.__init__`
-
-        :keyword    location: Location which should be used
-        :type       location: ``str``
-        """
+    def __init__(self, key, secret=None, secure=True, host=None, port=None,
+                 region=DEFAULT_REGION, **kwargs):
+        # Location is here for backward compatibility reasons
         if 'location' in kwargs:
-            if kwargs['location'] not in LOCATIONS:
-                msg = 'Invalid location: "%s". Valid locations: %s'
-                raise LibcloudError(msg % (kwargs['location'],
-                                    ', '.join(LOCATIONS)), driver=self)
-        else:
-            kwargs['location'] = DEFAULT_LOCATION
-
-        super(JoyentNodeDriver, self).__init__(*args, **kwargs)
-        self.connection.host = kwargs['location'] + API_HOST_SUFFIX
+            region = kwargs['location']
+
+        if region not in VALID_REGIONS:
+            msg = 'Invalid region: "%s". Valid region: %s'
+            raise LibcloudError(msg % (region,
+                                ', '.join(VALID_REGIONS)), driver=self)
+
+        super(JoyentNodeDriver, self).__init__(key=key, secret=secret,
+                                               secure=secure, host=host,
+                                               port=port, region=region,
+                                               **kwargs)
+        self.connection.host = region + API_HOST_SUFFIX
 
     def list_images(self):
         result = self.connection.request('/my/datasets').object

http://git-wip-us.apache.org/repos/asf/libcloud/blob/66386bce/libcloud/test/compute/test_joyent.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_joyent.py b/libcloud/test/compute/test_joyent.py
index 4826e47..78cce9b 100644
--- a/libcloud/test/compute/test_joyent.py
+++ b/libcloud/test/compute/test_joyent.py
@@ -14,15 +14,13 @@
 # limitations under the License.
 
 import sys
-import unittest
 
 from libcloud.utils.py3 import httplib
 from libcloud.common.types import LibcloudError
-from libcloud.compute.base import Node, NodeState
+from libcloud.compute.base import NodeState
 from libcloud.compute.drivers.joyent import JoyentNodeDriver
 
-from libcloud.test import MockHttp
-from libcloud.test.compute import TestCaseMixin
+from libcloud.test import MockHttp, unittest
 from libcloud.test.file_fixtures import ComputeFileFixtures
 from libcloud.test.secrets import JOYENT_PARAMS
 
@@ -32,13 +30,34 @@ class JoyentTestCase(unittest.TestCase):
         JoyentNodeDriver.connectionCls.conn_classes = (None, JoyentHttp)
         self.driver = JoyentNodeDriver(*JOYENT_PARAMS)
 
-    def test_instantiate_invalid_location(self):
-        try:
-            JoyentNodeDriver('user', 'key', location='invalid')
-        except LibcloudError:
-            pass
-        else:
-            self.fail('Exception was not thrown')
+    def test_instantiate_multiple_drivers_with_different_region(self):
+        kwargs1 = {'region': 'us-east-1'}
+        kwargs2 = {'region': 'us-west-1'}
+        driver1 = JoyentNodeDriver(*JOYENT_PARAMS, **kwargs1)
+        driver2 = JoyentNodeDriver(*JOYENT_PARAMS, **kwargs2)
+
+        self.assertTrue(driver1.connection.host.startswith(kwargs1['region']))
+        self.assertTrue(driver2.connection.host.startswith(kwargs2['region']))
+
+        driver1.list_nodes()
+        driver2.list_nodes()
+        driver1.list_nodes()
+
+        self.assertTrue(driver1.connection.host.startswith(kwargs1['region']))
+        self.assertTrue(driver2.connection.host.startswith(kwargs2['region']))
+
+    def test_location_backward_compatibility(self):
+        kwargs = {'location': 'us-west-1'}
+        driver = JoyentNodeDriver(*JOYENT_PARAMS, **kwargs)
+        self.assertTrue(driver.connection.host.startswith(kwargs['location']))
+
+    def test_instantiate_invalid_region(self):
+        expected_msg = 'Invalid region.+'
+
+        self.assertRaisesRegexp(LibcloudError, expected_msg, JoyentNodeDriver,
+                                'user', 'key', location='invalid')
+        self.assertRaisesRegexp(LibcloudError, expected_msg, JoyentNodeDriver,
+                                'user', 'key', region='invalid')
 
     def test_list_sizes(self):
         sizes = self.driver.list_sizes()


[11/16] git commit: ElasticHosts compute driver: Use region names exposed by the provider.

Posted by to...@apache.org.
ElasticHosts compute driver: Use region names exposed by the provider.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/e3e17131
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/e3e17131
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/e3e17131

Branch: refs/heads/trunk
Commit: e3e171311c5f5dd83edac5eb89069fccea4875ac
Parents: 6305205
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 21:07:57 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 21:07:57 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/elastichosts.py | 39 ++++++++++++++-------------
 1 file changed, 20 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/e3e17131/libcloud/compute/drivers/elastichosts.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elastichosts.py b/libcloud/compute/drivers/elastichosts.py
index 2b713d2..f9e18df 100644
--- a/libcloud/compute/drivers/elastichosts.py
+++ b/libcloud/compute/drivers/elastichosts.py
@@ -23,37 +23,37 @@ from libcloud.compute.drivers.elasticstack import ElasticStackBaseNodeDriver
 
 # API end-points
 API_ENDPOINTS = {
-    'uk-1': {
+    'lon-p': {
         'name': 'London Peer 1',
         'country': 'United Kingdom',
         'host': 'api-lon-p.elastichosts.com'
     },
-    'uk-2': {
+    'lon-b': {
         'name': 'London BlueSquare',
         'country': 'United Kingdom',
         'host': 'api-lon-b.elastichosts.com'
     },
-    'us-1': {
+    'sat-p': {
         'name': 'San Antonio Peer 1',
         'country': 'United States',
         'host': 'api-sat-p.elastichosts.com'
     },
-    'us-2': {
+    'lax-p': {
         'name': 'Los Angeles Peer 1',
         'country': 'United States',
         'host': 'api-lax-p.elastichosts.com'
     },
-    'us-3': {
+    'sjc-c': {
         'name': 'San Jose (Silicon Valley)',
         'country': 'United States',
         'host': 'api-sjc-c.elastichosts.com'
     },
-    'ca-1': {
+    'tor-p': {
         'name': 'Toronto Peer 1',
         'country': 'Canada',
         'host': 'api-tor-p.elastichosts.com'
     },
-    'au-1': {
+    'syd-y': {
         'name': 'Sydney',
         'country': 'Australia',
         'host': 'api-syd-v.elastichosts.com'
@@ -66,7 +66,7 @@ API_ENDPOINTS = {
 }
 
 # Default API end-point for the base connection class.
-DEFAULT_REGION = 'us-1'
+DEFAULT_REGION = 'sat-p'
 
 # Retrieved from http://www.elastichosts.com/cloud-hosting/api
 STANDARD_DRIVES = {
@@ -165,59 +165,60 @@ class ElasticHostsNodeDriver(ElasticStackBaseNodeDriver):
         """
         Return the host value based on the user supplied region.
         """
-        if self._host_argument_set:
-            return {}
-        else:
-            return {'host': API_ENDPOINTS[self.region]['host']}
+        kwargs = {}
+        if not self._host_argument_set:
+            kwargs['host'] = API_ENDPOINTS[self.region]['host']
+
+        return kwargs
 
 
 class ElasticHostsUK1NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the London Peer 1 end-point
     """
-    _region = 'uk-1'
+    _region = 'lon-p'
 
 
 class ElasticHostsUK2NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the London Bluesquare end-point
     """
-    _region = 'uk-2'
+    _region = 'lon-b'
 
 
 class ElasticHostsUS1NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the San Antonio Peer 1 end-point
     """
-    _region = 'us-1'
+    _region = 'sat-p'
 
 
 class ElasticHostsUS2NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the Los Angeles Peer 1 end-point
     """
-    _region = 'us-2'
+    _region = 'lax-p'
 
 
 class ElasticHostsUS3NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the San Jose (Silicon Valley) end-point
     """
-    _region = 'us-3'
+    _region = 'sjc-c'
 
 
 class ElasticHostsCA1NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the Toronto Peer 1 end-point
     """
-    _region = 'ca-1'
+    _region = 'tor-p'
 
 
 class ElasticHostsAU1NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the Sydney end-point
     """
-    _region = 'au-1'
+    _region = 'syd-y'
 
 
 class ElasticHostsCN1NodeDriver(ElasticHostsNodeDriver):


[09/16] git commit: Pep8 fixes.

Posted by to...@apache.org.
Pep8 fixes.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9d9aeb38
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9d9aeb38
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9d9aeb38

Branch: refs/heads/trunk
Commit: 9d9aeb3885bf9b7b5b0561910e80bc49fe2a9c8a
Parents: 7f2ebd8
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:44:24 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:44:24 2013 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_elasticstack.py | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/9d9aeb38/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index 1fb5718..71577d1 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -18,21 +18,19 @@ import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.compute.base import Node
-from libcloud.compute.types import Provider
-from libcloud.compute.drivers.elasticstack import (ElasticStackException,
-                              ElasticStackBaseConnection,
-                              ElasticStackBaseNodeDriver as ElasticStack)
+from libcloud.compute.drivers.elasticstack import ElasticStackException
 from libcloud.compute.drivers.elastichosts import \
-                              (ElasticHostsNodeDriver as ElasticHosts)
+    ElasticHostsNodeDriver as ElasticHosts
 from libcloud.compute.drivers.skalicloud import \
-                              (SkaliCloudNodeDriver as SkaliCloud)
+    SkaliCloudNodeDriver as SkaliCloud
 from libcloud.compute.drivers.serverlove import \
-                              (ServerLoveNodeDriver as ServerLove)
+    ServerLoveNodeDriver as ServerLove
 from libcloud.common.types import InvalidCredsError, MalformedResponseError
 
 from libcloud.test import MockHttp
 from libcloud.test.file_fixtures import ComputeFileFixtures
 
+
 class ElasticStackTestCase(object):
 
     def setUp(self):
@@ -135,8 +133,7 @@ class ElasticStackTestCase(object):
 
     def test_create_node(self):
         sizes = self.driver.list_sizes()
-        size = [s for s in sizes if \
-                s.id == 'large'][0]
+        size = [s for s in sizes if s.id == 'large'][0]
         image = self.image
 
         self.assertTrue(self.driver.create_node(name="api.ivan.net.nz",
@@ -151,7 +148,7 @@ class ElasticHostsTestCase(ElasticStackTestCase, unittest.TestCase):
 
         self.driver = ElasticHosts('foo', 'bar')
         images = self.driver.list_images()
-        self.image = [i for i in images if \
+        self.image = [i for i in images if
                       i.id == '38df0986-4d85-4b76-b502-3878ffc80161'][0]
         super(ElasticHostsTestCase, self).setUp()
 
@@ -165,8 +162,8 @@ class SkaliCloudTestCase(ElasticStackTestCase, unittest.TestCase):
         self.driver = SkaliCloud('foo', 'bar')
 
         images = self.driver.list_images()
-        self.image = [i for i in images if \
-                     i.id == '90aa51f2-15c0-4cff-81ee-e93aa20b9468'][0]
+        self.image = [i for i in images if
+                      i.id == '90aa51f2-15c0-4cff-81ee-e93aa20b9468'][0]
         super(SkaliCloudTestCase, self).setUp()
 
 
@@ -179,8 +176,8 @@ class ServerLoveTestCase(ElasticStackTestCase, unittest.TestCase):
         self.driver = ServerLove('foo', 'bar')
 
         images = self.driver.list_images()
-        self.image = [i for i in images if \
-                     i.id == '679f5f44-0be7-4745-a658-cccd4334c1aa'][0]
+        self.image = [i for i in images if
+                      i.id == '679f5f44-0be7-4745-a658-cccd4334c1aa'][0]
         super(ServerLoveTestCase, self).setUp()
 
 


[15/16] git commit: Update CHANGES.

Posted by to...@apache.org.
Update CHANGES.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/859fae70
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/859fae70
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/859fae70

Branch: refs/heads/trunk
Commit: 859fae704521dad5cb2eab4b270d0d39af32693d
Parents: 93c3db6
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 21:55:24 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 21:55:24 2013 +0200

----------------------------------------------------------------------
 CHANGES | 13 +++++++++++++
 1 file changed, 13 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/859fae70/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 0bac91b..9bbaa07 100644
--- a/CHANGES
+++ b/CHANGES
@@ -147,6 +147,19 @@ Changes with Apache Libcloud in development
       release.
       [Tomaz Muraus]
 
+    - Deprecate the following ElasticHosts provider constants: ELASTICHOSTS_UK1,
+      ELASTICHOSTS_UK2, ELASTICHOSTS_US1, ELASTICHOSTS_US2, ELASTICHOSTS_US3,
+      ELASTICHOSTS_CA1, ELASTICHOSTS_AU1, ELASTICHOSTS_CN1 and replace it with a
+      new ELASTICHOSTS constant.
+      Driver referenced by this new constant now takes a "region" argument which
+      dictates to which region to connect.
+
+      Note: Deprecated constants will continue to work until the next major
+      release. For more information on those changes and how to upgrade your
+      code, please visit "Upgrade Notes" documentation page -
+      http://s.apache.org/lc0140un (LIBCLOUD-383)
+      [Michael Bennett, Tomaz Muraus]
+
   *) Storage
 
     - Deprecate CLOUDFILES_US and CLOUDFILES_UK provider constant and replace


[14/16] git commit: Use unittest2.

Posted by to...@apache.org.
Use unittest2.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/93c3db67
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/93c3db67
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/93c3db67

Branch: refs/heads/trunk
Commit: 93c3db6772259b76187dc3044df78770811fd838
Parents: 1519257
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 21:14:52 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 21:14:52 2013 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_elasticstack.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/93c3db67/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index fa9a387..530c12d 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -14,7 +14,6 @@
 # limitations under the License.
 
 import sys
-import unittest
 from libcloud.utils.py3 import httplib
 
 from libcloud.compute.base import Node
@@ -27,7 +26,7 @@ from libcloud.compute.drivers.serverlove import \
     ServerLoveNodeDriver as ServerLove
 from libcloud.common.types import InvalidCredsError, MalformedResponseError
 
-from libcloud.test import MockHttp
+from libcloud.test import MockHttp, unittest
 from libcloud.test.file_fixtures import ComputeFileFixtures
 
 


[13/16] git commit: Indicate which constants have been deprecated.

Posted by to...@apache.org.
Indicate which constants have been deprecated.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/1519257f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/1519257f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/1519257f

Branch: refs/heads/trunk
Commit: 1519257f6e0735f6088c002e9c9fe3f5a2d10973
Parents: bba0c2c
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 21:11:18 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 21:11:18 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/types.py | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/1519257f/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index bae12ef..bf0d158 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -92,14 +92,6 @@ class Provider(object):
     OPENNEBULA = 'opennebula'
     DREAMHOST = 'dreamhost'
     ELASTICHOSTS = 'elastichosts'
-    ELASTICHOSTS_UK1 = 'elastichosts_uk1'
-    ELASTICHOSTS_UK2 = 'elastichosts_uk2'
-    ELASTICHOSTS_US1 = 'elastichosts_us1'
-    ELASTICHOSTS_US2 = 'elastichosts_us2'
-    ELASTICHOSTS_US3 = 'elastichosts_us3'
-    ELASTICHOSTS_CA1 = 'elastichosts_ca1'
-    ELASTICHOSTS_AU1 = 'elastichosts_au1'
-    ELASTICHOSTS_CN1 = 'elastichosts_cn1'
     BRIGHTBOX = 'brightbox'
     CLOUDSIGMA = 'cloudsigma'
     NIMBUS = 'nimbus'
@@ -135,6 +127,15 @@ class Provider(object):
     EC2_SA_EAST = 'ec2_sa_east'
     EC2_AP_SOUTHEAST2 = 'ec2_ap_southeast_2'
 
+    ELASTICHOSTS_UK1 = 'elastichosts_uk1'
+    ELASTICHOSTS_UK2 = 'elastichosts_uk2'
+    ELASTICHOSTS_US1 = 'elastichosts_us1'
+    ELASTICHOSTS_US2 = 'elastichosts_us2'
+    ELASTICHOSTS_US3 = 'elastichosts_us3'
+    ELASTICHOSTS_CA1 = 'elastichosts_ca1'
+    ELASTICHOSTS_AU1 = 'elastichosts_au1'
+    ELASTICHOSTS_CN1 = 'elastichosts_cn1'
+
     # Deprecated constants which aren't supported anymore
     RACKSPACE_UK = 'rackspace_uk'
     RACKSPACE_NOVA_BETA = 'rackspace_nova_beta'
@@ -191,7 +192,8 @@ class DeploymentError(LibcloudError):
     """
     Exception used when a Deployment Task failed.
 
-    :ivar node: :class:`Node` on which this exception happened, you might want to call :class:`Node.destroy`
+    :ivar node: :class:`Node` on which this exception happened, you might want
+                to call :func:`Node.destroy`
     """
     def __init__(self, node, original_exception=None, driver=None):
         self.node = node


[03/16] git commit: docs: Fix a typo.

Posted by to...@apache.org.
docs: Fix a typo.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/c03723d9
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/c03723d9
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/c03723d9

Branch: refs/heads/trunk
Commit: c03723d9195eb330698ca980f3c3739ebc5b6aa0
Parents: 090bb02
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:03:44 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:03:44 2013 +0200

----------------------------------------------------------------------
 docs/storage/drivers/google_storage.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/c03723d9/docs/storage/drivers/google_storage.rst
----------------------------------------------------------------------
diff --git a/docs/storage/drivers/google_storage.rst b/docs/storage/drivers/google_storage.rst
index eb454ce..e9b89d3 100644
--- a/docs/storage/drivers/google_storage.rst
+++ b/docs/storage/drivers/google_storage.rst
@@ -16,7 +16,7 @@ project id header.
 API Docs
 --------
 
-.. autoclass:: libcloud.storage.driver.google_storage.GoogleStorageDriver
+.. autoclass:: libcloud.storage.drivers.google_storage.GoogleStorageDriver
     :members:
     :inherited-members:
 


[05/16] git commit: Update CHANGES.

Posted by to...@apache.org.
Update CHANGES.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/845cb9a5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/845cb9a5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/845cb9a5

Branch: refs/heads/trunk
Commit: 845cb9a54ca6f11eb8fc7f48ce7793438e4ef202
Parents: 104d9ba
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:14:37 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:17:12 2013 +0200

----------------------------------------------------------------------
 CHANGES | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/845cb9a5/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index ac5ea27..0bac91b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -33,9 +33,9 @@ Changes with Apache Libcloud in development
       Driver referenced by this new constant now takes a "region" argument which
       dictates to which region to connect.
 
-      Note: Deprecated constants will continue to work for the foreseeable
-      future. For more information on those changes and how to upgrade your
-      code, please visit "Upgrade Noted" documentation page -
+      Note: Deprecated constants will continue to work until the next major
+      release. For more information on those changes and how to upgrade your
+      code, please visit "Upgrade Notes" documentation page -
       http://s.apache.org/lc0140un
       [Tomaz Muraus]
 
@@ -63,7 +63,7 @@ Changes with Apache Libcloud in development
       in EC2 ad OpenStack driver.
       Argument in the EC2 driver has been renamed from ex_securitygroup to
       ex_security_groups. For backward compatibility reasons, old argument
-      will continue to work for the unforeseeable future. (LIBCLOUD-375)
+      will continue to work until the next major release. (LIBCLOUD-375)
       [Tomaz Muraus]
 
     - Add ex_import_keypair_from_string and ex_import_keypair method to the
@@ -154,8 +154,8 @@ Changes with Apache Libcloud in development
       Driver referenced by this new constant takes a "region" keyword argument
       which can be one of 'ord', 'dfw', 'iad', 'syd', 'lon'.
 
-      Note: Deprecated constants will continue to work for the foreseeable
-      future.
+      Note: Deprecated constants will continue to work until the next major
+      release.
       For more information on this change, please visit "Upgrade Notes"
       documentation section - http://s.apache.org/lc0140un
       [Tomaz Muraus]
@@ -177,8 +177,8 @@ Changes with Apache Libcloud in development
       Driver referenced by this new constant takes a "region" keyword argument
       which can be one of the following: 'ord', 'dfw', 'iad', 'syd', 'lon'.
 
-      Note: Deprecated constants will continue to work for the foreseeable
-      future.
+      Note: Deprecated constants will continue to work until the next major
+      release.
       For more information on this change, please visit "Upgrade Notes"
       documentation section - http://s.apache.org/lc0140un
       [Tomaz Muraus]
@@ -193,8 +193,8 @@ Changes with Apache Libcloud in development
       Driver referenced by this new constant takes a "region" keyword argument
       which can be one of the following: 'us', 'uk'.
 
-      Note: Deprecated constants will continue to work for the foreseeable
-      future.
+      Note: Deprecated constants will continue to work until the next major
+      release.
       For more information on this change, please visit "Upgrade Notes"
       documentation section - http://s.apache.org/lc0140un
       [Tomaz Muraus]
@@ -207,8 +207,9 @@ Changes with Apache Libcloud in development
      documentation section - http://s.apache.org/lc0140un
      [Tomaz Muraus]
 
-   - Add method "export_zone_to_bind_format" which allows users to export
-     Libcloud Zone to BIND zone format. (LIBCLOUD-398)
+   - Add "export_zone_to_bind_format" and export_zone_to_bind_zone_file method
+     which allows users to export Libcloud Zone to BIND zone format.
+     (LIBCLOUD-398)
      [Tomaz Muraus]
 
 Changes with Apache Libcloud 0.13.2


[07/16] git commit: Modify ElasticHosts driver to take region argument (w.i.p.).

Posted by to...@apache.org.
Modify ElasticHosts driver to take region argument (w.i.p.).

Signed-off-by: Tomaz Muraus <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cafef120
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cafef120
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cafef120

Branch: refs/heads/trunk
Commit: cafef12052f53235fe6d972bfa7b78f846f90aea
Parents: 296e073
Author: Michael <mi...@securitycompass.com>
Authored: Mon Aug 26 12:47:04 2013 -0400
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:33:21 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/elastichosts.py | 100 +++++++++++++++-----------
 libcloud/compute/providers.py            |   9 +++
 libcloud/compute/types.py                |  10 ++-
 3 files changed, 73 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cafef120/libcloud/compute/drivers/elastichosts.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elastichosts.py b/libcloud/compute/drivers/elastichosts.py
index ea801ee..a649984 100644
--- a/libcloud/compute/drivers/elastichosts.py
+++ b/libcloud/compute/drivers/elastichosts.py
@@ -19,7 +19,6 @@ ElasticHosts Driver
 
 from libcloud.compute.types import Provider
 from libcloud.compute.drivers.elasticstack import ElasticStackBaseNodeDriver
-from libcloud.compute.drivers.elasticstack import ElasticStackBaseConnection
 
 
 # API end-points
@@ -122,91 +121,106 @@ STANDARD_DRIVES = {
 }
 
 
-class ElasticHostsBaseConnection(ElasticStackBaseConnection):
-    host = API_ENDPOINTS[DEFAULT_ENDPOINT]['host']
+class ElasticHostsException(Exception):
+    def __str__(self):
+        return self.args[0]
 
+    def __repr__(self):
+        return "<ElasticHostsException '%s'>" % (self.args[0])
 
-class ElasticHostsBaseNodeDriver(ElasticStackBaseNodeDriver):
+
+class ElasticHostsNodeDriver(ElasticStackBaseNodeDriver):
+    """
+    Node Driver class for ElasticHosts
+    """
     type = Provider.ELASTICHOSTS
     api_name = 'elastichosts'
     name = 'ElasticHosts'
     website = 'http://www.elastichosts.com/'
-    connectionCls = ElasticHostsBaseConnection
     features = {"create_node": ["generates_password"]}
     _standard_drives = STANDARD_DRIVES
 
+    def __init__(self, key, secret=None, secure=True, host=None, port=None,
+                 region=None, **kwargs):
 
-class ElasticHostsUK1Connection(ElasticStackBaseConnection):
-    """
-    Connection class for the ElasticHosts driver for
-    the London Peer 1 end-point
-    """
+        if hasattr(self, '_region'):
+            region = self._region
 
-    host = API_ENDPOINTS['uk-1']['host']
+        if region is not None:
 
+            if region not in API_ENDPOINTS:
+                raise ValueError('Invalid region: %s' % (region))
 
-class ElasticHostsUK1NodeDriver(ElasticHostsBaseNodeDriver):
-    """
-    ElasticHosts node driver for the London Peer 1 end-point
-    """
-    connectionCls = ElasticHostsUK1Connection
+            self.region = region
+            self._host_argument_set = host is not None
+        elif region is None and host is None:
+            raise ValueError("ElasticHosts Driver requires at least a region or a host argument to be specified")
+
+        super(ElasticHostsNodeDriver, self).__init__(key=key, secret=secret,
+                                                     secure=secure, host=host,
+                                                     port=port, **kwargs)
 
+    def _ex_connection_class_kwargs(self):
+        """
+        Return the host value based the user supplied region
+        """
+        if self._host_argument_set:
+            return {}
+        else:
+            return {'host': API_ENDPOINTS[self.region]['host']}
 
-class ElasticHostsUK2Connection(ElasticStackBaseConnection):
+
+class ElasticHostsUK1NodeDriver(ElasticHostsNodeDriver):
     """
-    Connection class for the ElasticHosts driver for
-    the London Bluesquare end-point
+    ElasticHosts node driver for the London Peer 1 end-point
     """
-    host = API_ENDPOINTS['uk-2']['host']
+    _region = 'uk-1'
 
 
-class ElasticHostsUK2NodeDriver(ElasticHostsBaseNodeDriver):
+class ElasticHostsUK2NodeDriver(ElasticHostsNodeDriver):
     """
     ElasticHosts node driver for the London Bluesquare end-point
     """
-    connectionCls = ElasticHostsUK2Connection
+    _region = 'uk-2'
 
 
-class ElasticHostsUS1Connection(ElasticStackBaseConnection):
+class ElasticHostsUS1NodeDriver(ElasticHostsNodeDriver):
     """
-    Connection class for the ElasticHosts driver for
-    the San Antonio Peer 1 end-point
+    ElasticHosts node driver for the San Antonio Peer 1 end-point
     """
-    host = API_ENDPOINTS['us-1']['host']
+    _region = 'us-1'
 
 
-class ElasticHostsUS1NodeDriver(ElasticHostsBaseNodeDriver):
+class ElasticHostsUS2NodeDriver(ElasticHostsNodeDriver):
     """
-    ElasticHosts node driver for the San Antonio Peer 1 end-point
+    ElasticHosts node driver for the Los Angeles Peer 1 end-point
     """
-    connectionCls = ElasticHostsUS1Connection
+    _region = 'us-2'
 
 
-class ElasticHostsUS2Connection(ElasticStackBaseConnection):
+class ElasticHostsUS3NodeDriver(ElasticHostsNodeDriver):
     """
-    Connection class for the ElasticHosts driver for
-    the Los Angeles Peer 1 end-point
+    ElasticHosts node driver for the San Jose (Silicon Valley) end-point
     """
-    host = API_ENDPOINTS['us-2']['host']
+    _region = 'us-3'
 
 
-class ElasticHostsUS2NodeDriver(ElasticHostsBaseNodeDriver):
+class ElasticHostsCA1NodeDriver(ElasticHostsNodeDriver):
     """
-    ElasticHosts node driver for the Los Angeles Peer 1 end-point
+    ElasticHosts node driver for the Toronto Peer 1 end-point
     """
-    connectionCls = ElasticHostsUS2Connection
+    _region = 'ca-1'
 
 
-class ElasticHostsCA1Connection(ElasticStackBaseConnection):
+class ElasticHostsAU1NodeDriver(ElasticHostsNodeDriver):
     """
-    Connection class for the ElasticHosts driver for
-    the Toronto Peer 1 end-point
+    ElasticHosts node driver for the Sydney end-point
     """
-    host = API_ENDPOINTS['ca-1']['host']
+    _region = 'au-1'
 
 
-class ElasticHostsCA1NodeDriver(ElasticHostsBaseNodeDriver):
+class ElasticHostsCN1NodeDriver(ElasticHostsNodeDriver):
     """
-    ElasticHosts node driver for the Toronto Peer 1 end-point
+    ElasticHosts node driver for the Hong Kong end-point
     """
-    connectionCls = ElasticHostsCA1Connection
+    _region = 'cn-1'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cafef120/libcloud/compute/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py
index 32c60d6..82aa75a 100644
--- a/libcloud/compute/providers.py
+++ b/libcloud/compute/providers.py
@@ -47,6 +47,8 @@ DRIVERS = {
         ('libcloud.compute.drivers.ec2', 'EC2APSESydneyNodeDriver'),
     Provider.ECP:
         ('libcloud.compute.drivers.ecp', 'ECPNodeDriver'),
+    Provider.ELASTICHOSTS:
+        ('libcloud.compute.drivers.elastichosts', 'ElasticHostsNodeDriver'),
     Provider.ELASTICHOSTS_UK1:
         ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUK1NodeDriver'),
     Provider.ELASTICHOSTS_UK2:
@@ -55,8 +57,14 @@ DRIVERS = {
         ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS1NodeDriver'),
     Provider.ELASTICHOSTS_US2:
         ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS2NodeDriver'),
+    Provider.ELASTICHOSTS_US3:
+        ('libcloud.compute.drivers.elastichosts', 'ElasticHostsUS3NodeDriver'),
     Provider.ELASTICHOSTS_CA1:
         ('libcloud.compute.drivers.elastichosts', 'ElasticHostsCA1NodeDriver'),
+    Provider.ELASTICHOSTS_AU1:
+        ('libcloud.compute.drivers.elastichosts', 'ElasticHostsAU1NodeDriver'),
+    Provider.ELASTICHOSTS_CN1:
+        ('libcloud.compute.drivers.elastichosts', 'ElasticHostsCN1NodeDriver'),
     Provider.SKALICLOUD:
         ('libcloud.compute.drivers.skalicloud', 'SkaliCloudNodeDriver'),
     Provider.SERVERLOVE:
@@ -146,5 +154,6 @@ def get_driver(provider):
 
     return _get_provider_driver(DRIVERS, provider)
 
+
 def set_driver(provider, module, klass):
     return _set_provider_driver(DRIVERS, provider, module, klass)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cafef120/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index aefbf5a..bae12ef 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -32,7 +32,7 @@ __all__ = [
     "InvalidCredsException",
     "DEPRECATED_RACKSPACE_PROVIDERS",
     "OLD_CONSTANT_TO_NEW_MAPPING"
-    ]
+]
 
 
 class Provider(object):
@@ -56,6 +56,7 @@ class Provider(object):
     :cvar IBM: IBM Developer Cloud
     :cvar OPENNEBULA: OpenNebula.org
     :cvar DREAMHOST: DreamHost Private Server
+    :cvar ELASTICHOSTS: ElasticHosts.com
     :cvar CLOUDSIGMA: CloudSigma
     :cvar NIMBUS: Nimbus
     :cvar BLUEBOX: Bluebox
@@ -94,6 +95,11 @@ class Provider(object):
     ELASTICHOSTS_UK1 = 'elastichosts_uk1'
     ELASTICHOSTS_UK2 = 'elastichosts_uk2'
     ELASTICHOSTS_US1 = 'elastichosts_us1'
+    ELASTICHOSTS_US2 = 'elastichosts_us2'
+    ELASTICHOSTS_US3 = 'elastichosts_us3'
+    ELASTICHOSTS_CA1 = 'elastichosts_ca1'
+    ELASTICHOSTS_AU1 = 'elastichosts_au1'
+    ELASTICHOSTS_CN1 = 'elastichosts_cn1'
     BRIGHTBOX = 'brightbox'
     CLOUDSIGMA = 'cloudsigma'
     NIMBUS = 'nimbus'
@@ -108,8 +114,6 @@ class Provider(object):
     CLOUDSTACK = 'cloudstack'
     CLOUDSIGMA_US = 'cloudsigma_us'
     LIBVIRT = 'libvirt'
-    ELASTICHOSTS_US2 = 'elastichosts_us2'
-    ELASTICHOSTS_CA1 = 'elastichosts_ca1'
     JOYENT = 'joyent'
     VCL = 'vcl'
     KTUCLOUD = 'ktucloud'


[16/16] git commit: docs: Update upgrade notes.

Posted by to...@apache.org.
docs: Update upgrade notes.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7cb7423f
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7cb7423f
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7cb7423f

Branch: refs/heads/trunk
Commit: 7cb7423f363f0e1137b036e7ab9d3f8abefbb062
Parents: 859fae7
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 22:04:59 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 22:04:59 2013 +0200

----------------------------------------------------------------------
 docs/upgrade_notes.rst | 59 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 58 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7cb7423f/docs/upgrade_notes.rst
----------------------------------------------------------------------
diff --git a/docs/upgrade_notes.rst b/docs/upgrade_notes.rst
index fab3e35..b2433a3 100644
--- a/docs/upgrade_notes.rst
+++ b/docs/upgrade_notes.rst
@@ -176,7 +176,7 @@ New code (connecting to a next-gen provider)
     driver2 = cls('username', 'api_key', region='dfw')
     driver3 = cls('username', 'api_key', region='lon')
 
-CloudStack Compute driver changes
+CloudStack compute driver changes
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 CloudStack driver received a lot of changes and additions which will make it
@@ -230,6 +230,63 @@ Old code:
 
     driver = cls('username', 'api_key', region='us-east-1')
 
+ElasticHosts compute driver changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ElasticHosts compute driver has moved to single class plus ``region`` argument
+model. As such, the following provider constants have been deprecated:
+
+* ``ELASTICHOSTS_UK1``
+* ``ELASTICHOSTS_UK1``
+* ``ELASTICHOSTS_US1``
+* ``ELASTICHOSTS_US2``
+* ``ELASTICHOSTS_US3``
+* ``ELASTICHOSTS_CA1``
+* ``ELASTICHOSTS_AU1``
+* ``ELASTICHOSTS_CN1``
+
+And replaced with a single constant:
+
+* ``ELASTICHOSTS`` - Supported values for the ``region`` argument are:
+  ``lon-p``, ``lon-b``, ``sat-p``, ``lax-p``, ``sjc-c``, ``tor-p``, ``syd-y``,
+  ``cn-1`` Default value is ``sat-p``.
+
+List which shows how old classes map to a new ``region`` argument value:
+
+* ``ELASTICHOSTS_UK1`` -> ``lon-p``
+* ``ELASTICHOSTS_UK1`` -> ``lon-b``
+* ``ELASTICHOSTS_US1`` -> ``sat-p``
+* ``ELASTICHOSTS_US2`` -> ``lax-p``
+* ``ELASTICHOSTS_US3`` -> ``sjc-c``
+* ``ELASTICHOSTS_CA1`` -> ``tor-p``
+* ``ELASTICHOSTS_AU1`` -> ``syd-y``
+* ``ELASTICHOSTS_CN1`` -> ``cn-1``
+
+Old code:
+
+.. sourcecode:: python
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    cls1 = get_driver(Provider.ELASTICHOSTS_UK1)
+    cls2 = get_driver(Provider.ELASTICHOSTS_US2)
+
+    driver1 = cls('username', 'api_key')
+    driver2 = cls('username', 'api_key')
+
+New code:
+
+.. sourcecode:: python
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    cls = get_driver(Provider.ELASTICHOSTS)
+
+    driver1 = cls('username', 'api_key', region='lon-p')
+    driver2 = cls('username', 'api_key', region='lax-p')
+
 Unification of extension arguments for security group handling in the EC2 driver
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


[10/16] git commit: Re-apply reverted changes and more progress on region support in elastichosts driver.

Posted by to...@apache.org.
Re-apply reverted changes and more progress on region support in elastichosts
driver.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/63052050
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/63052050
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/63052050

Branch: refs/heads/trunk
Commit: 630520501ec29cff8572b903110f342cdbe38b3e
Parents: 9d9aeb3
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:44:33 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:44:33 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/elastichosts.py | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/63052050/libcloud/compute/drivers/elastichosts.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elastichosts.py b/libcloud/compute/drivers/elastichosts.py
index a649984..2b713d2 100644
--- a/libcloud/compute/drivers/elastichosts.py
+++ b/libcloud/compute/drivers/elastichosts.py
@@ -66,7 +66,7 @@ API_ENDPOINTS = {
 }
 
 # Default API end-point for the base connection class.
-DEFAULT_ENDPOINT = 'us-1'
+DEFAULT_REGION = 'us-1'
 
 # Retrieved from http://www.elastichosts.com/cloud-hosting/api
 STANDARD_DRIVES = {
@@ -88,6 +88,12 @@ STANDARD_DRIVES = {
         'size_gunzipped': '1GB',
         'supports_deployment': True,
     },
+    '62f512cd-82c7-498e-88d8-a09ac2ef20e7': {
+        'uuid': '62f512cd-82c7-498e-88d8-a09ac2ef20e7',
+        'description': 'Ubuntu Linux 12.04',
+        'size_gunzipped': '1GB',
+        'supports_deployment': True,
+    },
     'b9d0eb72-d273-43f1-98e3-0d4b87d372c0': {
         'uuid': 'b9d0eb72-d273-43f1-98e3-0d4b87d372c0',
         'description': 'Windows Web Server 2008',
@@ -141,28 +147,23 @@ class ElasticHostsNodeDriver(ElasticStackBaseNodeDriver):
     _standard_drives = STANDARD_DRIVES
 
     def __init__(self, key, secret=None, secure=True, host=None, port=None,
-                 region=None, **kwargs):
+                 region=DEFAULT_REGION, **kwargs):
 
         if hasattr(self, '_region'):
             region = self._region
 
-        if region is not None:
-
-            if region not in API_ENDPOINTS:
-                raise ValueError('Invalid region: %s' % (region))
-
-            self.region = region
-            self._host_argument_set = host is not None
-        elif region is None and host is None:
-            raise ValueError("ElasticHosts Driver requires at least a region or a host argument to be specified")
+        if region not in API_ENDPOINTS:
+            raise ValueError('Invalid region: %s' % (region))
 
+        self._host_argument_set = host is not None
         super(ElasticHostsNodeDriver, self).__init__(key=key, secret=secret,
                                                      secure=secure, host=host,
-                                                     port=port, **kwargs)
+                                                     port=port,
+                                                     region=region, **kwargs)
 
     def _ex_connection_class_kwargs(self):
         """
-        Return the host value based the user supplied region
+        Return the host value based on the user supplied region.
         """
         if self._host_argument_set:
             return {}


[08/16] git commit: Use super instead.

Posted by to...@apache.org.
Use super instead.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7f2ebd85
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7f2ebd85
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7f2ebd85

Branch: refs/heads/trunk
Commit: 7f2ebd8560adc3cfc1f430eada250385c3c633c5
Parents: cafef12
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:41:53 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:42:35 2013 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_elasticstack.py | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/7f2ebd85/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index 5d30bbd..1fb5718 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -23,7 +23,7 @@ from libcloud.compute.drivers.elasticstack import (ElasticStackException,
                               ElasticStackBaseConnection,
                               ElasticStackBaseNodeDriver as ElasticStack)
 from libcloud.compute.drivers.elastichosts import \
-                              (ElasticHostsBaseNodeDriver as ElasticHosts)
+                              (ElasticHostsNodeDriver as ElasticHosts)
 from libcloud.compute.drivers.skalicloud import \
                               (SkaliCloudNodeDriver as SkaliCloud)
 from libcloud.compute.drivers.serverlove import \
@@ -153,9 +153,7 @@ class ElasticHostsTestCase(ElasticStackTestCase, unittest.TestCase):
         images = self.driver.list_images()
         self.image = [i for i in images if \
                       i.id == '38df0986-4d85-4b76-b502-3878ffc80161'][0]
-
-        ElasticStackTestCase.setUp(self)
-        unittest.TestCase.setUp(self)
+        super(ElasticHostsTestCase, self).setUp()
 
 
 class SkaliCloudTestCase(ElasticStackTestCase, unittest.TestCase):
@@ -169,9 +167,7 @@ class SkaliCloudTestCase(ElasticStackTestCase, unittest.TestCase):
         images = self.driver.list_images()
         self.image = [i for i in images if \
                      i.id == '90aa51f2-15c0-4cff-81ee-e93aa20b9468'][0]
-
-        ElasticStackTestCase.setUp(self)
-        unittest.TestCase.setUp(self)
+        super(SkaliCloudTestCase, self).setUp()
 
 
 class ServerLoveTestCase(ElasticStackTestCase, unittest.TestCase):
@@ -185,9 +181,7 @@ class ServerLoveTestCase(ElasticStackTestCase, unittest.TestCase):
         images = self.driver.list_images()
         self.image = [i for i in images if \
                      i.id == '679f5f44-0be7-4745-a658-cccd4334c1aa'][0]
-
-        ElasticStackTestCase.setUp(self)
-        unittest.TestCase.setUp(self)
+        super(ServerLoveTestCase, self).setUp()
 
 
 class ElasticStackMockHttp(MockHttp):


[12/16] git commit: Add tests for the new region functionality in the ElasticHosts driver.

Posted by to...@apache.org.
Add tests for the new region functionality in the ElasticHosts driver.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bba0c2c9
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bba0c2c9
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bba0c2c9

Branch: refs/heads/trunk
Commit: bba0c2c92f6dab7024f37c62a3db6fae019e0f30
Parents: e3e1713
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 21:09:27 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 21:09:27 2013 +0200

----------------------------------------------------------------------
 libcloud/test/compute/test_elasticstack.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/bba0c2c9/libcloud/test/compute/test_elasticstack.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_elasticstack.py b/libcloud/test/compute/test_elasticstack.py
index 71577d1..fa9a387 100644
--- a/libcloud/test/compute/test_elasticstack.py
+++ b/libcloud/test/compute/test_elasticstack.py
@@ -152,6 +152,25 @@ class ElasticHostsTestCase(ElasticStackTestCase, unittest.TestCase):
                       i.id == '38df0986-4d85-4b76-b502-3878ffc80161'][0]
         super(ElasticHostsTestCase, self).setUp()
 
+    def test_multiple_drivers_with_different_regions(self):
+        driver1 = ElasticHosts('foo', 'bar', region='lon-p')
+        driver2 = ElasticHosts('foo', 'bar', region='sat-p')
+
+        self.assertTrue(driver1.connection.host.startswith('api-lon-p'))
+        self.assertTrue(driver2.connection.host.startswith('api-sat-p'))
+
+        driver1.list_nodes()
+        driver2.list_nodes()
+        driver1.list_nodes()
+
+        self.assertTrue(driver1.connection.host.startswith('api-lon-p'))
+        self.assertTrue(driver2.connection.host.startswith('api-sat-p'))
+
+    def test_invalid_region(self):
+        expected_msg = r'Invalid region.+'
+        self.assertRaisesRegexp(ValueError, expected_msg, ElasticHosts,
+                                'foo', 'bar', region='invalid')
+
 
 class SkaliCloudTestCase(ElasticStackTestCase, unittest.TestCase):
 


[04/16] git commit: Document argument type in the ec2 driver.

Posted by to...@apache.org.
Document argument type in the ec2 driver.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/104d9ba0
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/104d9ba0
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/104d9ba0

Branch: refs/heads/trunk
Commit: 104d9ba043f19b04ee1ea0bb7922c4e1de867c54
Parents: c03723d
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:11:45 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:11:45 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/ec2.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/104d9ba0/libcloud/compute/drivers/ec2.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/ec2.py b/libcloud/compute/drivers/ec2.py
index 5096ce5..6437a8f 100644
--- a/libcloud/compute/drivers/ec2.py
+++ b/libcloud/compute/drivers/ec2.py
@@ -731,6 +731,10 @@ class BaseEC2NodeDriver(NodeDriver):
         return volumes
 
     def create_volume(self, size, name, location=None, snapshot=None):
+        """
+        :param location: Datacenter in which to create a volume in.
+        :type location: :class:`ExEC2AvailabilityZone`
+        """
         params = {
             'Action': 'CreateVolume',
             'Size': str(size)}


[02/16] git commit: docs: Update upgrade notes.

Posted by to...@apache.org.
docs: Update upgrade notes.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/090bb02c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/090bb02c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/090bb02c

Branch: refs/heads/trunk
Commit: 090bb02c6197cc3857112af3030e0dba7bce99b9
Parents: 66386bc
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 19:58:36 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 19:58:36 2013 +0200

----------------------------------------------------------------------
 docs/upgrade_notes.rst | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/090bb02c/docs/upgrade_notes.rst
----------------------------------------------------------------------
diff --git a/docs/upgrade_notes.rst b/docs/upgrade_notes.rst
index ad7e4c0..fab3e35 100644
--- a/docs/upgrade_notes.rst
+++ b/docs/upgrade_notes.rst
@@ -199,6 +199,37 @@ more pleasant to use. Backward incompatible changes are listed bellow:
   ``image``, ``location`` plus ``ex_keyname``, ``ex_userdata``,
   ``ex_security_groups`` and ``networks``.
 
+Joyent compute driver changes
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Joyent driver has been aligned with other drivers and now the constructor takes
+``region`` instead of ``location`` argument.
+
+For backward compatibility reasons, old argument will continue to work until the
+next major release.
+
+Old code:
+
+.. sourcecode:: python
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    cls = get_driver(Provider.JOYENT)
+
+    driver = cls('username', 'api_key', location='us-east-1')
+
+Old code:
+
+.. sourcecode:: python
+
+    from libcloud.compute.types import Provider
+    from libcloud.compute.providers import get_driver
+
+    cls = get_driver(Provider.JOYENT)
+
+    driver = cls('username', 'api_key', region='us-east-1')
+
 Unification of extension arguments for security group handling in the EC2 driver
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 


[06/16] git commit: Revert some changes so I can apply patch cleanly.

Posted by to...@apache.org.
Revert some changes so I can apply patch cleanly.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/296e0738
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/296e0738
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/296e0738

Branch: refs/heads/trunk
Commit: 296e0738694b2a70780b90d4827f229cf5b8fe1c
Parents: 845cb9a
Author: Tomaz Muraus <to...@apache.org>
Authored: Thu Oct 17 20:30:22 2013 +0200
Committer: Tomaz Muraus <to...@apache.org>
Committed: Thu Oct 17 20:31:41 2013 +0200

----------------------------------------------------------------------
 libcloud/compute/drivers/elastichosts.py | 11 -----------
 1 file changed, 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/296e0738/libcloud/compute/drivers/elastichosts.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/elastichosts.py b/libcloud/compute/drivers/elastichosts.py
index fcc1215..ea801ee 100644
--- a/libcloud/compute/drivers/elastichosts.py
+++ b/libcloud/compute/drivers/elastichosts.py
@@ -89,12 +89,6 @@ STANDARD_DRIVES = {
         'size_gunzipped': '1GB',
         'supports_deployment': True,
     },
-    '62f512cd-82c7-498e-88d8-a09ac2ef20e7': {
-        'uuid': '62f512cd-82c7-498e-88d8-a09ac2ef20e7',
-        'description': 'Ubuntu Linux 12.04',
-        'size_gunzipped': '1GB',
-        'supports_deployment': True,
-    },
     'b9d0eb72-d273-43f1-98e3-0d4b87d372c0': {
         'uuid': 'b9d0eb72-d273-43f1-98e3-0d4b87d372c0',
         'description': 'Windows Web Server 2008',
@@ -156,7 +150,6 @@ class ElasticHostsUK1NodeDriver(ElasticHostsBaseNodeDriver):
     ElasticHosts node driver for the London Peer 1 end-point
     """
     connectionCls = ElasticHostsUK1Connection
-    name = 'ElasticHosts (uk-1)'
 
 
 class ElasticHostsUK2Connection(ElasticStackBaseConnection):
@@ -172,7 +165,6 @@ class ElasticHostsUK2NodeDriver(ElasticHostsBaseNodeDriver):
     ElasticHosts node driver for the London Bluesquare end-point
     """
     connectionCls = ElasticHostsUK2Connection
-    name = 'ElasticHosts (uk-2)'
 
 
 class ElasticHostsUS1Connection(ElasticStackBaseConnection):
@@ -188,7 +180,6 @@ class ElasticHostsUS1NodeDriver(ElasticHostsBaseNodeDriver):
     ElasticHosts node driver for the San Antonio Peer 1 end-point
     """
     connectionCls = ElasticHostsUS1Connection
-    name = 'ElasticHosts (us-1)'
 
 
 class ElasticHostsUS2Connection(ElasticStackBaseConnection):
@@ -204,7 +195,6 @@ class ElasticHostsUS2NodeDriver(ElasticHostsBaseNodeDriver):
     ElasticHosts node driver for the Los Angeles Peer 1 end-point
     """
     connectionCls = ElasticHostsUS2Connection
-    name = 'ElasticHosts (us-2)'
 
 
 class ElasticHostsCA1Connection(ElasticStackBaseConnection):
@@ -220,4 +210,3 @@ class ElasticHostsCA1NodeDriver(ElasticHostsBaseNodeDriver):
     ElasticHosts node driver for the Toronto Peer 1 end-point
     """
     connectionCls = ElasticHostsCA1Connection
-    name = 'ElasticHosts (ca-1)'