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:46 UTC
[10/16] git commit: Re-apply reverted changes and more progress on
region support in elastichosts driver.
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 {}