Fix [H302] errors in heat/api

Change-Id: I1eee89a1ff1b011031cde89c5daa660735bf1eb1
changes/71/134171/2
Peter Razumovsky 8 years ago
parent a4d98f68ab
commit ddcdd1f77f
  1. 3
      heat/api/aws/ec2token.py
  2. 6
      heat/api/cfn/__init__.py
  3. 4
      heat/api/cfn/v1/__init__.py
  4. 10
      heat/api/cloudwatch/__init__.py
  5. 14
      heat/api/openstack/__init__.py
  6. 6
      heat/api/openstack/v1/util.py

@ -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()

@ -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)

@ -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

@ -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,
conf, **local_conf)
return vn.VersionNegotiationFilter(versions.Controller, app,
conf, **local_conf)

@ -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,
conf, **local_conf)
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)

@ -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,

Loading…
Cancel
Save