From 3991797483c6f00576c5448a21fd8e0c78dd8612 Mon Sep 17 00:00:00 2001 From: Randall Burt Date: Mon, 9 Sep 2013 18:02:49 -0500 Subject: [PATCH] Move Rackspace resources into contrib Using plain discover to run tests in contrib until I can figure out how to make that work via testr. Closes bug: 1220798 Change-Id: I5669b90152efabfacbc4b786a67cd1f4b139521a --- contrib/rackspace/README.md | 19 +++++++++++++++++++ contrib/rackspace/__init__.py | 0 contrib/rackspace/heat/__init__.py | 0 contrib/rackspace/heat/engine/__init__.py | 0 .../rackspace/heat/engine/plugins/__init__.py | 0 .../engine/plugins}/cloud_loadbalancer.py | 4 ++-- .../heat/engine/plugins}/cloud_server.py | 3 ++- .../heat/engine/plugins}/clouddatabase.py | 3 ++- .../engine/plugins}/rackspace_resource.py | 0 contrib/rackspace/heat/tests/__init__.py | 0 .../heat}/tests/test_cloud_loadbalancer.py | 17 +++++++++-------- .../heat}/tests/test_clouddatabase.py | 3 ++- .../tests/test_rackspace_cloud_server.py | 4 ++-- heat/engine/resources/rackspace/__init__.py | 4 ---- tox.ini | 9 ++++++++- 15 files changed, 46 insertions(+), 20 deletions(-) create mode 100644 contrib/rackspace/README.md create mode 100644 contrib/rackspace/__init__.py create mode 100644 contrib/rackspace/heat/__init__.py create mode 100644 contrib/rackspace/heat/engine/__init__.py create mode 100644 contrib/rackspace/heat/engine/plugins/__init__.py rename {heat/engine/resources/rackspace => contrib/rackspace/heat/engine/plugins}/cloud_loadbalancer.py (99%) rename {heat/engine/resources/rackspace => contrib/rackspace/heat/engine/plugins}/cloud_server.py (99%) rename {heat/engine/resources/rackspace => contrib/rackspace/heat/engine/plugins}/clouddatabase.py (99%) rename {heat/engine/resources/rackspace => contrib/rackspace/heat/engine/plugins}/rackspace_resource.py (100%) create mode 100644 contrib/rackspace/heat/tests/__init__.py rename {heat => contrib/rackspace/heat}/tests/test_cloud_loadbalancer.py (98%) rename {heat => contrib/rackspace/heat}/tests/test_clouddatabase.py (99%) rename {heat => contrib/rackspace/heat}/tests/test_rackspace_cloud_server.py (99%) delete mode 100644 heat/engine/resources/rackspace/__init__.py diff --git a/contrib/rackspace/README.md b/contrib/rackspace/README.md new file mode 100644 index 000000000..7c47c0da7 --- /dev/null +++ b/contrib/rackspace/README.md @@ -0,0 +1,19 @@ +# Heat resources for working with the Rackspace Cloud +The resources and configuration in this module are for using Heat with the Rackspace Cloud. These resources either +allow using Rackspace services that don't have equivalent services in Openstack or account for differences between +a generic Openstack deployment and Rackspace Cloud. +## Resources +The following resources are provided for compatibility: + +* `Rackspace::Cloud::Server`: +>Provide compatibility with `OS::Nova::Server` and allow for working `user_data` and `Metadata`. This is deprecated and should be replaced with `OS::Nova::Server` once service compatibility is implemented by Rackspace. + +* `Rackspace::Cloud::LoadBalancer`: +>Use the Rackspace Cloud Loadbalancer service; not compatible with `OS::Neutron::LoadBalancer`. + +* `Rackspace::Cloud::DatabaseInstance`: +>Use the Rackspace implementation of Trove. This is deprecated and should eventually be replaced with `OS::Trove::Instance` or similar. + +## Usage +### Templates +### Configuration \ No newline at end of file diff --git a/contrib/rackspace/__init__.py b/contrib/rackspace/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/rackspace/heat/__init__.py b/contrib/rackspace/heat/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/rackspace/heat/engine/__init__.py b/contrib/rackspace/heat/engine/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/contrib/rackspace/heat/engine/plugins/__init__.py b/contrib/rackspace/heat/engine/plugins/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/heat/engine/resources/rackspace/cloud_loadbalancer.py b/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py similarity index 99% rename from heat/engine/resources/rackspace/cloud_loadbalancer.py rename to contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py index beb12a140..54902d8e0 100644 --- a/heat/engine/resources/rackspace/cloud_loadbalancer.py +++ b/contrib/rackspace/heat/engine/plugins/cloud_loadbalancer.py @@ -1,5 +1,4 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 - # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain @@ -23,9 +22,10 @@ from heat.openstack.common import log as logging from heat.openstack.common.gettextutils import _ from heat.engine import scheduler from heat.engine.properties import Properties -from heat.engine.resources.rackspace import rackspace_resource from heat.common import exception +from . import rackspace_resource + logger = logging.getLogger(__name__) diff --git a/heat/engine/resources/rackspace/cloud_server.py b/contrib/rackspace/heat/engine/plugins/cloud_server.py similarity index 99% rename from heat/engine/resources/rackspace/cloud_server.py rename to contrib/rackspace/heat/engine/plugins/cloud_server.py index f4629b27a..a1ba424bd 100644 --- a/heat/engine/resources/rackspace/cloud_server.py +++ b/contrib/rackspace/heat/engine/plugins/cloud_server.py @@ -22,9 +22,10 @@ from heat.openstack.common import log as logging from heat.engine import scheduler from heat.engine.resources import instance from heat.engine.resources import nova_utils -from heat.engine.resources.rackspace import rackspace_resource from heat.db.sqlalchemy import api as db_api +from . import rackspace_resource + logger = logging.getLogger(__name__) diff --git a/heat/engine/resources/rackspace/clouddatabase.py b/contrib/rackspace/heat/engine/plugins/clouddatabase.py similarity index 99% rename from heat/engine/resources/rackspace/clouddatabase.py rename to contrib/rackspace/heat/engine/plugins/clouddatabase.py index f17cd7012..db80411eb 100644 --- a/heat/engine/resources/rackspace/clouddatabase.py +++ b/contrib/rackspace/heat/engine/plugins/clouddatabase.py @@ -21,9 +21,10 @@ except ImportError: pass from heat.common import exception -from heat.engine.resources.rackspace import rackspace_resource from heat.openstack.common import log as logging +from . import rackspace_resource + logger = logging.getLogger(__name__) diff --git a/heat/engine/resources/rackspace/rackspace_resource.py b/contrib/rackspace/heat/engine/plugins/rackspace_resource.py similarity index 100% rename from heat/engine/resources/rackspace/rackspace_resource.py rename to contrib/rackspace/heat/engine/plugins/rackspace_resource.py diff --git a/contrib/rackspace/heat/tests/__init__.py b/contrib/rackspace/heat/tests/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/heat/tests/test_cloud_loadbalancer.py b/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py similarity index 98% rename from heat/tests/test_cloud_loadbalancer.py rename to contrib/rackspace/heat/tests/test_cloud_loadbalancer.py index 6eb402679..e747a2598 100644 --- a/heat/tests/test_cloud_loadbalancer.py +++ b/contrib/rackspace/heat/tests/test_cloud_loadbalancer.py @@ -20,10 +20,11 @@ import copy from heat.common import template_format from heat.engine import scheduler from heat.engine import resource -from heat.engine.resources.rackspace import cloud_loadbalancer as lb from heat.tests.common import HeatTestCase from heat.tests import utils +from ..engine.plugins import cloud_loadbalancer as lb + # The following fakes are for pyrax @@ -103,10 +104,10 @@ class FakeLoadBalancerClient(object): self.VirtualIP = FakeVirtualIP pass - def get(*args, **kwargs): + def get(self, *args, **kwargs): pass - def create(*args, **kwargs): + def create(self, *args, **kwargs): pass @@ -120,19 +121,19 @@ class FakeLoadBalancer(object): self.VirtualIP = FakeVirtualIP self.nodes = [] - def get(*args, **kwargs): + def get(self, *args, **kwargs): pass - def add_nodes(*args, **kwargs): + def add_nodes(self, *args, **kwargs): pass - def add_ssl_termination(*args, **kwargs): + def add_ssl_termination(self, *args, **kwargs): pass - def set_error_page(*args, **kwargs): + def set_error_page(self, *args, **kwargs): pass - def add_access_list(*args, **kwargs): + def add_access_list(self, *args, **kwargs): pass diff --git a/heat/tests/test_clouddatabase.py b/contrib/rackspace/heat/tests/test_clouddatabase.py similarity index 99% rename from heat/tests/test_clouddatabase.py rename to contrib/rackspace/heat/tests/test_clouddatabase.py index 365be7bae..3b5bf4d4f 100644 --- a/heat/tests/test_clouddatabase.py +++ b/contrib/rackspace/heat/tests/test_clouddatabase.py @@ -17,11 +17,12 @@ from heat.common import template_format from heat.engine import parser from heat.engine import environment from heat.engine import resource -from heat.engine.resources.rackspace import clouddatabase from heat.openstack.common import uuidutils from heat.tests.common import HeatTestCase from heat.tests import utils +from ..engine.plugins import clouddatabase + wp_template = ''' { diff --git a/heat/tests/test_rackspace_cloud_server.py b/contrib/rackspace/heat/tests/test_rackspace_cloud_server.py similarity index 99% rename from heat/tests/test_rackspace_cloud_server.py rename to contrib/rackspace/heat/tests/test_rackspace_cloud_server.py index 7d53359f5..26fe13bb0 100644 --- a/heat/tests/test_rackspace_cloud_server.py +++ b/contrib/rackspace/heat/tests/test_rackspace_cloud_server.py @@ -24,12 +24,12 @@ from heat.engine import parser from heat.engine import resource from heat.engine import scheduler from heat.engine import environment -from heat.engine.resources.rackspace import cloud_server -from heat.engine.resources.rackspace import rackspace_resource from heat.openstack.common import uuidutils from heat.tests.common import HeatTestCase from heat.tests import utils +from ..engine.plugins import rackspace_resource +from ..engine.plugins import cloud_server wp_template = ''' { diff --git a/heat/engine/resources/rackspace/__init__.py b/heat/engine/resources/rackspace/__init__.py deleted file mode 100644 index 9fcc287d1..000000000 --- a/heat/engine/resources/rackspace/__init__.py +++ /dev/null @@ -1,4 +0,0 @@ -# pyrax client library is required to work with Rackspace cloud resources, -# such as rackspace cloud database, rackspace cloud servers etc... -# If pyrax client library is not installed, then heat-engine would not register -# the rackspace cloud resource providers. diff --git a/tox.ini b/tox.ini index da6a40c1b..e3710d5ae 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py26,py27,pep8 +envlist = py26,py27,pep8,contrib [testenv] setenv = VIRTUAL_ENV={envdir} @@ -9,6 +9,13 @@ commands = python tools/patch_tox_venv.py python setup.py testr --slowest --testr-args='{posargs}' +[testenv:contrib] +deps = -r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt +commands = + discover -s contrib/ {posargs} + flake8 --ignore=H304,F841,H201,H302,H306,H404 contrib + [testenv:pep8] commands = flake8 heat bin/heat-api bin/heat-api-cfn bin/heat-api-cloudwatch bin/heat-engine bin/heat-manage