Backslash continuations (nova.api.openstack)
Fixes bug #925286 Backslash continuations removal for package nova.api.openstack Change-Id: I204b6d53bea224859e23771d5f4c96c1aff6fd03
This commit is contained in:
parent
9a174189b4
commit
ade948dd77
|
@ -173,15 +173,19 @@ class AuthMiddleware(base_wsgi.Middleware):
|
|||
if user and token:
|
||||
res = webob.Response()
|
||||
res.headers['X-Auth-Token'] = token['token_hash']
|
||||
res.headers['X-Server-Management-Url'] = \
|
||||
token['server_management_url']
|
||||
_x_server_url = 'X-Server-Management-Url'
|
||||
_server_url = 'server_management_url'
|
||||
res.headers[_x_server_url] = token[_server_url]
|
||||
|
||||
if token['storage_url']:
|
||||
res.headers['X-Storage-Url'] = token['storage_url']
|
||||
_x_storage_url = 'X-Storage-Url'
|
||||
_storage_url = 'storage_url'
|
||||
res.headers[_x_storage_url] = token[_storage_url]
|
||||
|
||||
if token['cdn_management_url']:
|
||||
res.headers['X-CDN-Management-Url'] = \
|
||||
token['cdn_management_url']
|
||||
_x_cdn_url = 'X-CDN-Management-Url'
|
||||
_cdn_url = 'cdn_management_url'
|
||||
res.headers[_x_cdn_url] = token[_cdn_url]
|
||||
|
||||
res.content_type = 'text/plain'
|
||||
res.status = '204'
|
||||
|
|
|
@ -38,8 +38,7 @@ from nova.openstack.common import cfg
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
allow_instance_snapshots_opt = \
|
||||
cfg.BoolOpt('allow_instance_snapshots',
|
||||
allow_instance_snapshots_opt = cfg.BoolOpt('allow_instance_snapshots',
|
||||
default=True,
|
||||
help='Permit instance snapshot operations.')
|
||||
|
||||
|
|
|
@ -97,8 +97,8 @@ class Certificates(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "Certificates"
|
||||
alias = "os-certificates"
|
||||
namespace = \
|
||||
"http://docs.openstack.org/compute/ext/certificates/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"certificates/api/v1.1")
|
||||
updated = "2012-01-19T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -65,8 +65,8 @@ class Console_output(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "Console_output"
|
||||
alias = "os-console-output"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"os-console-output/api/v2"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"os-console-output/api/v2")
|
||||
updated = "2011-12-08T00:00:00+00:00"
|
||||
|
||||
def get_controller_extensions(self):
|
||||
|
|
|
@ -49,8 +49,8 @@ class Createserverext(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "Createserverext"
|
||||
alias = "os-create-server-ext"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"createserverext/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"createserverext/api/v1.1")
|
||||
updated = "2011-07-19T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -66,8 +66,8 @@ class Deferred_delete(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "DeferredDelete"
|
||||
alias = "os-deferred-delete"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"deferred-delete/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"deferred-delete/api/v1.1")
|
||||
updated = "2011-09-01T00:00:00+00:00"
|
||||
|
||||
def get_controller_extensions(self):
|
||||
|
|
|
@ -89,8 +89,8 @@ class Extended_status(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "ExtendedStatus"
|
||||
alias = "OS-EXT-STS"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"extended_status/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"extended_status/api/v1.1")
|
||||
updated = "2011-11-03T00:00:00+00:00"
|
||||
|
||||
def get_controller_extensions(self):
|
||||
|
|
|
@ -98,8 +98,8 @@ class Flavorextradata(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "FlavorExtraData"
|
||||
alias = "OS-FLV-EXT-DATA"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"flavor_extra_data/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"flavor_extra_data/api/v1.1")
|
||||
updated = "2011-09-14T00:00:00+00:00"
|
||||
|
||||
def get_controller_extensions(self):
|
||||
|
|
|
@ -119,8 +119,8 @@ class Flavorextraspecs(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "FlavorExtraSpecs"
|
||||
alias = "os-flavor-extra-specs"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"flavor_extra_specs/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"flavor_extra_specs/api/v1.1")
|
||||
updated = "2011-06-23T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -80,8 +80,8 @@ class Floating_ip_pools(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "Floating_ip_pools"
|
||||
alias = "os-floating-ip-pools"
|
||||
namespace = \
|
||||
"http://docs.openstack.org/compute/ext/floating_ip_pools/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"floating_ip_pools/api/v1.1")
|
||||
updated = "2012-01-04T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -55,8 +55,8 @@ class Scheduler_hints(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "SchedulerHints"
|
||||
alias = "os-scheduler-hints"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"scheduler-hints/api/v2"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"scheduler-hints/api/v2")
|
||||
updated = "2011-07-19T00:00:00+00:00"
|
||||
|
||||
def get_controller_extensions(self):
|
||||
|
|
|
@ -65,8 +65,8 @@ class Server_action_list(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "ServerActionList"
|
||||
alias = "os-server-action-list"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"server-actions-list/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"server-actions-list/api/v1.1")
|
||||
updated = "2011-12-21T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -54,8 +54,8 @@ class Server_diagnostics(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "ServerDiagnostics"
|
||||
alias = "os-server-diagnostics"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"server-diagnostics/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"server-diagnostics/api/v1.1")
|
||||
updated = "2011-12-21T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -97,8 +97,8 @@ class SimpleTenantUsageController(object):
|
|||
# instance is still running, so charge them up to current time
|
||||
stop = period_stop
|
||||
dt = stop - start
|
||||
seconds = dt.days * 3600 * 24 + dt.seconds\
|
||||
+ dt.microseconds / 100000.0
|
||||
seconds = (dt.days * 3600 * 24 + dt.seconds +
|
||||
dt.microseconds / 100000.0)
|
||||
|
||||
return seconds / 3600.0
|
||||
else:
|
||||
|
@ -178,8 +178,8 @@ class SimpleTenantUsageController(object):
|
|||
summary = rval[info['tenant_id']]
|
||||
summary['total_local_gb_usage'] += info['local_gb'] * info['hours']
|
||||
summary['total_vcpus_usage'] += info['vcpus'] * info['hours']
|
||||
summary['total_memory_mb_usage'] += info['memory_mb']\
|
||||
* info['hours']
|
||||
summary['total_memory_mb_usage'] += (info['memory_mb'] *
|
||||
info['hours'])
|
||||
|
||||
summary['total_hours'] += info['hours']
|
||||
if detailed:
|
||||
|
@ -249,8 +249,8 @@ class Simple_tenant_usage(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "SimpleTenantUsage"
|
||||
alias = "os-simple-tenant-usage"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"os-simple-tenant-usage/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"os-simple-tenant-usage/api/v1.1")
|
||||
updated = "2011-08-19T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -81,8 +81,8 @@ class Virtual_interfaces(extensions.ExtensionDescriptor):
|
|||
|
||||
name = "VirtualInterfaces"
|
||||
alias = "virtual_interfaces"
|
||||
namespace = "http://docs.openstack.org/compute/ext/" \
|
||||
"virtual_interfaces/api/v1.1"
|
||||
namespace = ("http://docs.openstack.org/compute/ext/"
|
||||
"virtual_interfaces/api/v1.1")
|
||||
updated = "2011-08-17T00:00:00+00:00"
|
||||
|
||||
def get_resources(self):
|
||||
|
|
|
@ -182,13 +182,13 @@ class VsaController(object):
|
|||
LOG.audit(_("Create VSA %(display_name)s of type %(vc_type)s"),
|
||||
locals(), context=context)
|
||||
|
||||
_vsa_placement = vsa.get('placement', {})
|
||||
args = dict(display_name=display_name,
|
||||
display_description=vsa.get('displayDescription'),
|
||||
instance_type=instance_type,
|
||||
storage=vsa.get('storage'),
|
||||
shared=vsa.get('shared'),
|
||||
availability_zone=vsa.get('placement', {}).\
|
||||
get('AvailabilityZone'))
|
||||
availability_zone=_vsa_placement.get('AvailabilityZone'))
|
||||
|
||||
vsa = self.vsa_api.create(context, **args)
|
||||
|
||||
|
@ -294,7 +294,7 @@ class VsaVolumeDriveController(volumes.VolumeController):
|
|||
own_vsa_id = self.volume_api.get_volume_metadata_value(volume_ref,
|
||||
self.direction)
|
||||
if own_vsa_id != vsa_id:
|
||||
LOG.error(_("%(obj)s with ID %(id)s belongs to VSA %(own_vsa_id)s"\
|
||||
LOG.error(_("%(obj)s with ID %(id)s belongs to VSA %(own_vsa_id)s"
|
||||
" and not to VSA %(vsa_id)s."), locals())
|
||||
raise exception.Invalid()
|
||||
|
||||
|
@ -307,7 +307,7 @@ class VsaVolumeDriveController(volumes.VolumeController):
|
|||
search_opts={'metadata': {self.direction: str(vsa_id)}})
|
||||
limited_list = common.limited(vols, req)
|
||||
|
||||
res = [self._translation(context, vol, vsa_id, details) \
|
||||
res = [self._translation(context, vol, vsa_id, details)
|
||||
for vol in limited_list]
|
||||
|
||||
return {self.objects: res}
|
||||
|
|
|
@ -101,8 +101,8 @@ class Controller(wsgi.Controller):
|
|||
|
||||
"""
|
||||
super(Controller, self).__init__(**kwargs)
|
||||
self._image_service = image_service or \
|
||||
nova.image.get_default_image_service()
|
||||
self._image_service = (image_service or
|
||||
nova.image.get_default_image_service())
|
||||
|
||||
def _get_filters(self, req):
|
||||
"""
|
||||
|
|
|
@ -137,8 +137,9 @@ class Limit(object):
|
|||
self.water_level = 0
|
||||
self.capacity = self.unit
|
||||
self.request_value = float(self.capacity) / float(self.value)
|
||||
self.error_message = _("Only %(value)s %(verb)s request(s) can be "\
|
||||
"made to %(uri)s every %(unit_string)s." % self.__dict__)
|
||||
self.error_message = _("Only %(value)s %(verb)s request(s) can be "
|
||||
"made to %(uri)s every %(unit_string)s." %
|
||||
self.__dict__)
|
||||
|
||||
def __call__(self, verb, url):
|
||||
"""
|
||||
|
|
|
@ -558,8 +558,8 @@ class Controller(wsgi.Controller):
|
|||
# at the boot time
|
||||
for id, ip in networks:
|
||||
if id == network_uuid:
|
||||
expl = _("Duplicate networks (%s) are not allowed")\
|
||||
% network_uuid
|
||||
expl = (_("Duplicate networks (%s) are not allowed") %
|
||||
network_uuid)
|
||||
raise exc.HTTPBadRequest(explanation=expl)
|
||||
|
||||
networks.append((network_uuid, address))
|
||||
|
@ -705,8 +705,8 @@ class Controller(wsgi.Controller):
|
|||
scheduler_hints = server_dict.get('scheduler_hints', {})
|
||||
|
||||
try:
|
||||
inst_type = \
|
||||
instance_types.get_instance_type_by_flavor_id(flavor_id)
|
||||
_get_inst_type = instance_types.get_instance_type_by_flavor_id
|
||||
inst_type = _get_inst_type(flavor_id)
|
||||
|
||||
(instances, resv_id) = self.compute_api.create(context,
|
||||
inst_type,
|
||||
|
@ -747,8 +747,8 @@ class Controller(wsgi.Controller):
|
|||
except exception.SecurityGroupNotFound as error:
|
||||
raise exc.HTTPBadRequest(explanation=unicode(error))
|
||||
except rpc_common.RemoteError as err:
|
||||
msg = "%(err_type)s: %(err_msg)s" % \
|
||||
{'err_type': err.exc_type, 'err_msg': err.value}
|
||||
msg = "%(err_type)s: %(err_msg)s" % {'err_type': err.exc_type,
|
||||
'err_msg': err.value}
|
||||
raise exc.HTTPBadRequest(explanation=msg)
|
||||
# Let the caller deal with unhandled exceptions.
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ class ViewBuilder(object):
|
|||
|
||||
# check for existing key
|
||||
for limit in limits:
|
||||
if limit["uri"] == rate_limit["URI"] and \
|
||||
limit["regex"] == rate_limit["regex"]:
|
||||
if (limit["uri"] == rate_limit["URI"] and
|
||||
limit["regex"] == rate_limit["regex"]):
|
||||
_rate_limit_key = limit
|
||||
break
|
||||
|
||||
|
@ -85,8 +85,8 @@ class ViewBuilder(object):
|
|||
return limits
|
||||
|
||||
def _build_rate_limit(self, rate_limit):
|
||||
next_avail = \
|
||||
datetime.datetime.utcfromtimestamp(rate_limit["resetTime"])
|
||||
_get_utc = datetime.datetime.utcfromtimestamp
|
||||
next_avail = _get_utc(rate_limit["resetTime"])
|
||||
return {
|
||||
"verb": rate_limit["verb"],
|
||||
"value": rate_limit["value"],
|
||||
|
|
|
@ -79,8 +79,8 @@ class Request(webob.Request):
|
|||
if not content_type:
|
||||
content_type = self.accept.best_match(SUPPORTED_CONTENT_TYPES)
|
||||
|
||||
self.environ['nova.best_content_type'] = content_type or \
|
||||
'application/json'
|
||||
self.environ['nova.best_content_type'] = (content_type or
|
||||
'application/json')
|
||||
|
||||
return self.environ['nova.best_content_type']
|
||||
|
||||
|
|
Loading…
Reference in New Issue