From 5e901f093616442e9ea1972cf64c44eacdc95763 Mon Sep 17 00:00:00 2001 From: Peter Razumovsky Date: Wed, 3 Jun 2015 17:49:47 +0300 Subject: [PATCH] Remove identical modules versions.py This patch removes identical modules versions.py in heat/api, moves this module to heat/api/versions.py and fix imports for new path of module. Change-Id: I9f92a9c07aaf5d2283af8642cdffc4c958e5b96b --- heat/api/cfn/versions.py | 47 ++++----------------------- heat/api/cloudwatch/__init__.py | 2 +- heat/api/openstack/versions.py | 47 ++++----------------------- heat/api/{cloudwatch => }/versions.py | 0 4 files changed, 13 insertions(+), 83 deletions(-) rename heat/api/{cloudwatch => }/versions.py (100%) diff --git a/heat/api/cfn/versions.py b/heat/api/cfn/versions.py index ffd7f945e..f5e761baf 100644 --- a/heat/api/cfn/versions.py +++ b/heat/api/cfn/versions.py @@ -11,46 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. +"""Controller that returns information on the heat API versions. + +Now it's an subclass of module versions, because of identity with openstack +module versions. """ -Controller that returns information on the heat API versions -""" +from heat.api import versions -from oslo_serialization import jsonutils -from six.moves import http_client -import webob.dec - - -class Controller(object): - - """ - A controller that produces information on the heat API versions. - """ - - def __init__(self, conf): - self.conf = conf - - @webob.dec.wsgify - def __call__(self, req): - """Respond to a request for all OpenStack API versions.""" - version_objs = [ - { - "id": "v1.0", - "status": "CURRENT", - "links": [ - { - "rel": "self", - "href": self.get_href(req) - }] - }] - - body = jsonutils.dumps(dict(versions=version_objs)) - - response = webob.Response(request=req, - status=http_client.MULTIPLE_CHOICES, - content_type='application/json') - response.body = body - - return response - - def get_href(self, req): - return "%s/v1/" % req.host_url +Controller = versions.Controller diff --git a/heat/api/cloudwatch/__init__.py b/heat/api/cloudwatch/__init__.py index 1ab2c4fd1..b32c84c6a 100644 --- a/heat/api/cloudwatch/__init__.py +++ b/heat/api/cloudwatch/__init__.py @@ -14,9 +14,9 @@ import routes import webob -from heat.api.cloudwatch import versions from heat.api.cloudwatch import watch from heat.api.middleware import version_negotiation as vn +from heat.api import versions from heat.common import wsgi diff --git a/heat/api/openstack/versions.py b/heat/api/openstack/versions.py index ffd7f945e..6ac02175d 100644 --- a/heat/api/openstack/versions.py +++ b/heat/api/openstack/versions.py @@ -11,46 +11,11 @@ # License for the specific language governing permissions and limitations # under the License. +"""Controller that returns information on the heat API versions. + +Now it's an subclass of module versions, because of identity with cfn module +versions. It can be changed, if there will be another API version. """ -Controller that returns information on the heat API versions -""" +from heat.api import versions -from oslo_serialization import jsonutils -from six.moves import http_client -import webob.dec - - -class Controller(object): - - """ - A controller that produces information on the heat API versions. - """ - - def __init__(self, conf): - self.conf = conf - - @webob.dec.wsgify - def __call__(self, req): - """Respond to a request for all OpenStack API versions.""" - version_objs = [ - { - "id": "v1.0", - "status": "CURRENT", - "links": [ - { - "rel": "self", - "href": self.get_href(req) - }] - }] - - body = jsonutils.dumps(dict(versions=version_objs)) - - response = webob.Response(request=req, - status=http_client.MULTIPLE_CHOICES, - content_type='application/json') - response.body = body - - return response - - def get_href(self, req): - return "%s/v1/" % req.host_url +Controller = versions.Controller diff --git a/heat/api/cloudwatch/versions.py b/heat/api/versions.py similarity index 100% rename from heat/api/cloudwatch/versions.py rename to heat/api/versions.py