Merge "Fix [H302] errors in heat/api"

This commit is contained in:
Jenkins 2014-11-18 09:45:05 +00:00 committed by Gerrit Code Review
commit 1914f40b50
6 changed files with 21 additions and 22 deletions

View File

@ -20,7 +20,6 @@ import requests
import webob
from heat.api.aws import exception
from heat.api.aws.exception import HeatAPIException
from heat.common.i18n import _
from heat.common.i18n import _LE
from heat.common.i18n import _LI
@ -127,7 +126,7 @@ class EC2Token(wsgi.Middleware):
try:
LOG.debug("Attempt authorize on %s" % auth_uri)
return self._authorize(req, auth_uri)
except HeatAPIException as e:
except exception.HeatAPIException as e:
LOG.debug("Authorize failed: %s" % e.__class__)
last_failure = e
raise last_failure or exception.HeatAccessDeniedError()

View File

@ -12,9 +12,9 @@
# under the License.
from heat.api.cfn import versions
from heat.api.middleware.version_negotiation import VersionNegotiationFilter
from heat.api.middleware import version_negotiation as vn
def version_negotiation_filter(app, conf, **local_conf):
return VersionNegotiationFilter(versions.Controller, app,
conf, **local_conf)
return vn.VersionNegotiationFilter(versions.Controller, app, conf,
**local_conf)

View File

@ -12,7 +12,7 @@
# under the License.
import routes
from webob import Request
import webob
from heat.api.cfn.v1 import signal
from heat.api.cfn.v1 import stacks
@ -54,7 +54,7 @@ class API(wsgi.Router):
api_action = self._actions[action]
def action_match(environ, result):
req = Request(environ)
req = webob.Request(environ)
env_action = req.params.get("Action")
return env_action == api_action

View File

@ -12,11 +12,11 @@
# under the License.
import routes
from webob import Request
import webob
from heat.api.cloudwatch import versions
from heat.api.cloudwatch import watch
from heat.api.middleware.version_negotiation import VersionNegotiationFilter
from heat.api.middleware import version_negotiation as vn
from heat.common import wsgi
@ -49,7 +49,7 @@ class API(wsgi.Router):
api_action = self._actions[action]
def action_match(environ, result):
req = Request(environ)
req = webob.Request(environ)
env_action = req.params.get("Action")
return env_action == api_action
@ -65,5 +65,5 @@ class API(wsgi.Router):
def version_negotiation_filter(app, conf, **local_conf):
return VersionNegotiationFilter(versions.Controller, app,
return vn.VersionNegotiationFilter(versions.Controller, app,
conf, **local_conf)

View File

@ -11,20 +11,20 @@
# License for the specific language governing permissions and limitations
# under the License.
from heat.api.middleware.fault import FaultWrapper
from heat.api.middleware.ssl import SSLMiddleware
from heat.api.middleware.version_negotiation import VersionNegotiationFilter
from heat.api.middleware import fault
from heat.api.middleware import ssl
from heat.api.middleware import version_negotiation as vn
from heat.api.openstack import versions
def version_negotiation_filter(app, conf, **local_conf):
return VersionNegotiationFilter(versions.Controller, app,
return vn.VersionNegotiationFilter(versions.Controller, app,
conf, **local_conf)
def faultwrap_filter(app, conf, **local_conf):
return FaultWrapper(app)
return fault.FaultWrapper(app)
def sslmiddleware_filter(app, conf, **local_conf):
return SSLMiddleware(app)
return ssl.SSLMiddleware(app)

View File

@ -11,7 +11,7 @@
# License for the specific language governing permissions and limitations
# under the License.
from functools import wraps
import functools
import six
from webob import exc
@ -28,7 +28,7 @@ def policy_enforce(handler):
This is a handler method decorator.
"""
@wraps(handler)
@functools.wraps(handler)
def handle_stack_method(controller, req, tenant_id, **kwargs):
if req.context.tenant_id != tenant_id:
raise exc.HTTPForbidden()
@ -48,7 +48,7 @@ def identified_stack(handler):
This is a handler method decorator.
"""
@policy_enforce
@wraps(handler)
@functools.wraps(handler)
def handle_stack_method(controller, req, stack_name, stack_id, **kwargs):
stack_identity = identifier.HeatIdentifier(req.context.tenant_id,
stack_name,