Merge "Use the right log marker functions"
This commit is contained in:
commit
74dd800383
@ -35,7 +35,7 @@ from oslo.config import cfg
|
|||||||
from oslo import i18n
|
from oslo import i18n
|
||||||
|
|
||||||
from heat.common import config
|
from heat.common import config
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _LI
|
||||||
from heat.common import messaging
|
from heat.common import messaging
|
||||||
from heat.common import profiler
|
from heat.common import profiler
|
||||||
from heat.common import wsgi
|
from heat.common import wsgi
|
||||||
@ -56,7 +56,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
port = cfg.CONF.heat_api.bind_port
|
port = cfg.CONF.heat_api.bind_port
|
||||||
host = cfg.CONF.heat_api.bind_host
|
host = cfg.CONF.heat_api.bind_host
|
||||||
LOG.info(_('Starting Heat ReST API on %(host)s:%(port)s'),
|
LOG.info(_LI('Starting Heat ReST API on %(host)s:%(port)s'),
|
||||||
{'host': host, 'port': port})
|
{'host': host, 'port': port})
|
||||||
profiler.setup('heat-api', host)
|
profiler.setup('heat-api', host)
|
||||||
server = wsgi.Server()
|
server = wsgi.Server()
|
||||||
|
@ -37,7 +37,7 @@ from oslo.config import cfg
|
|||||||
from oslo import i18n
|
from oslo import i18n
|
||||||
|
|
||||||
from heat.common import config
|
from heat.common import config
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _LI
|
||||||
from heat.common import messaging
|
from heat.common import messaging
|
||||||
from heat.common import profiler
|
from heat.common import profiler
|
||||||
from heat.common import wsgi
|
from heat.common import wsgi
|
||||||
@ -58,7 +58,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
port = cfg.CONF.heat_api_cfn.bind_port
|
port = cfg.CONF.heat_api_cfn.bind_port
|
||||||
host = cfg.CONF.heat_api_cfn.bind_host
|
host = cfg.CONF.heat_api_cfn.bind_host
|
||||||
LOG.info(_('Starting Heat API on %(host)s:%(port)s'),
|
LOG.info(_LI('Starting Heat API on %(host)s:%(port)s'),
|
||||||
{'host': host, 'port': port})
|
{'host': host, 'port': port})
|
||||||
profiler.setup('heat-api-cfn', host)
|
profiler.setup('heat-api-cfn', host)
|
||||||
server = wsgi.Server()
|
server = wsgi.Server()
|
||||||
|
@ -37,7 +37,7 @@ from oslo.config import cfg
|
|||||||
from oslo import i18n
|
from oslo import i18n
|
||||||
|
|
||||||
from heat.common import config
|
from heat.common import config
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _LI
|
||||||
from heat.common import messaging
|
from heat.common import messaging
|
||||||
from heat.common import profiler
|
from heat.common import profiler
|
||||||
from heat.common import wsgi
|
from heat.common import wsgi
|
||||||
@ -58,7 +58,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
port = cfg.CONF.heat_api_cloudwatch.bind_port
|
port = cfg.CONF.heat_api_cloudwatch.bind_port
|
||||||
host = cfg.CONF.heat_api_cloudwatch.bind_host
|
host = cfg.CONF.heat_api_cloudwatch.bind_host
|
||||||
LOG.info(_('Starting Heat CloudWatch API on %(host)s:%(port)s'),
|
LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'),
|
||||||
{'host': host, 'port': port})
|
{'host': host, 'port': port})
|
||||||
profiler.setup('heat-api-cloudwatch', host)
|
profiler.setup('heat-api-cloudwatch', host)
|
||||||
server = wsgi.Server()
|
server = wsgi.Server()
|
||||||
|
@ -21,6 +21,9 @@ import pkg_resources
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
from heat.common.i18n import _LE
|
||||||
|
from heat.common.i18n import _LI
|
||||||
|
|
||||||
|
|
||||||
VAR_PATH = '/var/lib/heat-cfntools'
|
VAR_PATH = '/var/lib/heat-cfntools'
|
||||||
LOG = logging.getLogger('heat-provision')
|
LOG = logging.getLogger('heat-provision')
|
||||||
@ -59,14 +62,14 @@ def call(args):
|
|||||||
except OSError:
|
except OSError:
|
||||||
ex_type, ex, tb = sys.exc_info()
|
ex_type, ex, tb = sys.exc_info()
|
||||||
if ex.errno == errno.ENOEXEC:
|
if ex.errno == errno.ENOEXEC:
|
||||||
LOG.error('Userdata empty or not executable: %s', ex)
|
LOG.error(_LE('Userdata empty or not executable: %s'), ex)
|
||||||
return os.EX_OK
|
return os.EX_OK
|
||||||
else:
|
else:
|
||||||
LOG.error('OS error running userdata: %s', ex)
|
LOG.error(_LE('OS error running userdata: %s'), ex)
|
||||||
return os.EX_OSERR
|
return os.EX_OSERR
|
||||||
except Exception:
|
except Exception:
|
||||||
ex_type, ex, tb = sys.exc_info()
|
ex_type, ex, tb = sys.exc_info()
|
||||||
LOG.error('Unknown error running userdata: %s', ex)
|
LOG.error(_LE('Unknown error running userdata: %s'), ex)
|
||||||
return os.EX_SOFTWARE
|
return os.EX_SOFTWARE
|
||||||
return p.returncode
|
return p.returncode
|
||||||
|
|
||||||
@ -75,16 +78,16 @@ def main():
|
|||||||
|
|
||||||
if not chk_ci_version():
|
if not chk_ci_version():
|
||||||
# pre 0.6.0 - user data executed via cloudinit, not this helper
|
# pre 0.6.0 - user data executed via cloudinit, not this helper
|
||||||
LOG.error('Unable to log provisioning, need a newer version of'
|
LOG.error(_LE('Unable to log provisioning, need a newer version '
|
||||||
' cloud-init')
|
'of cloud-init'))
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
userdata_path = os.path.join(VAR_PATH, 'cfn-userdata')
|
userdata_path = os.path.join(VAR_PATH, 'cfn-userdata')
|
||||||
os.chmod(userdata_path, int("700", 8))
|
os.chmod(userdata_path, int("700", 8))
|
||||||
|
|
||||||
LOG.info('Provision began: %s', datetime.datetime.now())
|
LOG.info(_LI('Provision began: %s'), datetime.datetime.now())
|
||||||
returncode = call([userdata_path])
|
returncode = call([userdata_path])
|
||||||
LOG.info('Provision done: %s', datetime.datetime.now())
|
LOG.info(_LI('Provision done: %s'), datetime.datetime.now())
|
||||||
if returncode:
|
if returncode:
|
||||||
return returncode
|
return returncode
|
||||||
|
|
||||||
@ -94,7 +97,7 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
code = main()
|
code = main()
|
||||||
if code:
|
if code:
|
||||||
LOG.error('Provision failed with exit code %s', code)
|
LOG.error(_LE('Provision failed with exit code %s'), code)
|
||||||
sys.exit(code)
|
sys.exit(code)
|
||||||
|
|
||||||
provision_log = os.path.join(VAR_PATH, 'provision-finished')
|
provision_log = os.path.join(VAR_PATH, 'provision-finished')
|
||||||
|
@ -23,6 +23,7 @@ import six
|
|||||||
from six.moves.urllib import parse as urlparse
|
from six.moves.urllib import parse as urlparse
|
||||||
|
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
|
from heat.common.i18n import _LE
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
|
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ class HeatException(Exception):
|
|||||||
exc_info = sys.exc_info()
|
exc_info = sys.exc_info()
|
||||||
#kwargs doesn't match a variable in the message
|
#kwargs doesn't match a variable in the message
|
||||||
#log the issue and the kwargs
|
#log the issue and the kwargs
|
||||||
LOG.exception(_('Exception in string format operation'))
|
LOG.exception(_LE('Exception in string format operation'))
|
||||||
for name, value in six.iteritems(kwargs):
|
for name, value in six.iteritems(kwargs):
|
||||||
LOG.error("%s: %s" % (name, value)) # noqa
|
LOG.error("%s: %s" % (name, value)) # noqa
|
||||||
|
|
||||||
|
@ -320,11 +320,11 @@ class KeystoneClientV3(object):
|
|||||||
if len(domains) == 1:
|
if len(domains) == 1:
|
||||||
return domains[0].id
|
return domains[0].id
|
||||||
elif len(domains) == 0:
|
elif len(domains) == 0:
|
||||||
msg = _LE('Can\'t find domain id for %s!')
|
msg = _('Can\'t find domain id for %s!')
|
||||||
LOG.error(msg, domain_name)
|
LOG.error(msg, domain_name)
|
||||||
raise exception.Error(msg % domain_name)
|
raise exception.Error(msg % domain_name)
|
||||||
else:
|
else:
|
||||||
msg = _LE('Multiple domain ids were found for %s!')
|
msg = _('Multiple domain ids were found for %s!')
|
||||||
LOG.error(msg, domain_name)
|
LOG.error(msg, domain_name)
|
||||||
raise exception.Error(msg % domain_name)
|
raise exception.Error(msg % domain_name)
|
||||||
|
|
||||||
@ -524,12 +524,12 @@ class KeystoneClientV3(object):
|
|||||||
try:
|
try:
|
||||||
project = self.domain_admin_client.projects.get(project=project_id)
|
project = self.domain_admin_client.projects.get(project=project_id)
|
||||||
except kc_exception.Forbidden:
|
except kc_exception.Forbidden:
|
||||||
LOG.warning(_('Unable to get details for project %s, not deleting')
|
LOG.warning(_LW('Unable to get details for project %s, '
|
||||||
% project_id)
|
'not deleting') % project_id)
|
||||||
return
|
return
|
||||||
|
|
||||||
if project.domain_id != self.stack_domain_id:
|
if project.domain_id != self.stack_domain_id:
|
||||||
LOG.warning(_('Not deleting non heat-domain project'))
|
LOG.warning(_LW('Not deleting non heat-domain project'))
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -15,8 +15,8 @@
|
|||||||
'''
|
'''
|
||||||
Utility for fetching and running plug point implementation classes
|
Utility for fetching and running plug point implementation classes
|
||||||
'''
|
'''
|
||||||
from heat.common.i18n import _
|
|
||||||
from heat.common.i18n import _LE
|
from heat.common.i18n import _LE
|
||||||
|
from heat.common.i18n import _LI
|
||||||
from heat.engine import resources
|
from heat.engine import resources
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
|
|
||||||
@ -113,6 +113,6 @@ def _do_ops(cinstances, opname, cnxt, stack, current_stack=None, action=None,
|
|||||||
failure = True
|
failure = True
|
||||||
failure_exception_message = ex.args[0] if ex.args else str(ex)
|
failure_exception_message = ex.args[0] if ex.args else str(ex)
|
||||||
break
|
break
|
||||||
LOG.info(_("done with class=%(c)s, stackid=%(sid)s, action=%(a)s") %
|
LOG.info(_LI("done with class=%(c)s, stackid=%(sid)s, action=%(a)s") %
|
||||||
{'c': type(ci), 'sid': stack.id, 'a': action})
|
{'c': type(ci), 'sid': stack.id, 'a': action})
|
||||||
return (failure, failure_exception_message, success_count)
|
return (failure, failure_exception_message, success_count)
|
||||||
|
@ -17,6 +17,7 @@ import osprofiler.profiler
|
|||||||
import osprofiler.web
|
import osprofiler.web
|
||||||
|
|
||||||
from heat.common import context
|
from heat.common import context
|
||||||
|
from heat.common.i18n import _LW
|
||||||
from heat.common import messaging as rpc_messaging
|
from heat.common import messaging as rpc_messaging
|
||||||
from heat.openstack.common import log as logging
|
from heat.openstack.common import log as logging
|
||||||
|
|
||||||
@ -31,14 +32,14 @@ def setup(binary, host):
|
|||||||
"Messaging", messaging, context.get_admin_context().to_dict(),
|
"Messaging", messaging, context.get_admin_context().to_dict(),
|
||||||
rpc_messaging.TRANSPORT, "heat", binary, host)
|
rpc_messaging.TRANSPORT, "heat", binary, host)
|
||||||
osprofiler.notifier.set(_notifier)
|
osprofiler.notifier.set(_notifier)
|
||||||
LOG.warning("OSProfiler is enabled.\nIt means that person who knows "
|
LOG.warning(_LW("OSProfiler is enabled.\nIt means that person who "
|
||||||
"any of hmac_keys that are specified in "
|
"knows any of hmac_keys that are specified in "
|
||||||
"/etc/heat/api-paste.ini can trace his requests. \n"
|
"/etc/heat/api-paste.ini can trace his requests. \n"
|
||||||
"In real life only operator can read this file so there "
|
"In real life only operator can read this file so "
|
||||||
"is no security issue. Note that even if person can "
|
"there is no security issue. Note that even if person "
|
||||||
"trigger profiler, only admin user can retrieve trace "
|
"can trigger profiler, only admin user can retrieve "
|
||||||
"information.\n"
|
"trace information.\n"
|
||||||
"To disable OSprofiler set in heat.conf:\n"
|
"To disable OSprofiler set in heat.conf:\n"
|
||||||
"[profiler]\nenabled=false")
|
"[profiler]\nenabled=false"))
|
||||||
else:
|
else:
|
||||||
osprofiler.web.disable()
|
osprofiler.web.disable()
|
||||||
|
@ -46,6 +46,9 @@ import webob.exc
|
|||||||
from heat.api.aws import exception as aws_exception
|
from heat.api.aws import exception as aws_exception
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
|
from heat.common.i18n import _LE
|
||||||
|
from heat.common.i18n import _LI
|
||||||
|
from heat.common.i18n import _LW
|
||||||
from heat.common import serializers
|
from heat.common import serializers
|
||||||
|
|
||||||
|
|
||||||
@ -260,7 +263,7 @@ class Server(object):
|
|||||||
"""
|
"""
|
||||||
def kill_children(*args):
|
def kill_children(*args):
|
||||||
"""Kills the entire process group."""
|
"""Kills the entire process group."""
|
||||||
self.LOG.error(_('SIGTERM received'))
|
self.LOG.error(_LE('SIGTERM received'))
|
||||||
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
signal.signal(signal.SIGTERM, signal.SIG_IGN)
|
||||||
self.running = False
|
self.running = False
|
||||||
os.killpg(0, signal.SIGTERM)
|
os.killpg(0, signal.SIGTERM)
|
||||||
@ -269,7 +272,7 @@ class Server(object):
|
|||||||
"""
|
"""
|
||||||
Shuts down the server(s), but allows running requests to complete
|
Shuts down the server(s), but allows running requests to complete
|
||||||
"""
|
"""
|
||||||
self.LOG.error(_('SIGHUP received'))
|
self.LOG.error(_LE('SIGHUP received'))
|
||||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||||
os.killpg(0, signal.SIGHUP)
|
os.killpg(0, signal.SIGHUP)
|
||||||
signal.signal(signal.SIGHUP, hup)
|
signal.signal(signal.SIGHUP, hup)
|
||||||
@ -286,7 +289,7 @@ class Server(object):
|
|||||||
self.pool.spawn_n(self._single_run, application, self.sock)
|
self.pool.spawn_n(self._single_run, application, self.sock)
|
||||||
return
|
return
|
||||||
|
|
||||||
self.LOG.info(_("Starting %d workers") % conf.workers)
|
self.LOG.info(_LI("Starting %d workers") % conf.workers)
|
||||||
signal.signal(signal.SIGTERM, kill_children)
|
signal.signal(signal.SIGTERM, kill_children)
|
||||||
signal.signal(signal.SIGHUP, hup)
|
signal.signal(signal.SIGHUP, hup)
|
||||||
while len(self.children) < conf.workers:
|
while len(self.children) < conf.workers:
|
||||||
@ -297,14 +300,14 @@ class Server(object):
|
|||||||
try:
|
try:
|
||||||
pid, status = os.wait()
|
pid, status = os.wait()
|
||||||
if os.WIFEXITED(status) or os.WIFSIGNALED(status):
|
if os.WIFEXITED(status) or os.WIFSIGNALED(status):
|
||||||
self.LOG.error(_('Removing dead child %s') % pid)
|
self.LOG.error(_LE('Removing dead child %s') % pid)
|
||||||
self.children.remove(pid)
|
self.children.remove(pid)
|
||||||
self.run_child()
|
self.run_child()
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
if err.errno not in (errno.EINTR, errno.ECHILD):
|
if err.errno not in (errno.EINTR, errno.ECHILD):
|
||||||
raise
|
raise
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.LOG.info(_('Caught keyboard interrupt. Exiting.'))
|
self.LOG.info(_LI('Caught keyboard interrupt. Exiting.'))
|
||||||
os.killpg(0, signal.SIGTERM)
|
os.killpg(0, signal.SIGTERM)
|
||||||
break
|
break
|
||||||
eventlet.greenio.shutdown_safe(self.sock)
|
eventlet.greenio.shutdown_safe(self.sock)
|
||||||
@ -327,10 +330,10 @@ class Server(object):
|
|||||||
signal.signal(signal.SIGHUP, signal.SIG_DFL)
|
signal.signal(signal.SIGHUP, signal.SIG_DFL)
|
||||||
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
signal.signal(signal.SIGTERM, signal.SIG_DFL)
|
||||||
self.run_server()
|
self.run_server()
|
||||||
self.LOG.info(_('Child %d exiting normally') % os.getpid())
|
self.LOG.info(_LI('Child %d exiting normally') % os.getpid())
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.LOG.info(_('Started child %s') % pid)
|
self.LOG.info(_LI('Started child %s') % pid)
|
||||||
self.children.append(pid)
|
self.children.append(pid)
|
||||||
|
|
||||||
def run_server(self):
|
def run_server(self):
|
||||||
@ -353,7 +356,7 @@ class Server(object):
|
|||||||
|
|
||||||
def _single_run(self, application, sock):
|
def _single_run(self, application, sock):
|
||||||
"""Start a WSGI server in a new green thread."""
|
"""Start a WSGI server in a new green thread."""
|
||||||
self.LOG.info(_("Starting single process server"))
|
self.LOG.info(_LI("Starting single process server"))
|
||||||
eventlet.wsgi.server(sock, application,
|
eventlet.wsgi.server(sock, application,
|
||||||
custom_pool=self.pool,
|
custom_pool=self.pool,
|
||||||
url_length_limit=URL_LENGTH_LIMIT,
|
url_length_limit=URL_LENGTH_LIMIT,
|
||||||
@ -627,13 +630,13 @@ class Resource(object):
|
|||||||
action_args.update(deserialized_request)
|
action_args.update(deserialized_request)
|
||||||
|
|
||||||
logging.debug(
|
logging.debug(
|
||||||
_('Calling %(controller)s : %(action)s'),
|
('Calling %(controller)s : %(action)s'),
|
||||||
{'controller': self.controller, 'action': action})
|
{'controller': self.controller, 'action': action})
|
||||||
|
|
||||||
action_result = self.dispatch(self.controller, action,
|
action_result = self.dispatch(self.controller, action,
|
||||||
request, **action_args)
|
request, **action_args)
|
||||||
except TypeError as err:
|
except TypeError as err:
|
||||||
logging.error(_('Exception handling resource: %s') % err)
|
logging.error(_LE('Exception handling resource: %s') % err)
|
||||||
msg = _('The server could not comply with the request since '
|
msg = _('The server could not comply with the request since '
|
||||||
'it is either malformed or otherwise incorrect.')
|
'it is either malformed or otherwise incorrect.')
|
||||||
err = webob.exc.HTTPBadRequest(msg)
|
err = webob.exc.HTTPBadRequest(msg)
|
||||||
@ -655,7 +658,7 @@ class Resource(object):
|
|||||||
raise
|
raise
|
||||||
if isinstance(err, webob.exc.HTTPServerError):
|
if isinstance(err, webob.exc.HTTPServerError):
|
||||||
logging.error(
|
logging.error(
|
||||||
_("Returning %(code)s to user: %(explanation)s"),
|
_LE("Returning %(code)s to user: %(explanation)s"),
|
||||||
{'code': err.code, 'explanation': err.explanation})
|
{'code': err.code, 'explanation': err.explanation})
|
||||||
http_exc = translate_exception(err, request.best_match_language())
|
http_exc = translate_exception(err, request.best_match_language())
|
||||||
raise exception.HTTPExceptionDisguise(http_exc)
|
raise exception.HTTPExceptionDisguise(http_exc)
|
||||||
@ -694,7 +697,7 @@ class Resource(object):
|
|||||||
err_body = action_result.get_unserialized_body()
|
err_body = action_result.get_unserialized_body()
|
||||||
serializer.default(action_result, err_body)
|
serializer.default(action_result, err_body)
|
||||||
except Exception:
|
except Exception:
|
||||||
logging.warning(_("Unable to serialize exception "
|
logging.warning(_LW("Unable to serialize exception "
|
||||||
"response"))
|
"response"))
|
||||||
|
|
||||||
return action_result
|
return action_result
|
||||||
@ -729,7 +732,7 @@ class Resource(object):
|
|||||||
|
|
||||||
def log_exception(err, exc_info):
|
def log_exception(err, exc_info):
|
||||||
args = {'exc_info': exc_info} if cfg.CONF.verbose or cfg.CONF.debug else {}
|
args = {'exc_info': exc_info} if cfg.CONF.verbose or cfg.CONF.debug else {}
|
||||||
logging.error(_("Unexpected error occurred serving API: %s") % err,
|
logging.error(_LE("Unexpected error occurred serving API: %s") % err,
|
||||||
**args)
|
**args)
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ def extract_args(params):
|
|||||||
try:
|
try:
|
||||||
timeout = int(timeout_mins)
|
timeout = int(timeout_mins)
|
||||||
except (ValueError, TypeError):
|
except (ValueError, TypeError):
|
||||||
LOG.exception(_('Timeout conversion failed'))
|
LOG.exception(_LE('Timeout conversion failed'))
|
||||||
else:
|
else:
|
||||||
if timeout > 0:
|
if timeout > 0:
|
||||||
kwargs[api.PARAM_TIMEOUT] = timeout
|
kwargs[api.PARAM_TIMEOUT] = timeout
|
||||||
|
@ -472,7 +472,7 @@ class Resource(object):
|
|||||||
try:
|
try:
|
||||||
self.state_set(action, self.FAILED, '%s aborted' % action)
|
self.state_set(action, self.FAILED, '%s aborted' % action)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_('Error marking resource as failed'))
|
LOG.exception(_LE('Error marking resource as failed'))
|
||||||
else:
|
else:
|
||||||
self.state_set(action, self.COMPLETE)
|
self.state_set(action, self.COMPLETE)
|
||||||
|
|
||||||
@ -1079,7 +1079,7 @@ class Resource(object):
|
|||||||
reason_string = get_string_details()
|
reason_string = get_string_details()
|
||||||
self._add_event('signal', self.status, reason_string)
|
self._add_event('signal', self.status, reason_string)
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
LOG.exception(_('signal %(name)s : %(msg)s')
|
LOG.exception(_LE('signal %(name)s : %(msg)s')
|
||||||
% {'name': six.text_type(self), 'msg': ex})
|
% {'name': six.text_type(self), 'msg': ex})
|
||||||
failure = exception.ResourceFailure(ex, self)
|
failure = exception.ResourceFailure(ex, self)
|
||||||
raise failure
|
raise failure
|
||||||
|
@ -17,6 +17,7 @@ import six
|
|||||||
|
|
||||||
from heat.common import exception
|
from heat.common import exception
|
||||||
from heat.common.i18n import _
|
from heat.common.i18n import _
|
||||||
|
from heat.common.i18n import _LE
|
||||||
from heat.common.i18n import _LI
|
from heat.common.i18n import _LI
|
||||||
from heat.engine import constraints
|
from heat.engine import constraints
|
||||||
from heat.engine.notification import autoscaling as notification
|
from heat.engine.notification import autoscaling as notification
|
||||||
@ -56,11 +57,11 @@ def _calculate_new_capacity(current, adjustment, adjustment_type,
|
|||||||
new_capacity = current + rounded
|
new_capacity = current + rounded
|
||||||
|
|
||||||
if new_capacity > maximum:
|
if new_capacity > maximum:
|
||||||
LOG.debug(_('truncating growth to %s') % maximum)
|
LOG.debug('truncating growth to %s' % maximum)
|
||||||
return maximum
|
return maximum
|
||||||
|
|
||||||
if new_capacity < minimum:
|
if new_capacity < minimum:
|
||||||
LOG.debug(_('truncating shrinkage to %s') % minimum)
|
LOG.debug('truncating shrinkage to %s' % minimum)
|
||||||
return minimum
|
return minimum
|
||||||
|
|
||||||
return new_capacity
|
return new_capacity
|
||||||
@ -288,7 +289,7 @@ class AutoScalingGroup(instgrp.InstanceGroup, cooldown.CooldownMixin):
|
|||||||
})
|
})
|
||||||
notification.send(**notif)
|
notification.send(**notif)
|
||||||
except Exception:
|
except Exception:
|
||||||
LOG.exception(_('Failed sending error notification'))
|
LOG.exception(_LE('Failed sending error notification'))
|
||||||
else:
|
else:
|
||||||
notif.update({
|
notif.update({
|
||||||
'suffix': 'end',
|
'suffix': 'end',
|
||||||
|
@ -1126,8 +1126,8 @@ class Stack(collections.Mapping):
|
|||||||
res.state_reset()
|
res.state_reset()
|
||||||
scheduler.TaskRunner(res.create)()
|
scheduler.TaskRunner(res.create)()
|
||||||
except exception.ResourceFailure as ex:
|
except exception.ResourceFailure as ex:
|
||||||
LOG.exception(_('Resource %(name)s create failed: %(ex)s')
|
LOG.exception(_LE('Resource %(name)s create failed: '
|
||||||
% {'name': res.name, 'ex': ex})
|
'%(ex)s') % {'name': res.name, 'ex': ex})
|
||||||
failed = True
|
failed = True
|
||||||
else:
|
else:
|
||||||
res.state_set(res.CREATE, res.FAILED,
|
res.state_set(res.CREATE, res.FAILED,
|
||||||
|
Loading…
Reference in New Issue
Block a user