Handle log message interpolation by the logger
According to OpenStack Guideline[1], logged string message should be interpolated by the logger. [1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages Change-Id: I51f50935f1eeffe4960562d6309dfdf05814e595 Closes-Bug: #1596829
This commit is contained in:
parent
a3e28c1b6c
commit
34a3aa0ba8
@ -309,7 +309,8 @@ class Panel(HorizonComponent):
|
|||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
# Logging here since this will often be called in a template
|
# Logging here since this will often be called in a template
|
||||||
# where the exception would be hidden.
|
# where the exception would be hidden.
|
||||||
LOG.info("Error reversing absolute URL for %s: %s" % (self, exc))
|
LOG.info("Error reversing absolute URL for %(self)s: %(exc)s",
|
||||||
|
{'self': self, 'exc': exc})
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -524,7 +525,7 @@ class Dashboard(Registry, HorizonComponent):
|
|||||||
except Exception:
|
except Exception:
|
||||||
# Logging here since this will often be called in a template
|
# Logging here since this will often be called in a template
|
||||||
# where the exception would be hidden.
|
# where the exception would be hidden.
|
||||||
LOG.exception("Error reversing absolute URL for %s." % self)
|
LOG.exception("Error reversing absolute URL for %s.", self)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -97,8 +97,8 @@ class HorizonMiddleware(object):
|
|||||||
'You need to configure file-based or database-backed '
|
'You need to configure file-based or database-backed '
|
||||||
'sessions instead of cookie-based sessions: '
|
'sessions instead of cookie-based sessions: '
|
||||||
'http://docs.openstack.org/developer/horizon/topics/'
|
'http://docs.openstack.org/developer/horizon/topics/'
|
||||||
'deployment.html#session-storage'
|
'deployment.html#session-storage',
|
||||||
% {
|
{
|
||||||
'user_id': request.session.get(
|
'user_id': request.session.get(
|
||||||
'user_id', 'Unknown'),
|
'user_id', 'Unknown'),
|
||||||
'cookie_size': cookie_size,
|
'cookie_size': cookie_size,
|
||||||
|
@ -405,7 +405,8 @@ class LinkAction(BaseAction):
|
|||||||
else:
|
else:
|
||||||
return urlresolvers.reverse(self.url)
|
return urlresolvers.reverse(self.url)
|
||||||
except urlresolvers.NoReverseMatch as ex:
|
except urlresolvers.NoReverseMatch as ex:
|
||||||
LOG.info('No reverse found for "%s": %s' % (self.url, ex))
|
LOG.info('No reverse found for "%(url)s": %(exception)s',
|
||||||
|
{'url': self.url, 'exception': ex})
|
||||||
return self.url
|
return self.url
|
||||||
|
|
||||||
|
|
||||||
@ -846,8 +847,9 @@ class BatchAction(Action):
|
|||||||
self.update(request, datum)
|
self.update(request, datum)
|
||||||
action_success.append(datum_display)
|
action_success.append(datum_display)
|
||||||
self.success_ids.append(datum_id)
|
self.success_ids.append(datum_id)
|
||||||
LOG.info(u'%s: "%s"' %
|
LOG.info(u'%(action)s: "%(datum_display)s"',
|
||||||
(self._get_action_name(past=True), datum_display))
|
{'action': self._get_action_name(past=True),
|
||||||
|
'datum_display': datum_display})
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
# Handle the exception but silence it since we'll display
|
# Handle the exception but silence it since we'll display
|
||||||
# an aggregate error message later. Otherwise we'd get
|
# an aggregate error message later. Otherwise we'd get
|
||||||
@ -972,14 +974,15 @@ class Deprecated(type):
|
|||||||
# oslo_log.versionutils when it's finally added in 11.0
|
# oslo_log.versionutils when it's finally added in 11.0
|
||||||
def __new__(meta, name, bases, kwargs):
|
def __new__(meta, name, bases, kwargs):
|
||||||
cls = super(Deprecated, meta).__new__(meta, name, bases, kwargs)
|
cls = super(Deprecated, meta).__new__(meta, name, bases, kwargs)
|
||||||
message = ("WARNING:The UpdateAction class defined in module '%s'"
|
|
||||||
" is deprecated as of Newton and may be removed in "
|
|
||||||
"Horizon P (12.0). Class '%s' defined at module '%s' "
|
|
||||||
"shall no longer subclass it.")
|
|
||||||
if name != 'UpdateAction':
|
if name != 'UpdateAction':
|
||||||
LOG.warning(message % (UpdateAction.__module__,
|
LOG.warning(
|
||||||
name,
|
"WARNING:The UpdateAction class defined in module '%(mod)s' "
|
||||||
kwargs['__module__']))
|
"is deprecated as of Newton and may be removed in "
|
||||||
|
"Horizon P (12.0). Class '%(name)s' defined at "
|
||||||
|
"module '%(module)s' shall no longer subclass it.",
|
||||||
|
{'mod': UpdateAction.__module__,
|
||||||
|
'name': name,
|
||||||
|
'module': kwargs['__module__']})
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
|
|
||||||
|
@ -1673,8 +1673,8 @@ class DataTable(object):
|
|||||||
# If not allowed, neither edit mod or updating is allowed.
|
# If not allowed, neither edit mod or updating is allowed.
|
||||||
if not cell.update_allowed:
|
if not cell.update_allowed:
|
||||||
datum_display = (self.get_object_display(datum) or "N/A")
|
datum_display = (self.get_object_display(datum) or "N/A")
|
||||||
LOG.info('Permission denied to %s: "%s"' %
|
LOG.info('Permission denied to Update Action: "%s"',
|
||||||
("Update Action", datum_display))
|
datum_display)
|
||||||
return HttpResponse(status=401)
|
return HttpResponse(status=401)
|
||||||
# If it is post request, we are updating the cell.
|
# If it is post request, we are updating the cell.
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
@ -52,7 +52,7 @@ try:
|
|||||||
|
|
||||||
from horizon.test.webdriver import WebDriver
|
from horizon.test.webdriver import WebDriver
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
LOG.warning("{0}, force WITH_SELENIUM=False".format(str(e)))
|
LOG.warning("%s, force WITH_SELENIUM=False", e)
|
||||||
os.environ['WITH_SELENIUM'] = ''
|
os.environ['WITH_SELENIUM'] = ''
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,5 +108,7 @@ def _log(file_list, list_name, in_path):
|
|||||||
"""Logs result at debug level
|
"""Logs result at debug level
|
||||||
"""
|
"""
|
||||||
file_names = '\n'.join(file_list)
|
file_names = '\n'.join(file_list)
|
||||||
LOG.debug("\nDiscovered {0} {1} file(s) in {2}:\n{3}\n"
|
LOG.debug("\nDiscovered %(size)d %(name)s file(s) in %(path)s:\n"
|
||||||
.format(len(file_list), list_name, in_path, file_names))
|
"%(files)s\n",
|
||||||
|
{'size': len(file_list), 'name': list_name, 'path': in_path,
|
||||||
|
'files': file_names})
|
||||||
|
@ -351,10 +351,9 @@ def image_update(request, image_id, **kwargs):
|
|||||||
filename = str(image_data.file)
|
filename = str(image_data.file)
|
||||||
if hasattr(image_data.file, 'name'):
|
if hasattr(image_data.file, 'name'):
|
||||||
filename = image_data.file.name
|
filename = image_data.file.name
|
||||||
msg = (('Failed to remove temporary image file '
|
LOG.warning('Failed to remove temporary image file '
|
||||||
'%(file)s (%(e)s)') %
|
'%(file)s (%(e)s)',
|
||||||
dict(file=filename, e=str(e)))
|
{'file': filename, 'e': e})
|
||||||
LOG.warning(msg)
|
|
||||||
|
|
||||||
|
|
||||||
def get_image_upload_mode():
|
def get_image_upload_mode():
|
||||||
@ -363,7 +362,7 @@ def get_image_upload_mode():
|
|||||||
mode = getattr(settings, 'HORIZON_IMAGES_UPLOAD_MODE', 'legacy')
|
mode = getattr(settings, 'HORIZON_IMAGES_UPLOAD_MODE', 'legacy')
|
||||||
if mode not in ('off', 'legacy', 'direct'):
|
if mode not in ('off', 'legacy', 'direct'):
|
||||||
LOG.warning('HORIZON_IMAGES_UPLOAD_MODE has an unrecognized value of '
|
LOG.warning('HORIZON_IMAGES_UPLOAD_MODE has an unrecognized value of '
|
||||||
'"%s", reverting to default "legacy" value' % mode)
|
'"%s", reverting to default "legacy" value', mode)
|
||||||
mode = 'legacy'
|
mode = 'legacy'
|
||||||
return mode
|
return mode
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ def keystoneclient(request, admin=False):
|
|||||||
endpoint = _get_endpoint_url(request, endpoint_type)
|
endpoint = _get_endpoint_url(request, endpoint_type)
|
||||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||||
LOG.debug("Creating a new keystoneclient connection to %s." % endpoint)
|
LOG.debug("Creating a new keystoneclient connection to %s.", endpoint)
|
||||||
remote_addr = request.environ.get('REMOTE_ADDR', '')
|
remote_addr = request.environ.get('REMOTE_ADDR', '')
|
||||||
conn = api_version['client'].Client(token=token_id,
|
conn = api_version['client'].Client(token=token_id,
|
||||||
endpoint=endpoint,
|
endpoint=endpoint,
|
||||||
@ -247,7 +247,7 @@ def domain_update(request, domain_id, name=None, description=None,
|
|||||||
response = manager.update(domain_id, name=name,
|
response = manager.update(domain_id, name=name,
|
||||||
description=description, enabled=enabled)
|
description=description, enabled=enabled)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception("Unable to update Domain: %s" % domain_id)
|
LOG.exception("Unable to update Domain: %s", domain_id)
|
||||||
raise
|
raise
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@ -299,11 +299,12 @@ def get_default_domain(request, get_name=True):
|
|||||||
# we recognize this condition and return the user's
|
# we recognize this condition and return the user's
|
||||||
# domain information instead.
|
# domain information instead.
|
||||||
LOG.debug("Cannot retrieve domain information for "
|
LOG.debug("Cannot retrieve domain information for "
|
||||||
"user (%s) that does not have an admin role "
|
"user (%(user)s) that does not have an admin role "
|
||||||
"on project (%s)" %
|
"on project (%(project)s)",
|
||||||
(request.user.username, request.user.project_name))
|
{'user': request.user.username,
|
||||||
|
'project': request.user.project_name})
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.warning("Unable to retrieve Domain: %s" % domain_id)
|
LOG.warning("Unable to retrieve Domain: %s", domain_id)
|
||||||
domain = base.APIDictWrapper({"id": domain_id,
|
domain = base.APIDictWrapper({"id": domain_id,
|
||||||
"name": domain_name})
|
"name": domain_name})
|
||||||
return domain
|
return domain
|
||||||
|
@ -645,8 +645,8 @@ def network_list_for_tenant(request, tenant_id, include_external=False,
|
|||||||
The list contains networks owned by the tenant and public networks.
|
The list contains networks owned by the tenant and public networks.
|
||||||
If requested_networks specified, it searches requested_networks only.
|
If requested_networks specified, it searches requested_networks only.
|
||||||
"""
|
"""
|
||||||
LOG.debug("network_list_for_tenant(): tenant_id=%s, params=%s"
|
LOG.debug("network_list_for_tenant(): tenant_id=%(tenant_id)s, "
|
||||||
% (tenant_id, params))
|
"params=%(params)s", {'tenant_id': tenant_id, 'params': params})
|
||||||
|
|
||||||
networks = []
|
networks = []
|
||||||
shared = params.get('shared')
|
shared = params.get('shared')
|
||||||
@ -682,7 +682,8 @@ def network_list_for_tenant(request, tenant_id, include_external=False,
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def network_get(request, network_id, expand_subnet=True, **params):
|
def network_get(request, network_id, expand_subnet=True, **params):
|
||||||
LOG.debug("network_get(): netid=%s, params=%s" % (network_id, params))
|
LOG.debug("network_get(): netid=%(network_id)s, params=%(params)s",
|
||||||
|
{'network_id': network_id, 'params': params})
|
||||||
network = neutronclient(request).show_network(network_id,
|
network = neutronclient(request).show_network(network_id,
|
||||||
**params).get('network')
|
**params).get('network')
|
||||||
if expand_subnet:
|
if expand_subnet:
|
||||||
@ -704,7 +705,7 @@ def network_create(request, **kwargs):
|
|||||||
:param name: (optional) name of the network created
|
:param name: (optional) name of the network created
|
||||||
:returns: Network object
|
:returns: Network object
|
||||||
"""
|
"""
|
||||||
LOG.debug("network_create(): kwargs = %s" % kwargs)
|
LOG.debug("network_create(): kwargs = %s", kwargs)
|
||||||
if 'tenant_id' not in kwargs:
|
if 'tenant_id' not in kwargs:
|
||||||
kwargs['tenant_id'] = request.user.project_id
|
kwargs['tenant_id'] = request.user.project_id
|
||||||
body = {'network': kwargs}
|
body = {'network': kwargs}
|
||||||
@ -714,7 +715,8 @@ def network_create(request, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def network_update(request, network_id, **kwargs):
|
def network_update(request, network_id, **kwargs):
|
||||||
LOG.debug("network_update(): netid=%s, params=%s" % (network_id, kwargs))
|
LOG.debug("network_update(): netid=%(network_id)s, params=%(params)s",
|
||||||
|
{'network_id': network_id, 'params': kwargs})
|
||||||
body = {'network': kwargs}
|
body = {'network': kwargs}
|
||||||
network = neutronclient(request).update_network(network_id,
|
network = neutronclient(request).update_network(network_id,
|
||||||
body=body).get('network')
|
body=body).get('network')
|
||||||
@ -723,20 +725,21 @@ def network_update(request, network_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def network_delete(request, network_id):
|
def network_delete(request, network_id):
|
||||||
LOG.debug("network_delete(): netid=%s" % network_id)
|
LOG.debug("network_delete(): netid=%s", network_id)
|
||||||
neutronclient(request).delete_network(network_id)
|
neutronclient(request).delete_network(network_id)
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnet_list(request, **params):
|
def subnet_list(request, **params):
|
||||||
LOG.debug("subnet_list(): params=%s" % (params))
|
LOG.debug("subnet_list(): params=%s", params)
|
||||||
subnets = neutronclient(request).list_subnets(**params).get('subnets')
|
subnets = neutronclient(request).list_subnets(**params).get('subnets')
|
||||||
return [Subnet(s) for s in subnets]
|
return [Subnet(s) for s in subnets]
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnet_get(request, subnet_id, **params):
|
def subnet_get(request, subnet_id, **params):
|
||||||
LOG.debug("subnet_get(): subnetid=%s, params=%s" % (subnet_id, params))
|
LOG.debug("subnet_get(): subnetid=%(subnet_id)s, params=%(params)s",
|
||||||
|
{'subnet_id': subnet_id, 'params': params})
|
||||||
subnet = neutronclient(request).show_subnet(subnet_id,
|
subnet = neutronclient(request).show_subnet(subnet_id,
|
||||||
**params).get('subnet')
|
**params).get('subnet')
|
||||||
return Subnet(subnet)
|
return Subnet(subnet)
|
||||||
@ -761,8 +764,8 @@ def subnet_create(request, network_id, **kwargs):
|
|||||||
optional you MUST pass along one of the combinations to get a successful
|
optional you MUST pass along one of the combinations to get a successful
|
||||||
result.
|
result.
|
||||||
"""
|
"""
|
||||||
LOG.debug("subnet_create(): netid=%s, kwargs=%s"
|
LOG.debug("subnet_create(): netid=%(network_id)s, kwargs=%(kwargs)s",
|
||||||
% (network_id, kwargs))
|
{'network_id': network_id, 'kwargs': kwargs})
|
||||||
body = {'subnet': {'network_id': network_id}}
|
body = {'subnet': {'network_id': network_id}}
|
||||||
if 'tenant_id' not in kwargs:
|
if 'tenant_id' not in kwargs:
|
||||||
kwargs['tenant_id'] = request.user.project_id
|
kwargs['tenant_id'] = request.user.project_id
|
||||||
@ -773,7 +776,8 @@ def subnet_create(request, network_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnet_update(request, subnet_id, **kwargs):
|
def subnet_update(request, subnet_id, **kwargs):
|
||||||
LOG.debug("subnet_update(): subnetid=%s, kwargs=%s" % (subnet_id, kwargs))
|
LOG.debug("subnet_update(): subnetid=%(subnet_id)s, kwargs=%(kwargs)s",
|
||||||
|
{'subnet_id': subnet_id, 'kwargs': kwargs})
|
||||||
body = {'subnet': kwargs}
|
body = {'subnet': kwargs}
|
||||||
subnet = neutronclient(request).update_subnet(subnet_id,
|
subnet = neutronclient(request).update_subnet(subnet_id,
|
||||||
body=body).get('subnet')
|
body=body).get('subnet')
|
||||||
@ -782,13 +786,13 @@ def subnet_update(request, subnet_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnet_delete(request, subnet_id):
|
def subnet_delete(request, subnet_id):
|
||||||
LOG.debug("subnet_delete(): subnetid=%s" % subnet_id)
|
LOG.debug("subnet_delete(): subnetid=%s", subnet_id)
|
||||||
neutronclient(request).delete_subnet(subnet_id)
|
neutronclient(request).delete_subnet(subnet_id)
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnetpool_list(request, **params):
|
def subnetpool_list(request, **params):
|
||||||
LOG.debug("subnetpool_list(): params=%s" % (params))
|
LOG.debug("subnetpool_list(): params=%s", params)
|
||||||
subnetpools = \
|
subnetpools = \
|
||||||
neutronclient(request).list_subnetpools(**params).get('subnetpools')
|
neutronclient(request).list_subnetpools(**params).get('subnetpools')
|
||||||
return [SubnetPool(s) for s in subnetpools]
|
return [SubnetPool(s) for s in subnetpools]
|
||||||
@ -796,8 +800,9 @@ def subnetpool_list(request, **params):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnetpool_get(request, subnetpool_id, **params):
|
def subnetpool_get(request, subnetpool_id, **params):
|
||||||
LOG.debug("subnetpool_get(): subnetpoolid=%s, params=%s" %
|
LOG.debug("subnetpool_get(): subnetpoolid=%(subnetpool_id)s, "
|
||||||
(subnetpool_id, params))
|
"params=%(params)s", {'subnetpool_id': subnetpool_id,
|
||||||
|
'params': params})
|
||||||
subnetpool = \
|
subnetpool = \
|
||||||
neutronclient(request).show_subnetpool(subnetpool_id,
|
neutronclient(request).show_subnetpool(subnetpool_id,
|
||||||
**params).get('subnetpool')
|
**params).get('subnetpool')
|
||||||
@ -826,8 +831,9 @@ def subnetpool_create(request, name, prefixes, **kwargs):
|
|||||||
Returns:
|
Returns:
|
||||||
SubnetPool object
|
SubnetPool object
|
||||||
"""
|
"""
|
||||||
LOG.debug("subnetpool_create(): name=%s, prefixes=%s, kwargs=%s"
|
LOG.debug("subnetpool_create(): name=%(name)s, prefixes=%(prefixes)s, "
|
||||||
% (name, prefixes, kwargs))
|
"kwargs=%(kwargs)s", {'name': name, 'prefixes': prefixes,
|
||||||
|
'kwargs': kwargs})
|
||||||
body = {'subnetpool':
|
body = {'subnetpool':
|
||||||
{'name': name,
|
{'name': name,
|
||||||
'prefixes': prefixes,
|
'prefixes': prefixes,
|
||||||
@ -843,8 +849,9 @@ def subnetpool_create(request, name, prefixes, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnetpool_update(request, subnetpool_id, **kwargs):
|
def subnetpool_update(request, subnetpool_id, **kwargs):
|
||||||
LOG.debug("subnetpool_update(): subnetpoolid=%s, kwargs=%s" %
|
LOG.debug("subnetpool_update(): subnetpoolid=%(subnetpool_id)s, "
|
||||||
(subnetpool_id, kwargs))
|
"kwargs=%(kwargs)s", {'subnetpool_id': subnetpool_id,
|
||||||
|
'kwargs': kwargs})
|
||||||
body = {'subnetpool': kwargs}
|
body = {'subnetpool': kwargs}
|
||||||
subnetpool = \
|
subnetpool = \
|
||||||
neutronclient(request).update_subnetpool(subnetpool_id,
|
neutronclient(request).update_subnetpool(subnetpool_id,
|
||||||
@ -854,20 +861,21 @@ def subnetpool_update(request, subnetpool_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def subnetpool_delete(request, subnetpool_id):
|
def subnetpool_delete(request, subnetpool_id):
|
||||||
LOG.debug("subnetpool_delete(): subnetpoolid=%s" % subnetpool_id)
|
LOG.debug("subnetpool_delete(): subnetpoolid=%s", subnetpool_id)
|
||||||
return neutronclient(request).delete_subnetpool(subnetpool_id)
|
return neutronclient(request).delete_subnetpool(subnetpool_id)
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def port_list(request, **params):
|
def port_list(request, **params):
|
||||||
LOG.debug("port_list(): params=%s" % (params))
|
LOG.debug("port_list(): params=%s", params)
|
||||||
ports = neutronclient(request).list_ports(**params).get('ports')
|
ports = neutronclient(request).list_ports(**params).get('ports')
|
||||||
return [Port(p) for p in ports]
|
return [Port(p) for p in ports]
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def port_get(request, port_id, **params):
|
def port_get(request, port_id, **params):
|
||||||
LOG.debug("port_get(): portid=%s, params=%s" % (port_id, params))
|
LOG.debug("port_get(): portid=%(port_id)s, params=%(params)s",
|
||||||
|
{'port_id': port_id, 'params': params})
|
||||||
port = neutronclient(request).show_port(port_id, **params).get('port')
|
port = neutronclient(request).show_port(port_id, **params).get('port')
|
||||||
return Port(port)
|
return Port(port)
|
||||||
|
|
||||||
@ -890,7 +898,8 @@ def port_create(request, network_id, **kwargs):
|
|||||||
:param name: (optional) name of the port created
|
:param name: (optional) name of the port created
|
||||||
:returns: Port object
|
:returns: Port object
|
||||||
"""
|
"""
|
||||||
LOG.debug("port_create(): netid=%s, kwargs=%s" % (network_id, kwargs))
|
LOG.debug("port_create(): netid=%(network_id)s, kwargs=%(kwargs)s",
|
||||||
|
{'network_id': network_id, 'kwargs': kwargs})
|
||||||
kwargs = unescape_port_kwargs(**kwargs)
|
kwargs = unescape_port_kwargs(**kwargs)
|
||||||
body = {'port': {'network_id': network_id}}
|
body = {'port': {'network_id': network_id}}
|
||||||
if 'tenant_id' not in kwargs:
|
if 'tenant_id' not in kwargs:
|
||||||
@ -902,13 +911,14 @@ def port_create(request, network_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def port_delete(request, port_id):
|
def port_delete(request, port_id):
|
||||||
LOG.debug("port_delete(): portid=%s" % port_id)
|
LOG.debug("port_delete(): portid=%s", port_id)
|
||||||
neutronclient(request).delete_port(port_id)
|
neutronclient(request).delete_port(port_id)
|
||||||
|
|
||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def port_update(request, port_id, **kwargs):
|
def port_update(request, port_id, **kwargs):
|
||||||
LOG.debug("port_update(): portid=%s, kwargs=%s" % (port_id, kwargs))
|
LOG.debug("port_update(): portid=%(port_id)s, kwargs=%(kwargs)s",
|
||||||
|
{'port_id': port_id, 'kwargs': kwargs})
|
||||||
kwargs = unescape_port_kwargs(**kwargs)
|
kwargs = unescape_port_kwargs(**kwargs)
|
||||||
body = {'port': kwargs}
|
body = {'port': kwargs}
|
||||||
port = neutronclient(request).update_port(port_id, body=body).get('port')
|
port = neutronclient(request).update_port(port_id, body=body).get('port')
|
||||||
@ -917,7 +927,7 @@ def port_update(request, port_id, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def router_create(request, **kwargs):
|
def router_create(request, **kwargs):
|
||||||
LOG.debug("router_create():, kwargs=%s" % kwargs)
|
LOG.debug("router_create():, kwargs=%s", kwargs)
|
||||||
body = {'router': {}}
|
body = {'router': {}}
|
||||||
if 'tenant_id' not in kwargs:
|
if 'tenant_id' not in kwargs:
|
||||||
kwargs['tenant_id'] = request.user.project_id
|
kwargs['tenant_id'] = request.user.project_id
|
||||||
@ -928,7 +938,8 @@ def router_create(request, **kwargs):
|
|||||||
|
|
||||||
@profiler.trace
|
@profiler.trace
|
||||||
def router_update(request, r_id, **kwargs):
|
def router_update(request, r_id, **kwargs):
|
||||||
LOG.debug("router_update(): router_id=%s, kwargs=%s" % (r_id, kwargs))
|
LOG.debug("router_update(): router_id=%(r_id)s, kwargs=%(kwargs)s",
|
||||||
|
{'r_id': r_id, 'kwargs': kwargs})
|
||||||
body = {'router': {}}
|
body = {'router': {}}
|
||||||
body['router'].update(kwargs)
|
body['router'].update(kwargs)
|
||||||
router = neutronclient(request).update_router(r_id, body=body)
|
router = neutronclient(request).update_router(r_id, body=body)
|
||||||
|
@ -339,9 +339,9 @@ class SecurityGroupManager(network_base.SecurityGroupManager):
|
|||||||
num_groups_to_modify -= 1
|
num_groups_to_modify -= 1
|
||||||
except nova_exceptions.ClientException as err:
|
except nova_exceptions.ClientException as err:
|
||||||
LOG.error(_("Failed to modify %(num_groups_to_modify)d instance "
|
LOG.error(_("Failed to modify %(num_groups_to_modify)d instance "
|
||||||
"security groups: %(err)s") %
|
"security groups: %(err)s"),
|
||||||
dict(num_groups_to_modify=num_groups_to_modify,
|
{'num_groups_to_modify': num_groups_to_modify,
|
||||||
err=err))
|
'err': err})
|
||||||
# reraise novaclient.exceptions.ClientException, but with
|
# reraise novaclient.exceptions.ClientException, but with
|
||||||
# a sanitized error message so we don't risk exposing
|
# a sanitized error message so we don't risk exposing
|
||||||
# sensitive information to the end user. This has to be
|
# sensitive information to the end user. This has to be
|
||||||
|
@ -62,7 +62,7 @@ class AdminSimpleDisassociateIP(project_tables.DisassociateIP):
|
|||||||
try:
|
try:
|
||||||
fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
|
fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
|
||||||
api.network.floating_ip_disassociate(request, fip.id)
|
api.network.floating_ip_disassociate(request, fip.id)
|
||||||
LOG.info('Disassociating Floating IP "%s".' % obj_id)
|
LOG.info('Disassociating Floating IP "%s".', obj_id)
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Successfully disassociated Floating IP: %s')
|
_('Successfully disassociated Floating IP: %s')
|
||||||
% fip.ip)
|
% fip.ip)
|
||||||
|
@ -120,16 +120,20 @@ class IndexView(tables.DataTableView):
|
|||||||
if filter_field and filter_string and (
|
if filter_field and filter_string and (
|
||||||
filter_action.is_api_filter(filter_field)):
|
filter_action.is_api_filter(filter_field)):
|
||||||
if filter_field in ['size_min', 'size_max']:
|
if filter_field in ['size_min', 'size_max']:
|
||||||
invalid_msg = ('API query is not valid and is ignored: %s=%s'
|
invalid_msg = ('API query is not valid and is ignored: '
|
||||||
% (filter_field, filter_string))
|
'%(field)s=%(string)s')
|
||||||
try:
|
try:
|
||||||
filter_string = long(float(filter_string) * (units.Mi))
|
filter_string = long(float(filter_string) * (units.Mi))
|
||||||
if filter_string >= 0:
|
if filter_string >= 0:
|
||||||
filters[filter_field] = filter_string
|
filters[filter_field] = filter_string
|
||||||
else:
|
else:
|
||||||
LOG.warning(invalid_msg)
|
LOG.warning(invalid_msg,
|
||||||
|
{'field': filter_field,
|
||||||
|
'string': filter_string})
|
||||||
except ValueError:
|
except ValueError:
|
||||||
LOG.warning(invalid_msg)
|
LOG.warning(invalid_msg,
|
||||||
|
{'field': filter_field,
|
||||||
|
'string': filter_string})
|
||||||
elif (filter_field == 'disk_format' and
|
elif (filter_field == 'disk_format' and
|
||||||
filter_string.lower() == 'docker'):
|
filter_string.lower() == 'docker'):
|
||||||
filters['disk_format'] = 'raw'
|
filters['disk_format'] = 'raw'
|
||||||
|
@ -263,8 +263,7 @@ class CreateNetwork(forms.SelfHandlingForm):
|
|||||||
params['provider:segmentation_id'] = (
|
params['provider:segmentation_id'] = (
|
||||||
data['segmentation_id'])
|
data['segmentation_id'])
|
||||||
network = api.neutron.network_create(request, **params)
|
network = api.neutron.network_create(request, **params)
|
||||||
msg = _('Network %s was successfully created.') % data['name']
|
LOG.debug(_('Network %s was successfully created.'), data['name'])
|
||||||
LOG.debug(msg)
|
|
||||||
return network
|
return network
|
||||||
except Exception:
|
except Exception:
|
||||||
redirect = reverse('horizon:admin:networks:index')
|
redirect = reverse('horizon:admin:networks:index')
|
||||||
|
@ -156,7 +156,7 @@ class UpdatePort(project_forms.UpdatePort):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
LOG.debug('params = %s' % data)
|
LOG.debug('params = %s', data)
|
||||||
extension_kwargs = {}
|
extension_kwargs = {}
|
||||||
data['admin_state'] = (data['admin_state'] == 'True')
|
data['admin_state'] = (data['admin_state'] == 'True')
|
||||||
if 'binding__vnic_type' in data:
|
if 'binding__vnic_type' in data:
|
||||||
|
@ -118,7 +118,7 @@ class DeleteDomainsAction(tables.DeleteAction):
|
|||||||
messages.error(request, msg)
|
messages.error(request, msg)
|
||||||
raise exceptions.ClientException(409, msg)
|
raise exceptions.ClientException(409, msg)
|
||||||
else:
|
else:
|
||||||
LOG.info('Deleting domain "%s".' % obj_id)
|
LOG.info('Deleting domain "%s".', obj_id)
|
||||||
api.keystone.domain_delete(request, obj_id)
|
api.keystone.domain_delete(request, obj_id)
|
||||||
|
|
||||||
|
|
||||||
@ -150,7 +150,7 @@ class DisableDomainsAction(tables.BatchAction):
|
|||||||
def action(self, request, obj_id):
|
def action(self, request, obj_id):
|
||||||
domain = self.table.get_object_by_id(obj_id)
|
domain = self.table.get_object_by_id(obj_id)
|
||||||
if domain.enabled:
|
if domain.enabled:
|
||||||
LOG.info('Disabling domain "%s".' % obj_id)
|
LOG.info('Disabling domain "%s".', obj_id)
|
||||||
try:
|
try:
|
||||||
api.keystone.domain_update(request,
|
api.keystone.domain_update(request,
|
||||||
domain_id=domain.id,
|
domain_id=domain.id,
|
||||||
@ -190,7 +190,7 @@ class EnableDomainsAction(tables.BatchAction):
|
|||||||
def action(self, request, obj_id):
|
def action(self, request, obj_id):
|
||||||
domain = self.table.get_object_by_id(obj_id)
|
domain = self.table.get_object_by_id(obj_id)
|
||||||
if not domain.enabled:
|
if not domain.enabled:
|
||||||
LOG.info('Enabling domain "%s".' % obj_id)
|
LOG.info('Enabling domain "%s".', obj_id)
|
||||||
try:
|
try:
|
||||||
api.keystone.domain_update(request,
|
api.keystone.domain_update(request,
|
||||||
domain_id=domain.id,
|
domain_id=domain.id,
|
||||||
|
@ -265,7 +265,7 @@ class CreateDomain(workflows.Workflow):
|
|||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
# create the domain
|
# create the domain
|
||||||
try:
|
try:
|
||||||
LOG.info('Creating domain with name "%s"' % data['name'])
|
LOG.info('Creating domain with name "%s"', data['name'])
|
||||||
desc = data['description']
|
desc = data['description']
|
||||||
api.keystone.domain_create(request,
|
api.keystone.domain_create(request,
|
||||||
name=data['name'],
|
name=data['name'],
|
||||||
@ -491,7 +491,7 @@ class UpdateDomain(workflows.Workflow):
|
|||||||
domain_id = data.pop('domain_id')
|
domain_id = data.pop('domain_id')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
LOG.info('Updating domain with name "%s"' % data['name'])
|
LOG.info('Updating domain with name "%s"', data['name'])
|
||||||
api.keystone.domain_update(request,
|
api.keystone.domain_update(request,
|
||||||
domain_id,
|
domain_id,
|
||||||
name=data['name'],
|
name=data['name'],
|
||||||
|
@ -36,7 +36,7 @@ class CreateGroupForm(forms.SelfHandlingForm):
|
|||||||
|
|
||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
try:
|
try:
|
||||||
LOG.info('Creating group with name "%s"' % data['name'])
|
LOG.info('Creating group with name "%s"', data['name'])
|
||||||
api.keystone.group_create(
|
api.keystone.group_create(
|
||||||
request,
|
request,
|
||||||
domain_id=identity_utils.get_domain_id_for_operation(
|
domain_id=identity_utils.get_domain_id_for_operation(
|
||||||
|
@ -83,7 +83,7 @@ class DeleteGroupsAction(policy.PolicyTargetMixin, tables.DeleteAction):
|
|||||||
return api.keystone.keystone_can_edit_group()
|
return api.keystone.keystone_can_edit_group()
|
||||||
|
|
||||||
def delete(self, request, obj_id):
|
def delete(self, request, obj_id):
|
||||||
LOG.info('Deleting group "%s".' % obj_id)
|
LOG.info('Deleting group "%s".', obj_id)
|
||||||
api.keystone.group_delete(request, obj_id)
|
api.keystone.group_delete(request, obj_id)
|
||||||
|
|
||||||
|
|
||||||
@ -154,8 +154,8 @@ class RemoveMembers(tables.DeleteAction):
|
|||||||
def action(self, request, obj_id):
|
def action(self, request, obj_id):
|
||||||
user_obj = self.table.get_object_by_id(obj_id)
|
user_obj = self.table.get_object_by_id(obj_id)
|
||||||
group_id = self.table.kwargs['group_id']
|
group_id = self.table.kwargs['group_id']
|
||||||
LOG.info('Removing user %s from group %s.' % (user_obj.id,
|
LOG.info('Removing user %(user)s from group %(group)s.',
|
||||||
group_id))
|
{'user': user_obj.id, 'group': group_id})
|
||||||
api.keystone.remove_group_user(request,
|
api.keystone.remove_group_user(request,
|
||||||
group_id=group_id,
|
group_id=group_id,
|
||||||
user_id=user_obj.id)
|
user_id=user_obj.id)
|
||||||
@ -233,8 +233,8 @@ class AddMembers(tables.BatchAction):
|
|||||||
def action(self, request, obj_id):
|
def action(self, request, obj_id):
|
||||||
user_obj = self.table.get_object_by_id(obj_id)
|
user_obj = self.table.get_object_by_id(obj_id)
|
||||||
group_id = self.table.kwargs['group_id']
|
group_id = self.table.kwargs['group_id']
|
||||||
LOG.info('Adding user %s to group %s.' % (user_obj.id,
|
LOG.info('Adding user %(user)s to group %(group)s.',
|
||||||
group_id))
|
{'user': user_obj.id, 'group': group_id})
|
||||||
api.keystone.add_group_user(request,
|
api.keystone.add_group_user(request,
|
||||||
group_id=group_id,
|
group_id=group_id,
|
||||||
user_id=user_obj.id)
|
user_id=user_obj.id)
|
||||||
|
@ -705,7 +705,7 @@ class UpdateProject(CommonQuotaWorkflow):
|
|||||||
self.failure_message = msg
|
self.failure_message = msg
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.debug('Project update failed: %s' % e)
|
LOG.debug('Project update failed: %s', e)
|
||||||
exceptions.handle(request, ignore=True)
|
exceptions.handle(request, ignore=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ class BaseUserForm(forms.SelfHandlingForm):
|
|||||||
self.fields['project'].choices = project_choices
|
self.fields['project'].choices = project_choices
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.debug("User: %s has no projects" % user_id)
|
LOG.debug("User: %s has no projects", user_id)
|
||||||
|
|
||||||
|
|
||||||
class AddExtraColumnMixIn(object):
|
class AddExtraColumnMixIn(object):
|
||||||
@ -162,7 +162,7 @@ class CreateUserForm(PasswordMixin, BaseUserForm, AddExtraColumnMixIn):
|
|||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
domain = api.keystone.get_default_domain(self.request, False)
|
domain = api.keystone.get_default_domain(self.request, False)
|
||||||
try:
|
try:
|
||||||
LOG.info('Creating user with name "%s"' % data['name'])
|
LOG.info('Creating user with name "%s"', data['name'])
|
||||||
desc = data["description"]
|
desc = data["description"]
|
||||||
if "email" in data:
|
if "email" in data:
|
||||||
data['email'] = data['email'] or None
|
data['email'] = data['email'] or None
|
||||||
|
@ -241,9 +241,8 @@ class DetailView(views.HorizonTemplateView):
|
|||||||
try:
|
try:
|
||||||
tenant = api.keystone.tenant_get(self.request, project_id)
|
tenant = api.keystone.tenant_get(self.request, project_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = ('Failed to get tenant %(project_id)s: %(reason)s' %
|
LOG.error('Failed to get tenant %(project_id)s: %(reason)s',
|
||||||
{'project_id': project_id, 'reason': e})
|
{'project_id': project_id, 'reason': e})
|
||||||
LOG.error(msg)
|
|
||||||
return tenant
|
return tenant
|
||||||
|
|
||||||
@memoized.memoized_method
|
@memoized.memoized_method
|
||||||
|
@ -145,7 +145,7 @@ class DisassociateIP(tables.Action):
|
|||||||
try:
|
try:
|
||||||
fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
|
fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id))
|
||||||
api.network.floating_ip_disassociate(request, fip.id)
|
api.network.floating_ip_disassociate(request, fip.id)
|
||||||
LOG.info('Disassociating Floating IP "%s".' % obj_id)
|
LOG.info('Disassociating Floating IP "%s".', obj_id)
|
||||||
messages.success(request,
|
messages.success(request,
|
||||||
_('Successfully disassociated Floating IP: %s')
|
_('Successfully disassociated Floating IP: %s')
|
||||||
% fip.ip)
|
% fip.ip)
|
||||||
|
@ -141,9 +141,9 @@ class IndexView(tables.DataTableView):
|
|||||||
instance.full_flavor = api.nova.flavor_get(
|
instance.full_flavor = api.nova.flavor_get(
|
||||||
self.request, flavor_id)
|
self.request, flavor_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
msg = ('Unable to retrieve flavor "%s" for instance "%s".'
|
LOG.info('Unable to retrieve flavor "%(flavor)s" for '
|
||||||
% (flavor_id, instance.id))
|
'instance "%(id)s".',
|
||||||
LOG.info(msg)
|
{'flavor': flavor_id, 'id': instance.id})
|
||||||
|
|
||||||
return instances
|
return instances
|
||||||
|
|
||||||
|
@ -677,7 +677,7 @@ class CustomizeAction(workflows.Action):
|
|||||||
if has_upload:
|
if has_upload:
|
||||||
upload_file = files[upload_str]
|
upload_file = files[upload_str]
|
||||||
log_script_name = upload_file.name
|
log_script_name = upload_file.name
|
||||||
LOG.info('got upload %s' % log_script_name)
|
LOG.info('got upload %s', log_script_name)
|
||||||
|
|
||||||
if upload_file._size > 16 * units.Ki: # 16kb
|
if upload_file._size > 16 * units.Ki: # 16kb
|
||||||
msg = _('File exceeds maximum size (16kb)')
|
msg = _('File exceeds maximum size (16kb)')
|
||||||
@ -975,7 +975,7 @@ def _cleanup_ports_on_failed_vm_launch(request, nics):
|
|||||||
LOG.debug('Cleaning up stale VM ports.')
|
LOG.debug('Cleaning up stale VM ports.')
|
||||||
for nic in nics:
|
for nic in nics:
|
||||||
try:
|
try:
|
||||||
LOG.debug('Deleting port with id: %s' % nic['port-id'])
|
LOG.debug('Deleting port with id: %s', nic['port-id'])
|
||||||
api.neutron.port_delete(request, nic['port-id'])
|
api.neutron.port_delete(request, nic['port-id'])
|
||||||
except Exception:
|
except Exception:
|
||||||
ports_failing_deletes.append(nic['port-id'])
|
ports_failing_deletes.append(nic['port-id'])
|
||||||
|
@ -223,7 +223,7 @@ class UpdatePort(forms.SelfHandlingForm):
|
|||||||
def handle(self, request, data):
|
def handle(self, request, data):
|
||||||
data['admin_state'] = (data['admin_state'] == 'True')
|
data['admin_state'] = (data['admin_state'] == 'True')
|
||||||
try:
|
try:
|
||||||
LOG.debug('params = %s' % data)
|
LOG.debug('params = %s', data)
|
||||||
extension_kwargs = {}
|
extension_kwargs = {}
|
||||||
if 'binding__vnic_type' in data:
|
if 'binding__vnic_type' in data:
|
||||||
extension_kwargs['binding__vnic_type'] = \
|
extension_kwargs['binding__vnic_type'] = \
|
||||||
|
@ -188,8 +188,7 @@ class UpdateSubnet(network_workflows.CreateNetwork):
|
|||||||
self._setup_subnet_parameters(params, data, is_create=False)
|
self._setup_subnet_parameters(params, data, is_create=False)
|
||||||
|
|
||||||
subnet = api.neutron.subnet_update(request, subnet_id, **params)
|
subnet = api.neutron.subnet_update(request, subnet_id, **params)
|
||||||
msg = _('Subnet "%s" was successfully updated.') % data['cidr']
|
LOG.debug('Subnet "%s" was successfully updated.', data['cidr'])
|
||||||
LOG.debug(msg)
|
|
||||||
return subnet
|
return subnet
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = (_('Failed to update subnet "%(sub)s": '
|
msg = (_('Failed to update subnet "%(sub)s": '
|
||||||
|
@ -467,9 +467,8 @@ class CreateNetwork(workflows.Workflow):
|
|||||||
'shared': data['shared']}
|
'shared': data['shared']}
|
||||||
network = api.neutron.network_create(request, **params)
|
network = api.neutron.network_create(request, **params)
|
||||||
self.context['net_id'] = network.id
|
self.context['net_id'] = network.id
|
||||||
msg = (_('Network "%s" was successfully created.') %
|
LOG.debug('Network "%s" was successfully created.',
|
||||||
network.name_or_id)
|
network.name_or_id)
|
||||||
LOG.debug(msg)
|
|
||||||
return network
|
return network
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = (_('Failed to create network "%(network)s": %(reason)s') %
|
msg = (_('Failed to create network "%(network)s": %(reason)s') %
|
||||||
@ -541,8 +540,7 @@ class CreateNetwork(workflows.Workflow):
|
|||||||
|
|
||||||
subnet = api.neutron.subnet_create(request, **params)
|
subnet = api.neutron.subnet_create(request, **params)
|
||||||
self.context['subnet_id'] = subnet.id
|
self.context['subnet_id'] = subnet.id
|
||||||
msg = _('Subnet "%s" was successfully created.') % data['cidr']
|
LOG.debug('Subnet "%s" was successfully created.', data['cidr'])
|
||||||
LOG.debug(msg)
|
|
||||||
return subnet
|
return subnet
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if network_name:
|
if network_name:
|
||||||
|
@ -191,7 +191,7 @@ class TemplateForm(forms.SelfHandlingForm):
|
|||||||
# Uploaded file handler
|
# Uploaded file handler
|
||||||
if has_upload and not url:
|
if has_upload and not url:
|
||||||
log_template_name = files[upload_str].name
|
log_template_name = files[upload_str].name
|
||||||
LOG.info('got upload %s' % log_template_name)
|
LOG.info('got upload %s', log_template_name)
|
||||||
|
|
||||||
tpl = files[upload_str].read()
|
tpl = files[upload_str].read()
|
||||||
if tpl.startswith('{'):
|
if tpl.startswith('{'):
|
||||||
|
@ -100,7 +100,7 @@ class StackEventsTab(tabs.Tab):
|
|||||||
try:
|
try:
|
||||||
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
|
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
|
||||||
events = api.heat.events_list(self.request, stack_identifier)
|
events = api.heat.events_list(self.request, stack_identifier)
|
||||||
LOG.debug('got events %s' % events)
|
LOG.debug('got events %s', events)
|
||||||
# The stack id is needed to generate the resource URL.
|
# The stack id is needed to generate the resource URL.
|
||||||
for event in events:
|
for event in events:
|
||||||
event.stack_id = stack.id
|
event.stack_id = stack.id
|
||||||
@ -131,7 +131,7 @@ class StackResourcesTab(tabs.Tab):
|
|||||||
try:
|
try:
|
||||||
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
|
stack_identifier = '%s/%s' % (stack.stack_name, stack.id)
|
||||||
resources = api.heat.resources_list(self.request, stack_identifier)
|
resources = api.heat.resources_list(self.request, stack_identifier)
|
||||||
LOG.debug('got resources %s' % resources)
|
LOG.debug('got resources %s', resources)
|
||||||
# The stack id is needed to generate the resource URL.
|
# The stack id is needed to generate the resource URL.
|
||||||
for r in resources:
|
for r in resources:
|
||||||
r.stack_id = stack.id
|
r.stack_id = stack.id
|
||||||
|
@ -57,7 +57,7 @@ class UpdateVPNService(forms.SelfHandlingForm):
|
|||||||
return vpnservice
|
return vpnservice
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = _('Failed to update VPN Service %s') % context['name']
|
msg = _('Failed to update VPN Service %s') % context['name']
|
||||||
LOG.info('%s: %s' % (msg, e))
|
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
|
||||||
redirect = reverse(self.failure_url)
|
redirect = reverse(self.failure_url)
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
@ -136,7 +136,7 @@ class UpdateIKEPolicy(forms.SelfHandlingForm):
|
|||||||
return ikepolicy
|
return ikepolicy
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = _('Failed to update IKE Policy %s') % context['name']
|
msg = _('Failed to update IKE Policy %s') % context['name']
|
||||||
LOG.info('%s: %s' % (msg, e))
|
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
|
||||||
redirect = reverse(self.failure_url)
|
redirect = reverse(self.failure_url)
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class UpdateIPSecPolicy(forms.SelfHandlingForm):
|
|||||||
return ipsecpolicy
|
return ipsecpolicy
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = _('Failed to update IPSec Policy %s') % context['name']
|
msg = _('Failed to update IPSec Policy %s') % context['name']
|
||||||
LOG.info('%s: %s' % (msg, e))
|
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
|
||||||
redirect = reverse(self.failure_url)
|
redirect = reverse(self.failure_url)
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
|
||||||
@ -324,6 +324,6 @@ class UpdateIPSecSiteConnection(forms.SelfHandlingForm):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
msg = (_('Failed to update IPSec Site Connection %s')
|
msg = (_('Failed to update IPSec Site Connection %s')
|
||||||
% context['name'])
|
% context['name'])
|
||||||
LOG.info('%s: %s' % (msg, e))
|
LOG.info('%(msg)s: %(exception)s', {'msg': msg, 'exception': e})
|
||||||
redirect = reverse(self.failure_url)
|
redirect = reverse(self.failure_url)
|
||||||
exceptions.handle(request, msg, redirect=redirect)
|
exceptions.handle(request, msg, redirect=redirect)
|
||||||
|
@ -33,4 +33,5 @@ try:
|
|||||||
if not os.path.exists(scss_asset_root):
|
if not os.path.exists(scss_asset_root):
|
||||||
os.makedirs(scss_asset_root)
|
os.makedirs(scss_asset_root)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
LOG.info("Error precreating path %s, %s" % (scss_asset_root, e))
|
LOG.info("Error precreating path %(root)s, %(exc)s",
|
||||||
|
{'root': scss_asset_root, 'exc': e})
|
||||||
|
@ -360,7 +360,7 @@ if os.path.exists(LOCAL_SETTINGS_DIR_PATH):
|
|||||||
exec(f.read())
|
exec(f.read())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.exception(
|
logging.exception(
|
||||||
"Can not exec settings snippet %s" % filename)
|
"Can not exec settings snippet %s", filename)
|
||||||
|
|
||||||
# The purpose of OPENSTACK_IMAGE_FORMATS is to provide a simple object
|
# The purpose of OPENSTACK_IMAGE_FORMATS is to provide a simple object
|
||||||
# that does not contain the lazy-loaded translations, so the list can
|
# that does not contain the lazy-loaded translations, so the list can
|
||||||
|
@ -77,7 +77,7 @@ def get_available_themes(available_themes, custom_path, default_path,
|
|||||||
default_theme = available_themes[custom_ndx][0]
|
default_theme = available_themes[custom_ndx][0]
|
||||||
logging.warning("Your AVAILABLE_THEMES already contains your "
|
logging.warning("Your AVAILABLE_THEMES already contains your "
|
||||||
"CUSTOM_THEME_PATH, therefore using configuration in "
|
"CUSTOM_THEME_PATH, therefore using configuration in "
|
||||||
"AVAILABLE_THEMES for %s." % custom_path)
|
"AVAILABLE_THEMES for %s.", custom_path)
|
||||||
|
|
||||||
elif custom_path is not None:
|
elif custom_path is not None:
|
||||||
new_theme_list.append(
|
new_theme_list.append(
|
||||||
|
@ -29,7 +29,7 @@ def import_submodules(module):
|
|||||||
submodule = import_module(name)
|
submodule = import_module(name)
|
||||||
except ImportError as e:
|
except ImportError as e:
|
||||||
# FIXME: Make the errors non-fatal (do we want that?).
|
# FIXME: Make the errors non-fatal (do we want that?).
|
||||||
logging.warning("Error importing %s" % name)
|
logging.warning("Error importing %s", name)
|
||||||
logging.exception(e)
|
logging.exception(e)
|
||||||
else:
|
else:
|
||||||
parent, child = name.rsplit('.', 1)
|
parent, child = name.rsplit('.', 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user