libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthonys...@apache.org
Subject [2/4] libcloud git commit: Remove driver for DreamHost vps API
Date Wed, 09 Dec 2015 10:40:43 GMT
Remove driver for DreamHost vps API

Signed-off-by: Anthony Shaw <anthony.p.shaw@gmail.com>


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

Branch: refs/heads/trunk
Commit: cefebefbb91e02506f1b4d837f7af0d92424223b
Parents: d15614c
Author: Stefano Maffulli <stefano@maffulli.net>
Authored: Mon Dec 7 10:47:46 2015 -0800
Committer: Anthony Shaw <anthony.p.shaw@gmail.com>
Committed: Wed Dec 9 21:28:14 2015 +1100

----------------------------------------------------------------------
 demos/secrets.py-dist                           |   1 -
 .../_supported_methods_block_storage.rst        |   2 -
 .../_supported_methods_image_management.rst     |   2 -
 .../_supported_methods_key_pair_management.rst  |   2 -
 docs/compute/_supported_methods_main.rst        |   2 -
 docs/compute/_supported_providers.rst           |   2 -
 .../examples/http_proxy/constructor_argument.py |   7 -
 libcloud/compute/drivers/dreamhost.py           | 242 ----------------
 libcloud/compute/providers.py                   |   2 -
 libcloud/compute/types.py                       |   2 -
 libcloud/data/pricing.json                      |   9 +-
 libcloud/test/compute/test_dreamhost.py         | 284 -------------------
 libcloud/test/secrets.py-dist                   |   1 -
 13 files changed, 1 insertion(+), 557 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/demos/secrets.py-dist
----------------------------------------------------------------------
diff --git a/demos/secrets.py-dist b/demos/secrets.py-dist
index 981286d..a4c52c5 100644
--- a/demos/secrets.py-dist
+++ b/demos/secrets.py-dist
@@ -18,7 +18,6 @@
 
 BLUEBOX_PARAMS = ('customer_id', 'api_key')
 BRIGHTBOX_PARAMS = ('client_id', 'client_secret')
-DREAMHOST_PARAMS = ('key',)
 EC2_PARAMS = ('access_id', 'secret')
 ECP_PARAMS = ('user_name', 'password')
 GANDI_PARAMS = ('user',)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/compute/_supported_methods_block_storage.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_block_storage.rst b/docs/compute/_supported_methods_block_storage.rst
index fddeb71..e2f34ed 100644
--- a/docs/compute/_supported_methods_block_storage.rst
+++ b/docs/compute/_supported_methods_block_storage.rst
@@ -14,7 +14,6 @@ Provider                              list volumes create volume destroy
volume
 `Cloudwatt`_                          yes          yes           yes            yes     
     yes           yes            yes            
 `DigitalOcean`_                       no           no            no             no      
     no            no             no             
 `DimensionData`_                      no           no            no             no      
     no            no             no             
-`DreamHost VPS`_                      no           no            no             no      
     no            no             no             
 `Amazon EC2`_                         yes          yes           yes            yes     
     yes           yes            yes            
 `Amazon EC2 (ap-northeast-1)`_        yes          yes           yes            yes     
     yes           yes            yes            
 `Amazon EC2 (ap-southeast-1)`_        yes          yes           yes            yes     
     yes           yes            yes            
@@ -87,7 +86,6 @@ Provider                              list volumes create volume destroy
volume
 .. _`Cloudwatt`: https://www.cloudwatt.com/
 .. _`DigitalOcean`: https://www.digitalocean.com
 .. _`DimensionData`: http://www.dimensiondata.com/
-.. _`DreamHost VPS`: http://dreamhost.com/
 .. _`Amazon EC2`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-northeast-1)`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-southeast-1)`: http://aws.amazon.com/ec2/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/compute/_supported_methods_image_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_image_management.rst b/docs/compute/_supported_methods_image_management.rst
index ad5e58f..bcd6d6b 100644
--- a/docs/compute/_supported_methods_image_management.rst
+++ b/docs/compute/_supported_methods_image_management.rst
@@ -14,7 +14,6 @@ Provider                              list images get image create image
delete
 `Cloudwatt`_                          yes         yes       yes          yes          no
       
 `DigitalOcean`_                       yes         yes       yes          yes          no
       
 `DimensionData`_                      yes         no        no           no           no
       
-`DreamHost VPS`_                      yes         no        no           no           no
       
 `Amazon EC2`_                         yes         yes       yes          yes          yes
      
 `Amazon EC2 (ap-northeast-1)`_        yes         yes       yes          yes          yes
      
 `Amazon EC2 (ap-southeast-1)`_        yes         yes       yes          yes          yes
      
@@ -87,7 +86,6 @@ Provider                              list images get image create image
delete
 .. _`Cloudwatt`: https://www.cloudwatt.com/
 .. _`DigitalOcean`: https://www.digitalocean.com
 .. _`DimensionData`: http://www.dimensiondata.com/
-.. _`DreamHost VPS`: http://dreamhost.com/
 .. _`Amazon EC2`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-northeast-1)`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-southeast-1)`: http://aws.amazon.com/ec2/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/compute/_supported_methods_key_pair_management.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_key_pair_management.rst b/docs/compute/_supported_methods_key_pair_management.rst
index cbb3545..b0cfce4 100644
--- a/docs/compute/_supported_methods_key_pair_management.rst
+++ b/docs/compute/_supported_methods_key_pair_management.rst
@@ -14,7 +14,6 @@ Provider                              list key pairs get key pair create
key pai
 `Cloudwatt`_                          yes            yes          yes             yes   
                       no                          yes            
 `DigitalOcean`_                       yes            yes          yes             no    
                       no                          yes            
 `DimensionData`_                      no             no           no              no    
                       no                          no             
-`DreamHost VPS`_                      no             no           no              no    
                       no                          no             
 `Amazon EC2`_                         yes            yes          yes             yes   
                       no                          yes            
 `Amazon EC2 (ap-northeast-1)`_        yes            yes          yes             yes   
                       no                          yes            
 `Amazon EC2 (ap-southeast-1)`_        yes            yes          yes             yes   
                       no                          yes            
@@ -87,7 +86,6 @@ Provider                              list key pairs get key pair create
key pai
 .. _`Cloudwatt`: https://www.cloudwatt.com/
 .. _`DigitalOcean`: https://www.digitalocean.com
 .. _`DimensionData`: http://www.dimensiondata.com/
-.. _`DreamHost VPS`: http://dreamhost.com/
 .. _`Amazon EC2`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-northeast-1)`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-southeast-1)`: http://aws.amazon.com/ec2/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/compute/_supported_methods_main.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_methods_main.rst b/docs/compute/_supported_methods_main.rst
index 22741d9..67c8966 100644
--- a/docs/compute/_supported_methods_main.rst
+++ b/docs/compute/_supported_methods_main.rst
@@ -14,7 +14,6 @@ Provider                              list nodes create node reboot node
destroy
 `Cloudwatt`_                          yes        yes         yes         yes          yes
        yes        yes        
 `DigitalOcean`_                       yes        yes         yes         yes          yes
        yes        no         
 `DimensionData`_                      yes        yes         yes         yes          yes
        yes        yes        
-`DreamHost VPS`_                      yes        yes         yes         yes          yes
        yes        no         
 `Amazon EC2`_                         yes        yes         yes         yes          yes
        yes        yes        
 `Amazon EC2 (ap-northeast-1)`_        yes        yes         yes         yes          yes
        yes        yes        
 `Amazon EC2 (ap-southeast-1)`_        yes        yes         yes         yes          yes
        yes        yes        
@@ -87,7 +86,6 @@ Provider                              list nodes create node reboot node
destroy
 .. _`Cloudwatt`: https://www.cloudwatt.com/
 .. _`DigitalOcean`: https://www.digitalocean.com
 .. _`DimensionData`: http://www.dimensiondata.com/
-.. _`DreamHost VPS`: http://dreamhost.com/
 .. _`Amazon EC2`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-northeast-1)`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-southeast-1)`: http://aws.amazon.com/ec2/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/compute/_supported_providers.rst
----------------------------------------------------------------------
diff --git a/docs/compute/_supported_providers.rst b/docs/compute/_supported_providers.rst
index 239b5d4..ab7b9d9 100644
--- a/docs/compute/_supported_providers.rst
+++ b/docs/compute/_supported_providers.rst
@@ -14,7 +14,6 @@ Provider                              Documentation
 `Cloudwatt`_                          :doc:`Click </compute/drivers/cloudwatt>`   
 CLOUDWATT           :mod:`libcloud.compute.drivers.cloudwatt`      :class:`CloudwattNodeDriver`
       
 `DigitalOcean`_                       :doc:`Click </compute/drivers/digital_ocean>`
DIGITAL_OCEAN       :mod:`libcloud.compute.drivers.digitalocean`   :class:`DigitalOceanNodeDriver`
    
 `DimensionData`_                      :doc:`Click </compute/drivers/dimensiondata>`
DIMENSIONDATA       :mod:`libcloud.compute.drivers.dimensiondata`  :class:`DimensionDataNodeDriver`
   
-`DreamHost VPS`_                                                                    DREAMHOST
          :mod:`libcloud.compute.drivers.dreamhost`      :class:`DreamhostNodeDriver`    
   
 `Amazon EC2`_                         :doc:`Click </compute/drivers/ec2>`         
 EC2                 :mod:`libcloud.compute.drivers.ec2`            :class:`EC2NodeDriver`
             
 `Amazon EC2 (ap-northeast-1)`_                                                      EC2_AP_NORTHEAST
   :mod:`libcloud.compute.drivers.ec2`            :class:`EC2APNENodeDriver`          
 `Amazon EC2 (ap-southeast-1)`_                                                      EC2_AP_SOUTHEAST
   :mod:`libcloud.compute.drivers.ec2`            :class:`EC2APSENodeDriver`          
@@ -87,7 +86,6 @@ Provider                              Documentation
 .. _`Cloudwatt`: https://www.cloudwatt.com/
 .. _`DigitalOcean`: https://www.digitalocean.com
 .. _`DimensionData`: http://www.dimensiondata.com/
-.. _`DreamHost VPS`: http://dreamhost.com/
 .. _`Amazon EC2`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-northeast-1)`: http://aws.amazon.com/ec2/
 .. _`Amazon EC2 (ap-southeast-1)`: http://aws.amazon.com/ec2/

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/docs/examples/http_proxy/constructor_argument.py
----------------------------------------------------------------------
diff --git a/docs/examples/http_proxy/constructor_argument.py b/docs/examples/http_proxy/constructor_argument.py
deleted file mode 100644
index 3542beb..0000000
--- a/docs/examples/http_proxy/constructor_argument.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from libcloud.compute.drivers.dreamhost import DreamhostConnection
-
-PROXY_URL_NO_AUTH = 'http://<proxy hostname>:<proxy port>'
-PROXY_URL_BASIC_AUTH = 'http://<user>:<pass>@<proxy hostname>:<proxy
port>'
-
-conn = DreamhostConnection(host='dreamhost.com', port=443,
-                           timeout=None, proxy_url=PROXY_URL_NO_AUTH)

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/compute/drivers/dreamhost.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/drivers/dreamhost.py b/libcloud/compute/drivers/dreamhost.py
deleted file mode 100644
index b291178..0000000
--- a/libcloud/compute/drivers/dreamhost.py
+++ /dev/null
@@ -1,242 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-"""
-DreamHost Driver
-"""
-
-import copy
-
-from libcloud.common.base import ConnectionKey, JsonResponse
-from libcloud.common.types import InvalidCredsError
-from libcloud.compute.base import Node, NodeDriver, NodeSize
-from libcloud.compute.base import NodeImage
-from libcloud.compute.types import Provider, NodeState
-
-# DreamHost Private Servers can be resized on the fly, but Libcloud doesn't
-# currently support extensions to its interface, so we'll put some basic sizes
-# in for node creation.
-
-DH_PS_SIZES = {
-    'minimum': {
-        'id': 'minimum',
-        'name': 'Minimum DH PS size',
-        'ram': 300,
-        'disk': None,
-        'bandwidth': None
-    },
-    'maximum': {
-        'id': 'maximum',
-        'name': 'Maximum DH PS size',
-        'ram': 4000,
-        'disk': None,
-        'bandwidth': None
-    },
-    'default': {
-        'id': 'default',
-        'name': 'Default DH PS size',
-        'ram': 2300,
-        'disk': None,
-        'bandwidth': None
-    },
-    'low': {
-        'id': 'low',
-        'name': 'DH PS with 1GB RAM',
-        'ram': 1000,
-        'disk': None,
-        'bandwidth': None
-    },
-    'high': {
-        'id': 'high',
-        'name': 'DH PS with 3GB RAM',
-        'ram': 3000,
-        'disk': None,
-        'bandwidth': None
-    },
-}
-
-
-class DreamhostAPIException(Exception):
-    def __str__(self):
-        return self.args[0]
-
-    def __repr__(self):
-        return "<DreamhostException '%s'>" % (self.args[0])
-
-
-class DreamhostResponse(JsonResponse):
-    """
-    Response class for DreamHost PS
-    """
-
-    def parse_body(self):
-        resp = super(DreamhostResponse, self).parse_body()
-        if resp['result'] != 'success':
-            raise Exception(self._api_parse_error(resp))
-        return resp['data']
-
-    def parse_error(self):
-        raise Exception
-
-    def _api_parse_error(self, response):
-        if 'data' in response:
-            if response['data'] == 'invalid_api_key':
-                raise InvalidCredsError(
-                    "Oops!  You've entered an invalid API key")
-            else:
-                raise DreamhostAPIException(response['data'])
-        else:
-            raise DreamhostAPIException("Unknown problem: %s" % (self.body))
-
-
-class DreamhostConnection(ConnectionKey):
-    """
-    Connection class to connect to DreamHost's API servers
-    """
-
-    host = 'api.dreamhost.com'
-    responseCls = DreamhostResponse
-    format = 'json'
-
-    def add_default_params(self, params):
-        """
-        Add key and format parameters to the request.  Eventually should add
-        unique_id to prevent re-execution of a single request.
-        """
-        params['key'] = self.key
-        params['format'] = self.format
-        # params['unique_id'] = generate_unique_id()
-        return params
-
-
-class DreamhostNodeDriver(NodeDriver):
-    """
-    Node Driver for DreamHost PS
-    """
-    type = Provider.DREAMHOST
-    api_name = 'dreamhost'
-    name = "DreamHost VPS"
-    website = 'http://dreamhost.com/'
-    connectionCls = DreamhostConnection
-
-    _sizes = DH_PS_SIZES
-
-    def create_node(self, **kwargs):
-        """Create a new Dreamhost node
-
-        @inherits: :class:`NodeDriver.create_node`
-
-        :keyword    ex_movedata: Copy all your existing users to this new PS
-        :type       ex_movedata: ``str``
-        """
-        size = kwargs['size'].ram
-        params = {
-            'cmd': 'dreamhost_ps-add_ps',
-            'movedata': kwargs.get('movedata', 'no'),
-            'type': kwargs['image'].name,
-            'size': size
-        }
-        data = self.connection.request('/', params).object
-        return Node(
-            id=data['added_web'],
-            name=data['added_web'],
-            state=NodeState.PENDING,
-            public_ips=[],
-            private_ips=[],
-            driver=self.connection.driver,
-            extra={
-                'type': kwargs['image'].name
-            }
-        )
-
-    def destroy_node(self, node):
-        params = {
-            'cmd': 'dreamhost_ps-remove_ps',
-            'ps': node.id
-        }
-        try:
-            return self.connection.request('/', params).success()
-        except DreamhostAPIException:
-            return False
-
-    def reboot_node(self, node):
-        params = {
-            'cmd': 'dreamhost_ps-reboot',
-            'ps': node.id
-        }
-        try:
-            return self.connection.request('/', params).success()
-        except DreamhostAPIException:
-            return False
-
-    def list_nodes(self, **kwargs):
-        data = self.connection.request(
-            '/', {'cmd': 'dreamhost_ps-list_ps'}).object
-        return [self._to_node(n) for n in data]
-
-    def list_images(self, **kwargs):
-        data = self.connection.request(
-            '/', {'cmd': 'dreamhost_ps-list_images'}).object
-        images = []
-        for img in data:
-            images.append(NodeImage(
-                id=img['image'],
-                name=img['image'],
-                driver=self.connection.driver
-            ))
-        return images
-
-    def list_sizes(self, **kwargs):
-        sizes = []
-        for key, values in self._sizes.items():
-            attributes = copy.deepcopy(values)
-            attributes.update({'price': self._get_size_price(size_id=key)})
-            sizes.append(NodeSize(driver=self.connection.driver, **attributes))
-
-        return sizes
-
-    def list_locations(self, **kwargs):
-        raise NotImplementedError(
-            'You cannot select a location for '
-            'DreamHost Private Servers at this time.')
-
-    def _resize_node(self, node, size):
-        if (size < 300 or size > 4000):
-            return False
-
-        params = {
-            'cmd': 'dreamhost_ps-set_size',
-            'ps': node.id,
-            'size': size
-        }
-        try:
-            return self.connection.request('/', params).success()
-        except DreamhostAPIException:
-            return False
-
-    def _to_node(self, data):
-        """
-        Convert the data from a DreamhostResponse object into a Node
-        """
-        return Node(
-            id=data['ps'],
-            name=data['ps'],
-            state=NodeState.UNKNOWN,
-            public_ips=[data['ip']],
-            private_ips=[],
-            driver=self.connection.driver,
-            extra={
-                'current_size': data['memory_mb'],
-                'account_id': data['account_id'],
-                'type': data['type']})

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/compute/providers.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/providers.py b/libcloud/compute/providers.py
index a1ede8e..f296bc1 100644
--- a/libcloud/compute/providers.py
+++ b/libcloud/compute/providers.py
@@ -101,8 +101,6 @@ DRIVERS = {
     ('libcloud.compute.drivers.ibm_sce', 'IBMNodeDriver'),
     Provider.OPENNEBULA:
     ('libcloud.compute.drivers.opennebula', 'OpenNebulaNodeDriver'),
-    Provider.DREAMHOST:
-    ('libcloud.compute.drivers.dreamhost', 'DreamhostNodeDriver'),
     Provider.BRIGHTBOX:
     ('libcloud.compute.drivers.brightbox', 'BrightboxNodeDriver'),
     Provider.NIMBUS:

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/compute/types.py
----------------------------------------------------------------------
diff --git a/libcloud/compute/types.py b/libcloud/compute/types.py
index b9d194f..27bcfd7 100644
--- a/libcloud/compute/types.py
+++ b/libcloud/compute/types.py
@@ -54,7 +54,6 @@ class Provider(object):
     :cvar ECP: Enomaly
     :cvar IBM: IBM Developer Cloud
     :cvar OPENNEBULA: OpenNebula.org
-    :cvar DREAMHOST: DreamHost Private Server
     :cvar ELASTICHOSTS: ElasticHosts.com
     :cvar CLOUDSIGMA: CloudSigma
     :cvar NIMBUS: Nimbus
@@ -98,7 +97,6 @@ class Provider(object):
     ECP = 'ecp'
     IBM = 'ibm'
     OPENNEBULA = 'opennebula'
-    DREAMHOST = 'dreamhost'
     ELASTICHOSTS = 'elastichosts'
     BRIGHTBOX = 'brightbox'
     CLOUDSIGMA = 'cloudsigma'

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/data/pricing.json
----------------------------------------------------------------------
diff --git a/libcloud/data/pricing.json b/libcloud/data/pricing.json
index 1d20196..6e3a3c5 100644
--- a/libcloud/data/pricing.json
+++ b/libcloud/data/pricing.json
@@ -28,14 +28,7 @@
             "standard-large": 0.381,
             "standard-small": 0.0796
         },
-        "dreamhost": {
-            "default": 115,
-            "high": 150,
-            "low": 50,
-            "maximum": 200,
-            "minimum": 15
-        },
-        "ec2_ap_northeast": {
+       "ec2_ap_northeast": {
             "c1.medium": "0.158",
             "c1.xlarge": "0.632",
             "c3.large": "0.128",

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/test/compute/test_dreamhost.py
----------------------------------------------------------------------
diff --git a/libcloud/test/compute/test_dreamhost.py b/libcloud/test/compute/test_dreamhost.py
deleted file mode 100644
index 3f41726..0000000
--- a/libcloud/test/compute/test_dreamhost.py
+++ /dev/null
@@ -1,284 +0,0 @@
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import sys
-import unittest
-from libcloud.utils.py3 import httplib
-
-try:
-    import simplejson as json
-except ImportError:
-    import json
-
-from libcloud.common.types import InvalidCredsError
-from libcloud.compute.drivers.dreamhost import DreamhostNodeDriver
-from libcloud.compute.types import NodeState
-
-from libcloud.test import MockHttp
-from libcloud.test.compute import TestCaseMixin
-from libcloud.test.secrets import DREAMHOST_PARAMS
-
-
-class DreamhostTest(unittest.TestCase, TestCaseMixin):
-
-    def setUp(self):
-        DreamhostNodeDriver.connectionCls.conn_classes = (
-            None,
-            DreamhostMockHttp
-        )
-        DreamhostMockHttp.type = None
-        DreamhostMockHttp.use_param = 'cmd'
-        self.driver = DreamhostNodeDriver(*DREAMHOST_PARAMS)
-
-    def test_invalid_creds(self):
-        """
-        Tests the error-handling for passing a bad API Key to the DreamHost API
-        """
-        DreamhostMockHttp.type = 'BAD_AUTH'
-        try:
-            self.driver.list_nodes()
-            self.assertTrue(
-                False)  # Above command should have thrown an InvalidCredsException
-        except InvalidCredsError:
-            pass
-
-    def test_list_nodes(self):
-        """
-        Test list_nodes for DreamHost PS driver.  Should return a list of two nodes:
-            -   account_id: 000000
-                ip: 75.119.203.51
-                memory_mb: 500
-                ps: ps22174
-                start_date: 2010-02-25
-                type: web
-            -   account_id: 000000
-                ip: 75.119.203.52
-                memory_mb: 1500
-                ps: ps22175
-                start_date: 2010-02-25
-                type: mysql
-        """
-
-        nodes = self.driver.list_nodes()
-        self.assertEqual(len(nodes), 2)
-        web_node = nodes[0]
-        mysql_node = nodes[1]
-
-        # Web node tests
-        self.assertEqual(web_node.id, 'ps22174')
-        self.assertEqual(web_node.state, NodeState.UNKNOWN)
-        self.assertTrue('75.119.203.51' in web_node.public_ips)
-        self.assertTrue(
-            'current_size' in web_node.extra and
-            web_node.extra['current_size'] == 500
-        )
-        self.assertTrue(
-            'account_id' in web_node.extra and
-            web_node.extra['account_id'] == 000000
-        )
-        self.assertTrue(
-            'type' in web_node.extra and
-            web_node.extra['type'] == 'web'
-        )
-        # MySql node tests
-        self.assertEqual(mysql_node.id, 'ps22175')
-        self.assertEqual(mysql_node.state, NodeState.UNKNOWN)
-        self.assertTrue('75.119.203.52' in mysql_node.public_ips)
-        self.assertTrue(
-            'current_size' in mysql_node.extra and
-            mysql_node.extra['current_size'] == 1500
-        )
-        self.assertTrue(
-            'account_id' in mysql_node.extra and
-            mysql_node.extra['account_id'] == 000000
-        )
-        self.assertTrue(
-            'type' in mysql_node.extra and
-            mysql_node.extra['type'] == 'mysql'
-        )
-
-    def test_create_node(self):
-        """
-        Test create_node for DreamHost PS driver.
-        This is not remarkably compatible with libcloud.  The DH API allows
-        users to specify what image they want to create and whether to move
-        all their data to the (web) PS. It does NOT accept a name, size, or
-        location.  The only information it returns is the PS's context id
-        Once the PS is ready it will appear in the list generated by list_ps.
-        """
-        new_node = self.driver.create_node(
-            image=self.driver.list_images()[0],
-            size=self.driver.list_sizes()[0],
-            movedata='no',
-        )
-        self.assertEqual(new_node.id, 'ps12345')
-        self.assertEqual(new_node.state, NodeState.PENDING)
-        self.assertTrue(
-            'type' in new_node.extra and
-            new_node.extra['type'] == 'web'
-        )
-
-    def test_destroy_node(self):
-        """
-        Test destroy_node for DreamHost PS driver
-        """
-        node = self.driver.list_nodes()[0]
-        self.assertTrue(self.driver.destroy_node(node))
-
-    def test_destroy_node_failure(self):
-        """
-        Test destroy_node failure for DreamHost PS driver
-        """
-        node = self.driver.list_nodes()[0]
-
-        DreamhostMockHttp.type = 'API_FAILURE'
-        self.assertFalse(self.driver.destroy_node(node))
-
-    def test_reboot_node(self):
-        """
-        Test reboot_node for DreamHost PS driver.
-        """
-        node = self.driver.list_nodes()[0]
-        self.assertTrue(self.driver.reboot_node(node))
-
-    def test_reboot_node_failure(self):
-        """
-        Test reboot_node failure for DreamHost PS driver
-        """
-        node = self.driver.list_nodes()[0]
-
-        DreamhostMockHttp.type = 'API_FAILURE'
-        self.assertFalse(self.driver.reboot_node(node))
-
-    def test_resize_node(self):
-        """
-        Test resize_node for DreamHost PS driver
-        """
-        node = self.driver.list_nodes()[0]
-        self.assertTrue(self.driver._resize_node(node, 400))
-
-    def test_resize_node_failure(self):
-        """
-        Test reboot_node faliure for DreamHost PS driver
-        """
-        node = self.driver.list_nodes()[0]
-
-        DreamhostMockHttp.type = 'API_FAILURE'
-        self.assertFalse(self.driver._resize_node(node, 400))
-
-    def test_list_images(self):
-        """
-        Test list_images for DreamHost PS driver.
-        """
-        images = self.driver.list_images()
-        self.assertEqual(len(images), 2)
-        self.assertEqual(images[0].id, 'web')
-        self.assertEqual(images[0].name, 'web')
-        self.assertEqual(images[1].id, 'mysql')
-        self.assertEqual(images[1].name, 'mysql')
-
-    def test_list_sizes(self):
-        sizes = self.driver.list_sizes()
-        self.assertEqual(len(sizes), 5)
-
-        size = [s for s in sizes if s.id == 'default'][0]
-        self.assertEqual(size.id, 'default')
-        self.assertEqual(size.bandwidth, None)
-        self.assertEqual(size.disk, None)
-        self.assertEqual(size.ram, 2300)
-        self.assertEqual(size.price, 115)
-
-    def test_list_locations(self):
-        try:
-            self.driver.list_locations()
-        except NotImplementedError:
-            pass
-
-    def test_list_locations_response(self):
-        self.assertRaises(NotImplementedError, self.driver.list_locations)
-
-
-class DreamhostMockHttp(MockHttp):
-
-    def _BAD_AUTH_dreamhost_ps_list_ps(self, method, url, body, headers):
-        body = json.dumps({'data': 'invalid_api_key', 'result': 'error'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_add_ps(self, method, url, body, headers):
-        body = json.dumps(
-            {'data': {'added_web': 'ps12345'}, 'result': 'success'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_list_ps(self, method, url, body, headers):
-        data = [{
-            'account_id': 000000,
-            'ip': '75.119.203.51',
-            'memory_mb': 500,
-            'ps': 'ps22174',
-            'start_date': '2010-02-25',
-            'type': 'web'
-        },
-            {
-                'account_id': 000000,
-                'ip': '75.119.203.52',
-                'memory_mb': 1500,
-                'ps': 'ps22175',
-                'start_date': '2010-02-25',
-                'type': 'mysql'
-        }]
-        result = 'success'
-        body = json.dumps({'data': data, 'result': result})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_list_images(self, method, url, body, headers):
-        data = [{
-            'description': 'Private web server',
-            'image': 'web'
-        },
-            {
-                'description': 'Private MySQL server',
-                'image': 'mysql'
-        }]
-        result = 'success'
-        body = json.dumps({'data': data, 'result': result})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_reboot(self, method, url, body, headers):
-        body = json.dumps({'data': 'reboot_scheduled', 'result': 'success'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _API_FAILURE_dreamhost_ps_reboot(self, method, url, body, headers):
-        body = json.dumps({'data': 'no_such_ps', 'result': 'error'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_set_size(self, method, url, body, headers):
-        body = json.dumps(
-            {'data': {'memory-mb': '500'}, 'result': 'success'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _API_FAILURE_dreamhost_ps_set_size(self, method, url, body, headers):
-        body = json.dumps(
-            {'data': 'internal_error_setting_size', 'result': 'error'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _dreamhost_ps_remove_ps(self, method, url, body, headers):
-        body = json.dumps({'data': 'removed_web', 'result': 'success'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-    def _API_FAILURE_dreamhost_ps_remove_ps(self, method, url, body, headers):
-        body = json.dumps({'data': 'no_such_ps', 'result': 'error'})
-        return (httplib.OK, body, {}, httplib.responses[httplib.OK])
-
-if __name__ == '__main__':
-    sys.exit(unittest.main())

http://git-wip-us.apache.org/repos/asf/libcloud/blob/cefebefb/libcloud/test/secrets.py-dist
----------------------------------------------------------------------
diff --git a/libcloud/test/secrets.py-dist b/libcloud/test/secrets.py-dist
index 411b6a4..cb0ab4a 100644
--- a/libcloud/test/secrets.py-dist
+++ b/libcloud/test/secrets.py-dist
@@ -18,7 +18,6 @@
 
 BLUEBOX_PARAMS = ('customer_id', 'api_key')
 BRIGHTBOX_PARAMS = ('client_id', 'client_secret')
-DREAMHOST_PARAMS = ('key',)
 EC2_PARAMS = ('access_id', 'secret')
 ECP_PARAMS = ('user_name', 'password')
 GANDI_PARAMS = ('user',)


Mime
View raw message