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
This commit is contained in:
parent
25cff7933d
commit
5e901f0936
|
@ -11,46 +11,11 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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
|
Controller = versions.Controller
|
||||||
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
|
|
||||||
|
|
|
@ -14,9 +14,9 @@
|
||||||
import routes
|
import routes
|
||||||
import webob
|
import webob
|
||||||
|
|
||||||
from heat.api.cloudwatch import versions
|
|
||||||
from heat.api.cloudwatch import watch
|
from heat.api.cloudwatch import watch
|
||||||
from heat.api.middleware import version_negotiation as vn
|
from heat.api.middleware import version_negotiation as vn
|
||||||
|
from heat.api import versions
|
||||||
from heat.common import wsgi
|
from heat.common import wsgi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,46 +11,11 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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
|
Controller = versions.Controller
|
||||||
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
|
|
||||||
|
|
Loading…
Reference in New Issue