Merge "Remove log translations"

This commit is contained in:
Jenkins 2017-04-03 19:14:12 +00:00 committed by Gerrit Code Review
commit 1f0064213e
38 changed files with 190 additions and 236 deletions

View File

@ -21,7 +21,7 @@ from oslo_config import cfg
from oslo_log import log from oslo_log import log
from webob import exc from webob import exc
from murano.common.i18n import _, _LW from murano.common.i18n import _
from murano.common import wsgi from murano.common import wsgi
CONF = cfg.CONF CONF = cfg.CONF
@ -44,7 +44,7 @@ class ExternalContextMiddleware(wsgi.Middleware):
elif auth_url.endswith('v3'): elif auth_url.endswith('v3'):
pass pass
else: else:
LOG.warning(_LW('Wrong format for service broker auth url')) LOG.warning('Wrong format for service broker auth url')
kwargs = {'auth_url': auth_url, kwargs = {'auth_url': auth_url,
'username': user, 'username': user,

View File

@ -21,7 +21,6 @@ return
from oslo_log import log as logging from oslo_log import log as logging
from murano.api import versions from murano.api import versions
from murano.common.i18n import _LW
from murano.common import wsgi from murano.common import wsgi
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -51,7 +50,7 @@ class VersionNegotiationFilter(wsgi.Middleware):
try: try:
version = self._match_version_string(req_version) version = self._match_version_string(req_version)
except ValueError: except ValueError:
LOG.warning(_LW("Unknown version. Returning version choices.")) LOG.warning("Unknown version. Returning version choices.")
return self.versions_app return self.versions_app
req.environ['api.version'] = version req.environ['api.version'] = version

View File

@ -20,7 +20,6 @@ from murano.common import wsgi
from murano.db.services import environments as envs from murano.db.services import environments as envs
from murano.db.services import sessions from murano.db.services import sessions
from murano.db import session as db_session from murano.db import session as db_session
from murano.common.i18n import _LE, _, _LW
from murano.services import actions from murano.services import actions
from murano.services import states from murano.services import states
from murano.utils import verify_env from murano.utils import verify_env
@ -43,17 +42,17 @@ class Controller(object):
env_status = envs.EnvironmentServices.get_status(environment_id) env_status = envs.EnvironmentServices.get_status(environment_id)
if env_status in (states.EnvironmentStatus.DEPLOYING, if env_status in (states.EnvironmentStatus.DEPLOYING,
states.EnvironmentStatus.DELETING): states.EnvironmentStatus.DELETING):
LOG.warning(_LW('Could not open session for environment ' LOG.warning('Could not open session for environment '
'<EnvId: {id}>, environment has deploying ' '<EnvId: {id}>, environment has deploying '
'status.').format(id=environment_id)) 'status.'.format(id=environment_id))
raise exc.HTTPForbidden() raise exc.HTTPForbidden()
user_id = request.context.user user_id = request.context.user
session = sessions.SessionServices.create(environment_id, user_id) session = sessions.SessionServices.create(environment_id, user_id)
if not sessions.SessionServices.validate(session): if not sessions.SessionServices.validate(session):
LOG.error(_LE('Session <SessionId {id}> ' LOG.error('Session <SessionId {id}> '
'is invalid').format(id=session.id)) 'is invalid'.format(id=session.id))
raise exc.HTTPForbidden() raise exc.HTTPForbidden()
task_id = actions.ActionServices.execute( task_id = actions.ActionServices.execute(
@ -72,9 +71,9 @@ class Controller(object):
if result is not None: if result is not None:
return result return result
msg = _('Result for task with environment_id: {env_id} and task_id: ' msg = ('Result for task with environment_id: {env_id} and task_id: '
'{task_id} was not found.').format(env_id=environment_id, '{task_id} was not found.'.format(env_id=environment_id,
task_id=task_id) task_id=task_id))
LOG.error(msg) LOG.error(msg)
raise exc.HTTPNotFound(msg) raise exc.HTTPNotFound(msg)

View File

@ -30,11 +30,11 @@ from webob import exc
import murano.api.v1 import murano.api.v1
from murano.api.v1 import validation_schemas from murano.api.v1 import validation_schemas
from murano.common import exceptions from murano.common import exceptions
from murano.common.i18n import _
from murano.common import policy from murano.common import policy
import murano.common.utils as murano_utils import murano.common.utils as murano_utils
from murano.common import wsgi from murano.common import wsgi
from murano.db.catalog import api as db_api from murano.db.catalog import api as db_api
from murano.common.i18n import _, _LW
from murano.packages import exceptions as pkg_exc from murano.packages import exceptions as pkg_exc
from murano.packages import load_utils from murano.packages import load_utils
from muranoclient.glance import client as glare_client from muranoclient.glance import client as glare_client
@ -64,8 +64,8 @@ def _get_filters(query_params):
for param_pair in query_params: for param_pair in query_params:
k, v = param_pair k, v = param_pair
if k not in SUPPORTED_PARAMS: if k not in SUPPORTED_PARAMS:
LOG.warning(_LW("Search by parameter '{name}' " LOG.warning("Search by parameter '{name}' "
"is not supported. Skipping it.").format(name=k)) "is not supported. Skipping it.".format(name=k))
continue continue
if k in LIST_PARAMS: if k in LIST_PARAMS:
@ -74,10 +74,10 @@ def _get_filters(query_params):
try: try:
filters[k] = murano_utils.split_for_quotes(in_value) filters[k] = murano_utils.split_for_quotes(in_value)
except ValueError as err: except ValueError as err:
LOG.warning(_LW("Search by parameter '{name}' " LOG.warning("Search by parameter '{name}' "
"caused an {message} error." "caused an {message} error."
"Skipping it.").format(name=k, "Skipping it.".format(name=k,
message=err)) message=err))
else: else:
filters.setdefault(k, []).append(v) filters.setdefault(k, []).append(v)
else: else:
@ -86,8 +86,8 @@ def _get_filters(query_params):
for i in order_by[:]: for i in order_by[:]:
if ORDER_VALUES and i not in ORDER_VALUES: if ORDER_VALUES and i not in ORDER_VALUES:
filters['order_by'].remove(i) filters['order_by'].remove(i)
LOG.warning(_LW("Value of 'order_by' parameter is not valid. " LOG.warning("Value of 'order_by' parameter is not valid. "
"Allowed values are: {values}. Skipping it.") "Allowed values are: {values}. Skipping it."
.format(values=", ".join(ORDER_VALUES))) .format(values=", ".join(ORDER_VALUES)))
return filters return filters

View File

@ -19,7 +19,6 @@ from webob import exc
from murano.api.v1 import request_statistics from murano.api.v1 import request_statistics
from murano.common.helpers import token_sanitizer from murano.common.helpers import token_sanitizer
from murano.common.i18n import _LE
from murano.common import policy from murano.common import policy
from murano.common import utils from murano.common import utils
from murano.common import wsgi from murano.common import wsgi
@ -111,13 +110,13 @@ def _patch_description(description):
def verify_and_get_deployment(db_session, environment_id, deployment_id): def verify_and_get_deployment(db_session, environment_id, deployment_id):
deployment = db_session.query(models.Task).get(deployment_id) deployment = db_session.query(models.Task).get(deployment_id)
if not deployment: if not deployment:
LOG.error(_LE('Deployment with id {id} not found') LOG.error('Deployment with id {id} not found'
.format(id=deployment_id)) .format(id=deployment_id))
raise exc.HTTPNotFound raise exc.HTTPNotFound
if deployment.environment_id != environment_id: if deployment.environment_id != environment_id:
LOG.error(_LE('Deployment with id {d_id} not found in environment ' LOG.error('Deployment with id {d_id} not found in environment '
'{env_id}').format(d_id=deployment_id, '{env_id}'.format(d_id=deployment_id,
env_id=environment_id)) env_id=environment_id))
raise exc.HTTPBadRequest raise exc.HTTPBadRequest
deployment.description = _patch_description(deployment.description) deployment.description = _patch_description(deployment.description)

View File

@ -17,7 +17,6 @@ import time
from oslo_log import log as logging from oslo_log import log as logging
from murano.api import v1 from murano.api import v1
from murano.common.i18n import _LE
from murano.common import wsgi from murano.common import wsgi
from murano.db.services import stats from murano.db.services import stats
@ -63,8 +62,8 @@ def stats_count(api, method):
except Exception: except Exception:
te = time.time() te = time.time()
tenant = args[1].context.tenant tenant = args[1].context.tenant
LOG.exception(_LE('API {api} method {method} raised an ' LOG.exception('API {api} method {method} raised an '
'exception').format(api=api, method=method)) 'exception'.format(api=api, method=method))
update_error_count(api, method, te - te, tenant) update_error_count(api, method, te - te, tenant)
raise raise
return wrap return wrap

View File

@ -16,7 +16,7 @@ from oslo_log import log as logging
from oslo_messaging.rpc import client from oslo_messaging.rpc import client
from webob import exc from webob import exc
from murano.common.i18n import _LE, _ from murano.common.i18n import _
from murano.common import policy from murano.common import policy
from murano.common import wsgi from murano.common import wsgi
from murano.services import static_actions from murano.services import static_actions
@ -56,8 +56,8 @@ class Controller(object):
method_name, class_name, pkg_name, class_version, args, method_name, class_name, pkg_name, class_version, args,
credentials) credentials)
except client.RemoteError as e: except client.RemoteError as e:
LOG.error(_LE('Exception during call of the method {method_name}: ' LOG.error('Exception during call of the method {method_name}: '
'{exc}').format(method_name=method_name, exc=str(e))) '{exc}'.format(method_name=method_name, exc=str(e)))
if e.exc_type in ( if e.exc_type in (
'NoClassFound', 'NoMethodFound', 'NoPackageFound', 'NoClassFound', 'NoMethodFound', 'NoPackageFound',
'NoPackageForClassFound', 'MethodNotExposed', 'NoPackageForClassFound', 'MethodNotExposed',
@ -67,8 +67,8 @@ class Controller(object):
raise exc.HTTPBadRequest(e.value) raise exc.HTTPBadRequest(e.value)
raise exc.HTTPServiceUnavailable(e.value) raise exc.HTTPServiceUnavailable(e.value)
except ValueError as e: except ValueError as e:
LOG.error(_LE('Exception during call of the method {method_name}: ' LOG.error('Exception during call of the method {method_name}: '
'{exc}').format(method_name=method_name, exc=str(e))) '{exc}'.format(method_name=method_name, exc=str(e)))
raise exc.HTTPBadRequest(e.message) raise exc.HTTPBadRequest(e.message)

View File

@ -18,7 +18,7 @@ import six
from webob import exc from webob import exc
from murano.api.v1 import request_statistics from murano.api.v1 import request_statistics
from murano.common.i18n import _, _LE from murano.common.i18n import _
from murano.common import policy from murano.common import policy
from murano.common import utils from murano.common import utils
from murano.common import wsgi from murano.common import wsgi
@ -237,7 +237,7 @@ class Controller(object):
old_env_template = self._validate_exists(env_template_id) old_env_template = self._validate_exists(env_template_id)
if not old_env_template.get('is_public'): if not old_env_template.get('is_public'):
msg = _LE('User has no access to these resources.') msg = _('User has no access to these resources.')
LOG.error(msg) LOG.error(msg)
raise exc.HTTPForbidden(explanation=msg) raise exc.HTTPForbidden(explanation=msg)
self._validate_body_name(body) self._validate_body_name(body)
@ -262,7 +262,7 @@ class Controller(object):
if env_template.is_public or request.context.is_admin: if env_template.is_public or request.context.is_admin:
return return
if env_template.tenant_id != request.context.tenant: if env_template.tenant_id != request.context.tenant:
msg = _LE('User has no access to these resources.') msg = _('User has no access to these resources.')
LOG.error(msg) LOG.error(msg)
raise exc.HTTPForbidden(explanation=msg) raise exc.HTTPForbidden(explanation=msg)

View File

@ -21,7 +21,6 @@ import six
import tenacity import tenacity
from webob import response from webob import response
from murano.common.i18n import _LI, _LW, _LE
from murano.common import auth_utils # noqa from murano.common import auth_utils # noqa
from murano.common import wsgi from murano.common import wsgi
from murano.db.services import cf_connections as db_cf from murano.db.services import cf_connections as db_cf
@ -111,9 +110,9 @@ class Controller(object):
except AttributeError: except AttributeError:
tenant = req.headers['X-Project-Id'] tenant = req.headers['X-Project-Id']
db_cf.set_tenant_for_org(org_guid, tenant) db_cf.set_tenant_for_org(org_guid, tenant)
LOG.info(_LI("Cloud Foundry {org_id} mapped to tenant " LOG.info("Cloud Foundry {org_id} mapped to tenant "
"{tenant_name}").format(org_id=org_guid, "{tenant_name}".format(org_id=org_guid,
tenant_name=tenant)) tenant_name=tenant))
token = req.headers['X-Auth-Token'] token = req.headers['X-Auth-Token']
m_cli = _get_muranoclient(token, req) m_cli = _get_muranoclient(token, req)
@ -133,19 +132,19 @@ class Controller(object):
try: try:
env = m_cli.environments.get(environment_id) env = m_cli.environments.get(environment_id)
except exceptions.HTTPNotFound: except exceptions.HTTPNotFound:
msg = (_LI("Can not find environment_id {environment_id}, " msg = ("Can not find environment_id {environment_id}, "
"will create a new one." "will create a new one."
).format(environment_id=environment_id)) .format(environment_id=environment_id))
LOG.info(msg) LOG.info(msg)
env = {} env = {}
if not env: if not env:
log_msg = (_LI("Cloud Foundry {space_id} remapped to " log_msg = ("Cloud Foundry {space_id} remapped to "
"{environment_id}")) "{environment_id}")
environment_id = _set_new_environment_for_space( environment_id = _set_new_environment_for_space(
space_guid, log_msg) space_guid, log_msg)
except AttributeError: except AttributeError:
log_msg = (_LI("Cloud Foundry {space_id} mapped to " log_msg = ("Cloud Foundry {space_id} mapped to "
"{environment_id}")) "{environment_id}")
environment_id = _set_new_environment_for_space( environment_id = _set_new_environment_for_space(
space_guid, log_msg) space_guid, log_msg)
@ -162,9 +161,9 @@ class Controller(object):
# necessary in our scenario # necessary in our scenario
if '?' in parameters.keys(): if '?' in parameters.keys():
parameters.pop('?', None) parameters.pop('?', None)
LOG.warning(_LW("Incorrect input parameters. Package related " LOG.warning("Incorrect input parameters. Package related "
"parameters shouldn't be passed through Cloud " "parameters shouldn't be passed through Cloud "
"Foundry")) "Foundry")
params = [parameters] params = [parameters]
while params: while params:
a = params.pop() a = params.pop()
@ -238,13 +237,13 @@ class Controller(object):
result = _get_creds(m_cli, task_id, environment_id) result = _get_creds(m_cli, task_id, environment_id)
if not result: if not result:
LOG.warning(_LW("This application doesn't have action " LOG.warning("This application doesn't have action "
"getCredentials")) "getCredentials")
return response.Response(status=500) return response.Response(status=500)
except KeyError: except KeyError:
# NOTE(starodubcevna): In CF service broker API spec return # NOTE(starodubcevna): In CF service broker API spec return
# code for failed bind is not present, so we will return 500. # code for failed bind is not present, so we will return 500.
LOG.warning(_LW("This application doesn't have actions at all")) LOG.warning("This application doesn't have actions at all")
return response.Response(status=500) return response.Response(status=500)
if 'credentials' in list(result): if 'credentials' in list(result):
@ -269,8 +268,8 @@ class Controller(object):
# NOTE(freerunner): Prevent code 500 if requested environment # NOTE(freerunner): Prevent code 500 if requested environment
# already doesn't exist. # already doesn't exist.
if not service: if not service:
LOG.warning(_LW('Requested service for instance {0} is not found') LOG.warning('Requested service for instance {0} is not '
.format(instance_id)) 'found'.format(instance_id))
body = {} body = {}
resp = response.Response(status=410, json_body=body) resp = response.Response(status=410, json_body=body)
return resp return resp
@ -307,9 +306,9 @@ def _get_muranoclient(token_id, req):
murano_url = CONF.murano.url or req.endpoints.get('murano') murano_url = CONF.murano.url or req.endpoints.get('murano')
if not murano_url: if not murano_url:
LOG.error(_LE('No murano url is specified and no ' LOG.error('No murano url is specified and no '
'"application-catalog" ' '"application-catalog" '
'service is registered in keystone.')) 'service is registered in keystone.')
return muranoclient.Client(1, murano_url, token=token_id, return muranoclient.Client(1, murano_url, token=token_id,
artifacts_client=artifacts_client) artifacts_client=artifacts_client)
@ -320,8 +319,8 @@ def _get_glareclient(token_id, req):
url = glare_settings.url or req.endpoints.get('glare') url = glare_settings.url or req.endpoints.get('glare')
if not url: if not url:
LOG.error(_LE('No glare url is specified and no "artifact" ' LOG.error('No glare url is specified and no "artifact" '
'service is registered in keystone.')) 'service is registered in keystone.')
return glare_client.Client( return glare_client.Client(
endpoint=url, token=token_id, endpoint=url, token=token_id,

View File

@ -26,7 +26,6 @@ from oslo_log import log as logging
from murano.common import consts from murano.common import consts
from murano.db.catalog import api as db_catalog_api from murano.db.catalog import api as db_catalog_api
from murano.common.i18n import _LI, _LE
from murano.packages import load_utils from murano.packages import load_utils
from murano import version from murano import version
@ -55,7 +54,7 @@ def _do_import_package(_dir, categories, update=False):
exst_pkg_id=existing_pkg.id) exst_pkg_id=existing_pkg.id)
db_catalog_api.package_delete(existing_pkg.id, AdminContext()) db_catalog_api.package_delete(existing_pkg.id, AdminContext())
else: else:
LOG.error(_LE("Package '{name}' exists ({pkg_id}). Use --update.") LOG.error("Package '{name}' exists ({pkg_id}). Use --update."
.format(name=pkg.full_name, pkg_id=existing_pkg.id)) .format(name=pkg.full_name, pkg_id=existing_pkg.id))
return return
@ -82,8 +81,7 @@ def _do_import_package(_dir, categories, update=False):
# it is a required field in the DB, that's why we pass an empty string # it is a required field in the DB, that's why we pass an empty string
result = db_catalog_api.package_upload(package, '') result = db_catalog_api.package_upload(package, '')
LOG.info(_LI("Finished import of package {res_id}").format( LOG.info("Finished import of package {res_id}".format(res_id=result.id))
res_id=result.id))
# TODO(ruhe): proper error handling # TODO(ruhe): proper error handling
@ -155,7 +153,7 @@ def main():
version=version.version_string, version=version.version_string,
default_config_files=default_config_files) default_config_files=default_config_files)
except RuntimeError as e: except RuntimeError as e:
LOG.error(_LE("failed to initialize murano-manage: {error}").format( LOG.error("failed to initialize murano-manage: {error}".format(
error=e)) error=e))
sys.exit("ERROR: %s" % e) sys.exit("ERROR: %s" % e)
@ -163,8 +161,8 @@ def main():
CONF.command.func() CONF.command.func()
except Exception as e: except Exception as e:
tb = traceback.format_exc() tb = traceback.format_exc()
err_msg = _LE("murano-manage command failed: {error}\n" err_msg = ("murano-manage command failed: {error}\n"
"{traceback}").format(error=e, traceback=tb) "{traceback}").format(error=e, traceback=tb)
LOG.error(err_msg) LOG.error(err_msg)
sys.exit(err_msg) sys.exit(err_msg)

View File

@ -27,10 +27,9 @@ from oslo_utils import importutils
from oslo_utils import timeutils from oslo_utils import timeutils
import six import six
from murano import version
from murano.common.i18n import _, _LE
from murano.common import config from murano.common import config
from murano.common import engine from murano.common import engine
from murano.common.i18n import _
from murano.dsl import dsl_exception from murano.dsl import dsl_exception
from murano.dsl import dsl_types from murano.dsl import dsl_types
from murano.dsl import exceptions from murano.dsl import exceptions
@ -39,6 +38,7 @@ from murano.dsl import helpers
from murano.engine import execution_session from murano.engine import execution_session
from murano.engine import mock_context_manager from murano.engine import mock_context_manager
from murano.engine import package_loader from murano.engine import package_loader
from murano import version
CONF = cfg.CONF CONF = cfg.CONF
@ -178,8 +178,8 @@ class MuranoTestRunner(object):
'project_name': getattr(args, 'os_project_name', None)} 'project_name': getattr(args, 'os_project_name', None)}
if None in ks_opts.values() and not CONF.default_config_files: if None in ks_opts.values() and not CONF.default_config_files:
msg = _LE('Please provide murano config file or credentials for ' msg = ('Please provide murano config file or credentials for '
'authorization: {0}').format( 'authorization: {0}').format(
', '.join(['--os-auth-url', '--os-username', '--os-password', ', '.join(['--os-auth-url', '--os-username', '--os-password',
'--os-project-name', '--os-tenant-id'])) '--os-project-name', '--os-tenant-id']))
LOG.error(msg) LOG.error(msg)
@ -367,7 +367,7 @@ def main():
CONF.set_default('use_stderr', False) CONF.set_default('use_stderr', False)
logging.setup(CONF, 'murano') logging.setup(CONF, 'murano')
except RuntimeError as e: except RuntimeError as e:
LOG.exception(_LE("Failed to initialize murano-test-runner: %s"), e) LOG.exception("Failed to initialize murano-test-runner: %s", e)
sys.exit("ERROR: %s" % e) sys.exit("ERROR: %s" % e)
try: try:
@ -378,7 +378,7 @@ def main():
tb = e.format() tb = e.format()
else: else:
tb = traceback.format_exc() tb = traceback.format_exc()
err_msg = _LE("Command failed: {0}\n{1}").format(e, tb) err_msg = "Command failed: {0}\n{1}".format(e, tb)
LOG.error(err_msg) LOG.error(err_msg)
sys.exit(err_msg) sys.exit(err_msg)

View File

@ -39,7 +39,6 @@ from murano.engine import execution_session
from murano.engine import package_loader from murano.engine import package_loader
from murano.engine.system import status_reporter from murano.engine.system import status_reporter
from murano.engine.system import yaql_functions from murano.engine.system import yaql_functions
from murano.common.i18n import _LI, _LE, _LW
from murano.policy import model_policy_enforcer as enforcer from murano.policy import model_policy_enforcer as enforcer
CONF = cfg.CONF CONF = cfg.CONF
@ -128,7 +127,7 @@ class TaskProcessingEndpoint(object):
@staticmethod @staticmethod
def execute(task): def execute(task):
s_task = token_sanitizer.TokenSanitizer().sanitize(task) s_task = token_sanitizer.TokenSanitizer().sanitize(task)
LOG.info(_LI('Starting processing task: {task_desc}').format( LOG.info('Starting processing task: {task_desc}'.format(
task_desc=jsonutils.dumps(s_task))) task_desc=jsonutils.dumps(s_task)))
result = None result = None
@ -139,7 +138,7 @@ class TaskProcessingEndpoint(object):
result = task_executor.execute() result = task_executor.execute()
return result return result
finally: finally:
LOG.info(_LI('Finished processing task: {task_desc}').format( LOG.info('Finished processing task: {task_desc}'.format(
task_desc=jsonutils.dumps(result))) task_desc=jsonutils.dumps(result)))
@ -147,8 +146,8 @@ class StaticActionEndpoint(object):
@classmethod @classmethod
def call_static_action(cls, context, task): def call_static_action(cls, context, task):
s_task = token_sanitizer.TokenSanitizer().sanitize(task) s_task = token_sanitizer.TokenSanitizer().sanitize(task)
LOG.info(_LI('Starting execution of static action: ' LOG.info('Starting execution of static action: '
'{task_desc}').format(task_desc=jsonutils.dumps(s_task))) '{task_desc}'.format(task_desc=jsonutils.dumps(s_task)))
result = None result = None
reporter = status_reporter.StatusReporter(task['id']) reporter = status_reporter.StatusReporter(task['id'])
@ -158,8 +157,8 @@ class StaticActionEndpoint(object):
result = task_executor.execute() result = task_executor.execute()
return result return result
finally: finally:
LOG.info(_LI('Finished execution of static action: ' LOG.info('Finished execution of static action: '
'{task_desc}').format(task_desc=jsonutils.dumps(result))) '{task_desc}'.format(task_desc=jsonutils.dumps(result)))
class TaskExecutor(object): class TaskExecutor(object):
@ -214,7 +213,7 @@ class TaskExecutor(object):
try: try:
self._delete_trust() self._delete_trust()
except Exception: except Exception:
LOG.warning(_LW('Cannot delete trust'), exc_info=True) LOG.warning('Cannot delete trust', exc_info=True)
return result return result
@ -277,8 +276,8 @@ class TaskExecutor(object):
else: else:
exception_traceback = traceback.format_exc() exception_traceback = traceback.format_exc()
LOG.exception( LOG.exception(
_LE("Exception %(exc)s occurred" ("Exception %(exc)s occurred"
" during invocation of %(method)s"), " during invocation of %(method)s"),
{'exc': exception, 'method': method_name}) {'exc': exception, 'method': method_name})
self._reporter.report_error(root, str(exception)) self._reporter.report_error(root, str(exception))

View File

@ -22,13 +22,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='murano')
# The primary translation function using the well-known name "_" # The primary translation function using the well-known name "_"
_ = _translators.primary _ = _translators.primary
# Translators for log levels.
#
# The abbreviated names are meant to reflect the usual use of a short
# name like '_'. The "L" is for "log" and the other letter comes from
# the level.
_LI = _translators.log_info
_LW = _translators.log_warning
_LE = _translators.log_error
_LC = _translators.log_critical

View File

@ -20,7 +20,6 @@ from oslo_log import log as logging
import six import six
from stevedore import dispatch from stevedore import dispatch
from murano.common.i18n import _LE, _LI, _LW
from murano.dsl import murano_package from murano.dsl import murano_package
@ -50,7 +49,7 @@ class PluginLoader(object):
dist_name = str(extension.entry_point.dist) dist_name = str(extension.entry_point.dist)
name = extension.entry_point.name name = extension.entry_point.name
if not NAME_RE.match(name): if not NAME_RE.match(name):
LOG.warning(_LW("Entry-point 'name' {name} is invalid").format( LOG.warning("Entry-point 'name' {name} is invalid".format(
name=name)) name=name))
return return
name_map.setdefault(name, []).append(dist_name) name_map.setdefault(name, []).append(dist_name)
@ -64,21 +63,21 @@ class PluginLoader(object):
try: try:
package.classes[name] = initialize_plugin(plugin) package.classes[name] = initialize_plugin(plugin)
except Exception: except Exception:
LOG.exception(_LE("Unable to initialize plugin for {name}").format( LOG.exception("Unable to initialize plugin for {name}".format(
name=name)) name=name))
return return
LOG.info(_LI("Loaded class {class_name} from {dist}").format( LOG.info("Loaded class {class_name} from {dist}".format(
class_name=name, dist=dist_name)) class_name=name, dist=dist_name))
def cleanup_duplicates(self, name_map): def cleanup_duplicates(self, name_map):
for class_name, package_names in six.iteritems(name_map): for class_name, package_names in six.iteritems(name_map):
if len(package_names) >= 2: if len(package_names) >= 2:
LOG.warning(_LW("Class is defined in multiple packages!")) LOG.warning("Class is defined in multiple packages!")
for package_name in package_names: for package_name in package_names:
LOG.warning(_LW("Disabling class {class_name} in {dist} " LOG.warning(
"due to conflict").format( "Disabling class {class_name} in {dist} due to "
class_name=class_name, "conflict".format(
dist=package_name)) class_name=class_name, dist=package_name))
self.packages[package_name].classes.pop(class_name) self.packages[package_name].classes.pop(class_name)
@staticmethod @staticmethod
@ -92,8 +91,8 @@ class PluginLoader(object):
@staticmethod @staticmethod
def _on_load_failure(manager, ep, exc): def _on_load_failure(manager, ep, exc):
LOG.warning(_LW("Error loading entry-point {ep} from package {dist}: " LOG.warning("Error loading entry-point {ep} from package {dist}: "
"{err}").format(ep=ep.name, dist=ep.dist, err=exc)) "{err}".format(ep=ep.name, dist=ep.dist, err=exc))
def register_in_loader(self, package_loader): def register_in_loader(self, package_loader):
for package in six.itervalues(self.packages): for package in six.itervalues(self.packages):
@ -129,11 +128,11 @@ class MuranoPackage(murano_package.MuranoPackage):
pkg_loader, package_definition.name, runtime_version='1.0') pkg_loader, package_definition.name, runtime_version='1.0')
for class_name, clazz in six.iteritems(package_definition.classes): for class_name, clazz in six.iteritems(package_definition.classes):
if hasattr(clazz, "_murano_class_name"): if hasattr(clazz, "_murano_class_name"):
LOG.warning(_LW("Class '%(class_name)s' has a MuranoPL " LOG.warning("Class '%(class_name)s' has a MuranoPL "
"name '%(name)s' defined which will be " "name '%(name)s' defined which will be "
"ignored") % "ignored" %
dict(class_name=class_name, dict(class_name=class_name,
name=getattr(clazz, "_murano_class_name"))) name=getattr(clazz, "_murano_class_name")))
LOG.debug("Registering '%s' from '%s' in class loader", LOG.debug("Registering '%s' from '%s' in class loader",
class_name, package_definition.name) class_name, package_definition.name)
self.register_class(clazz, class_name) self.register_class(clazz, class_name)

View File

@ -18,8 +18,6 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from stevedore import dispatch from stevedore import dispatch
from murano.common.i18n import _LE, _LW, _LI
CONF = cfg.CONF CONF = cfg.CONF
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -28,7 +26,7 @@ NAMESPACE = 'io.murano.plugins.packages'
class PluginLoader(object): class PluginLoader(object):
def __init__(self): def __init__(self):
LOG.info(_LI('Loading package type plugins')) LOG.info('Loading package type plugins')
extension_manager = dispatch.EnabledExtensionManager( extension_manager = dispatch.EnabledExtensionManager(
NAMESPACE, NAMESPACE,
self._is_plugin_enabled, self._is_plugin_enabled,
@ -52,14 +50,14 @@ class PluginLoader(object):
@staticmethod @staticmethod
def _on_load_failure(manager, ep, exc): def _on_load_failure(manager, ep, exc):
LOG.warning(_LW("Error loading entry-point {ep} from package {dist}: " LOG.warning("Error loading entry-point {ep} from package {dist}: "
"{err}").format(ep=ep.name, dist=ep.dist, err=exc)) "{err}".format(ep=ep.name, dist=ep.dist, err=exc))
@staticmethod @staticmethod
def _parse_format_string(format_string): def _parse_format_string(format_string):
parts = format_string.rsplit('/', 1) parts = format_string.rsplit('/', 1)
if len(parts) != 2: if len(parts) != 2:
LOG.error(_LE("Incorrect format name {name}").format( LOG.error("Incorrect format name {name}".format(
name=format_string)) name=format_string))
raise ValueError(format_string) raise ValueError(format_string)
return ( return (
@ -75,7 +73,7 @@ class PluginLoader(object):
else: else:
self._initialize_plugin(package_class) self._initialize_plugin(package_class)
self.formats.setdefault(name, {})[version] = package_class self.formats.setdefault(name, {})[version] = package_class
LOG.info(_LI('Plugin for "{0}" package type was loaded').format( LOG.info('Plugin for "{0}" package type was loaded'.format(
format_name)) format_name))
def get_package_handler(self, format_name): def get_package_handler(self, format_name):

View File

@ -28,7 +28,6 @@ from murano.db import models
from murano.db.services import environments from murano.db.services import environments
from murano.db.services import instances from murano.db.services import instances
from murano.db import session from murano.db import session
from murano.common.i18n import _LI, _LW
from murano.services import states from murano.services import states
CONF = cfg.CONF CONF = cfg.CONF
@ -50,8 +49,8 @@ class ResultEndpoint(object):
environment = unit.query(models.Environment).get(environment_id) environment = unit.query(models.Environment).get(environment_id)
if not environment: if not environment:
LOG.warning(_LW('Environment result could not be handled, ' LOG.warning('Environment result could not be handled, '
'specified environment not found in database')) 'specified environment not found in database')
return return
if model['Objects'] is None and model.get('ObjectsCopy', {}) is None: if model['Objects'] is None and model.get('ObjectsCopy', {}) is None:
@ -113,14 +112,14 @@ class ResultEndpoint(object):
if objects: if objects:
services = objects.get('services') services = objects.get('services')
if num_errors + num_warnings > 0: if num_errors + num_warnings > 0:
LOG.warning(_LW('EnvId: {env_id} TenantId: {tenant_id} Status: ' LOG.warning('EnvId: {env_id} TenantId: {tenant_id} Status: '
'Failed Apps: {services}') 'Failed Apps: {services}'
.format(env_id=environment.id, .format(env_id=environment.id,
tenant_id=environment.tenant_id, tenant_id=environment.tenant_id,
services=services)) services=services))
else: else:
LOG.info(_LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' LOG.info('EnvId: {env_id} TenantId: {tenant_id} Status: '
'Successful Apps: {services}') 'Successful Apps: {services}'
.format(env_id=environment.id, .format(env_id=environment.id,
tenant_id=environment.tenant_id, tenant_id=environment.tenant_id,
services=services)) services=services))

View File

@ -26,7 +26,6 @@ import psutil
from murano.api import v1 from murano.api import v1
from murano.api.v1 import request_statistics from murano.api.v1 import request_statistics
from murano.common.i18n import _LE
from murano.db.services import stats as db_stats from murano.db.services import stats as db_stats
CONF = cfg.CONF CONF = cfg.CONF
@ -94,5 +93,5 @@ class StatsCollectingService(service.Service):
stats.cpu_percent = psutil.cpu_percent() stats.cpu_percent = psutil.cpu_percent()
self._stats_db.update(self._hostname, stats) self._stats_db.update(self._hostname, stats)
except Exception as e: except Exception as e:
LOG.exception(_LE("Failed to get statistics object from a " LOG.exception("Failed to get statistics object from a "
"database. {error_code}").format(error_code=e)) "database. {error_code}".format(error_code=e))

View File

@ -41,7 +41,7 @@ import webob.exc
from murano.api.v1 import validation_schemas from murano.api.v1 import validation_schemas
from murano.common import config from murano.common import config
from murano.common import exceptions from murano.common import exceptions
from murano.common.i18n import _, _LE, _LW from murano.common.i18n import _
from murano.common import xmlutils from murano.common import xmlutils
eventlet.patcher.monkey_patch(all=False, socket=True) eventlet.patcher.monkey_patch(all=False, socket=True)
@ -378,7 +378,7 @@ class ResourceExceptionHandler(object):
# convert to webob exceptions. # convert to webob exceptions.
if isinstance(ex_value, TypeError): if isinstance(ex_value, TypeError):
exc_info = (ex_type, ex_value, ex_traceback) exc_info = (ex_type, ex_value, ex_traceback)
LOG.error(_LE("Exception handling resource: {0}").format(ex_value), LOG.error("Exception handling resource: {0}".format(ex_value),
exc_info=exc_info) exc_info=exc_info)
raise webob.exc.HTTPBadRequest() raise webob.exc.HTTPBadRequest()
@ -778,8 +778,8 @@ class RequestDeserializer(object):
try: try:
content_type = request.get_content_type() content_type = request.get_content_type()
except exceptions.UnsupportedContentType as e: except exceptions.UnsupportedContentType as e:
LOG.error(_LE("Unrecognized Content-Type provided in request: " LOG.error("Unrecognized Content-Type provided in request: "
"{error}").format(error=str(e))) "{error}".format(error=str(e)))
raise raise
if content_type is None: if content_type is None:
@ -947,7 +947,7 @@ class JSONPatchDeserializer(TextDeserializer):
try: try:
jsonschema.validate(property_to_update, schema) jsonschema.validate(property_to_update, schema)
except jsonschema.ValidationError as e: except jsonschema.ValidationError as e:
LOG.error(_LE("Schema validation error occurred: %s"), e) LOG.error("Schema validation error occurred: %s", e)
raise webob.exc.HTTPBadRequest(explanation=e.message) raise webob.exc.HTTPBadRequest(explanation=e.message)
def _decode_json_pointer(self, pointer): def _decode_json_pointer(self, pointer):
@ -1111,7 +1111,7 @@ class FormDataDeserializer(TextDeserializer):
data=datastring)) data=datastring))
value = jsonutils.loads(datastring) value = jsonutils.loads(datastring)
except ValueError: except ValueError:
LOG.warning(_LW("Unable to deserialize to json, using raw text")) LOG.warning("Unable to deserialize to json, using raw text")
return value return value
def default(self, request): def default(self, request):

View File

@ -24,9 +24,9 @@ from sqlalchemy.orm import attributes
# TODO(ruhe) use exception declared in openstack/common/db # TODO(ruhe) use exception declared in openstack/common/db
from webob import exc from webob import exc
from murano.common.i18n import _
from murano.db import models from murano.db import models
from murano.db import session as db_session from murano.db import session as db_session
from murano.common.i18n import _, _LW
SEARCH_MAPPING = {'fqn': 'fully_qualified_name', SEARCH_MAPPING = {'fqn': 'fully_qualified_name',
@ -189,9 +189,8 @@ def _do_add(package, change):
try: try:
getattr(package, path).append(item) getattr(package, path).append(item)
except AssertionError: except AssertionError:
LOG.warning(_LW('One of the specified {path} is already associated' LOG.warning('One of the specified {path} is already associated'
' with a package. Doing nothing.').format( ' with a package. Doing nothing.'.format(path=path))
path=path))
return package return package

View File

@ -24,7 +24,6 @@ from yaql.language import exceptions as yaql_exceptions
from yaql.language import specs from yaql.language import specs
from yaql.language import utils from yaql.language import utils
from murano.common.i18n import _LW, _LE
from murano.dsl import attribute_store from murano.dsl import attribute_store
from murano.dsl import constants from murano.dsl import constants
from murano.dsl import dsl from murano.dsl import dsl
@ -348,9 +347,9 @@ class MuranoDslExecutor(object):
method, subscriber, None, [obj], {}, method, subscriber, None, [obj], {},
invoke_action=False) invoke_action=False)
except Exception as e: except Exception as e:
LOG.warning(_LW( LOG.warning('Muted exception during destruction dependency '
'Muted exception during destruction dependency ' 'execution in {0}: {1}'.format(obj, e),
'execution in {0}: {1}').format(obj, e), exc_info=True) exc_info=True)
obj.load_dependencies(None) obj.load_dependencies(None)
def destroy_objects(self, *objects): def destroy_objects(self, *objects):
@ -372,9 +371,9 @@ class MuranoDslExecutor(object):
tb = e.format(prefix=' ') tb = e.format(prefix=' ')
else: else:
tb = traceback.format_exc() tb = traceback.format_exc()
LOG.warning(_LW( LOG.warning(
'Muted exception during execution of .destroy ' 'Muted exception during execution of .destroy '
'on {0}: {1}').format(obj, tb), exc_info=True) 'on {0}: {1}'.format(obj, tb), exc_info=True)
def create_root_context(self, runtime_version): def create_root_context(self, runtime_version):
context = self._root_context_cache.get(runtime_version) context = self._root_context_cache.get(runtime_version)
@ -478,8 +477,8 @@ class MuranoDslExecutor(object):
return model return model
except Exception as e: except Exception as e:
LOG.exception( LOG.exception(
_LE("Exception %s occurred" "Exception %s occurred"
" during MuranoDslExecutor finalization"), e) " during MuranoDslExecutor finalization", e)
return None return None
def __enter__(self): def __enter__(self):

View File

@ -32,8 +32,6 @@ from murano.dsl import virtual_exceptions
from murano.dsl import yaql_integration from murano.dsl import yaql_integration
from murano.common.i18n import _LW
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
macros.register() macros.register()
virtual_exceptions.register() virtual_exceptions.register()
@ -139,8 +137,8 @@ class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider):
if self._usage == dsl_types.MethodUsages.Action: if self._usage == dsl_types.MethodUsages.Action:
runtime_version = self.declaring_type.package.runtime_version runtime_version = self.declaring_type.package.runtime_version
if runtime_version > constants.RUNTIME_VERSION_1_3: if runtime_version > constants.RUNTIME_VERSION_1_3:
LOG.warning(_LW('"Usage: Action" is deprecated, ' LOG.warning('"Usage: Action" is deprecated, '
'use "Scope: Public" instead')) 'use "Scope: Public" instead')
if self._scope == dsl_types.MethodScopes.Session: if self._scope == dsl_types.MethodScopes.Session:
raise ValueError( raise ValueError(
'Both "Usage: Action" and "Scope: Session" are ' 'Both "Usage: Action" and "Scope: Session" are '

View File

@ -15,7 +15,6 @@
from oslo_log import log as logging from oslo_log import log as logging
from murano.common.i18n import _LE
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -43,8 +42,8 @@ class ExecutionSession(object):
try: try:
delegate() delegate()
except Exception: except Exception:
LOG.exception(_LE('Unhandled exception on invocation of ' LOG.exception('Unhandled exception on invocation of '
'pre-execution hook')) 'pre-execution hook')
self._set_up_list = [] self._set_up_list = []
def finish(self): def finish(self):
@ -52,6 +51,6 @@ class ExecutionSession(object):
try: try:
delegate() delegate()
except Exception: except Exception:
LOG.exception(_LE('Unhandled exception on invocation of ' LOG.exception('Unhandled exception on invocation of '
'post-execution hook')) 'post-execution hook')
self._tear_down_list = [] self._tear_down_list = []

View File

@ -33,7 +33,6 @@ from oslo_utils import fileutils
import six import six
from murano.common import auth_utils from murano.common import auth_utils
from murano.common.i18n import _LE, _LI, _LW
from murano.dsl import constants from murano.dsl import constants
from murano.dsl import exceptions from murano.dsl import exceptions
from murano.dsl import helpers from murano.dsl import helpers
@ -103,9 +102,8 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
if CONF.engine.packages_service in ['glance', 'glare']: if CONF.engine.packages_service in ['glance', 'glare']:
if CONF.engine.packages_service == 'glance': if CONF.engine.packages_service == 'glance':
versionutils.report_deprecated_feature( versionutils.report_deprecated_feature(
LOG, LOG, "'glance' packages_service option has been renamed "
_LW("'glance' packages_service option has been renamed " "to 'glare', please update your configuration")
"to 'glare', please update your configuration"))
artifacts_client = self._get_glare_client() artifacts_client = self._get_glare_client()
else: else:
artifacts_client = None artifacts_client = None
@ -241,8 +239,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
try: try:
return load_utils.load_from_dir(package_directory) return load_utils.load_from_dir(package_directory)
except pkg_exc.PackageLoadError: except pkg_exc.PackageLoadError:
LOG.exception( LOG.exception('Unable to load package from cache. Clean-up.')
_LE('Unable to load package from cache. Clean-up.'))
shutil.rmtree(package_directory, ignore_errors=True) shutil.rmtree(package_directory, ignore_errors=True)
# the package is not yet in cache, let's try to download it. # the package is not yet in cache, let's try to download it.
@ -260,8 +257,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
try: try:
return load_utils.load_from_dir(package_directory) return load_utils.load_from_dir(package_directory)
except pkg_exc.PackageLoadError: except pkg_exc.PackageLoadError:
LOG.error( LOG.error('Unable to load package from cache. Clean-up.')
_LE('Unable to load package from cache. Clean-up.'))
shutil.rmtree(package_directory, ignore_errors=True) shutil.rmtree(package_directory, ignore_errors=True)
# attempt the download itself # attempt the download itself
@ -286,9 +282,10 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
package_file.name, package_file.name,
target_dir=package_directory, target_dir=package_directory,
drop_dir=False) as app_package: drop_dir=False) as app_package:
LOG.info(_LI( LOG.info(
"Successfully downloaded and unpacked package {} {}") "Successfully downloaded and unpacked "
.format(package_def.fully_qualified_name, package_id)) "package {} {}".format(
package_def.fully_qualified_name, package_id))
self._downloaded.append(app_package) self._downloaded.append(app_package)
self.try_cleanup_cache( self.try_cleanup_cache(
@ -365,9 +362,8 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader):
try: try:
os.remove(lock_path) os.remove(lock_path)
except OSError: except OSError:
LOG.warning( LOG.warning("Couldn't delete lock file: "
_LW("Couldn't delete lock file: " "{}".format(lock_path))
"{}").format(lock_path))
except RuntimeError: except RuntimeError:
# couldn't upgrade read lock to write-lock. go on. # couldn't upgrade read lock to write-lock. go on.
continue continue
@ -470,10 +466,10 @@ class DirectoryPackageLoader(package_loader.MuranoPackageLoader):
system_objects.register(dsl_package) system_objects.register(dsl_package)
self.register_package(dsl_package) self.register_package(dsl_package)
except pkg_exc.PackageLoadError: except pkg_exc.PackageLoadError:
LOG.info(_LI('Unable to load package from path: {0}').format( LOG.info('Unable to load package from path: {0}'.format(
folder)) folder))
continue continue
LOG.info(_LI('Loaded package from path {0}').format(folder)) LOG.info('Loaded package from path {0}'.format(folder))
def import_fixation_table(self, fixations): def import_fixation_table(self, fixations):
self._fixations = deserialize_package_fixations(fixations) self._fixations = deserialize_package_fixations(fixations)

View File

@ -18,7 +18,6 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from murano.common import exceptions from murano.common import exceptions
from murano.common.i18n import _LE
from murano.dsl import dsl from murano.dsl import dsl
from murano.engine.system import common from murano.engine.system import common
@ -40,8 +39,8 @@ class AgentListener(object):
def _check_enabled(self): def _check_enabled(self):
if CONF.engine.disable_murano_agent: if CONF.engine.disable_murano_agent:
LOG.error(_LE('Use of murano-agent is disallowed ' LOG.error('Use of murano-agent is disallowed '
'by the server configuration')) 'by the server configuration')
raise exceptions.PolicyViolationException( raise exceptions.PolicyViolationException(
'Use of murano-agent is disallowed ' 'Use of murano-agent is disallowed '

View File

@ -24,7 +24,6 @@ from oslo_log import log as logging
import six import six
from murano.common import auth_utils from murano.common import auth_utils
from murano.common.i18n import _LW
from murano.dsl import dsl from murano.dsl import dsl
from murano.dsl import helpers from murano.dsl import helpers
from murano.dsl import session_local_storage from murano.dsl import session_local_storage
@ -252,7 +251,7 @@ class HeatStack(object):
else: else:
self.delete() self.delete()
except heat_exc.HTTPConflict as e: except heat_exc.HTTPConflict as e:
LOG.warning(_LW('Conflicting operation: {msg}').format(msg=e)) LOG.warning('Conflicting operation: {msg}'.format(msg=e))
eventlet.sleep(3) eventlet.sleep(3)
else: else:
break break
@ -300,11 +299,11 @@ class HeatStack(object):
lambda status: status in ('DELETE_COMPLETE', 'NOT_FOUND'), lambda status: status in ('DELETE_COMPLETE', 'NOT_FOUND'),
wait_progress=True) wait_progress=True)
except heat_exc.NotFound: except heat_exc.NotFound:
LOG.warning(_LW('Stack {stack_name} already deleted?') LOG.warning('Stack {stack_name} already deleted?'
.format(stack_name=self._name)) .format(stack_name=self._name))
break break
except heat_exc.HTTPConflict as e: except heat_exc.HTTPConflict as e:
LOG.warning(_LW('Conflicting operation: {msg}').format(msg=e)) LOG.warning('Conflicting operation: {msg}'.format(msg=e))
eventlet.sleep(3) eventlet.sleep(3)
else: else:
break break

View File

@ -24,7 +24,6 @@ import tenacity
from murano.common import auth_utils from murano.common import auth_utils
from murano.common import exceptions as exc from murano.common import exceptions as exc
from murano.common.i18n import _LI
from murano.dsl import dsl from murano.dsl import dsl
from murano.dsl import helpers from murano.dsl import helpers
from murano.dsl import session_local_storage from murano.dsl import session_local_storage
@ -98,7 +97,7 @@ class NetworkExplorer(object):
} }
router = self._client.create_router( router = self._client.create_router(
body=body_data).get('router') body=body_data).get('router')
LOG.info(_LI('Created router: {id}').format(id=router['id'])) LOG.info('Created router: {id}'.format(id=router['id']))
return router['id'] return router['id']
else: else:
raise KeyError('Router %s was not found' % router_name) raise KeyError('Router %s was not found' % router_name)

View File

@ -25,7 +25,6 @@ from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from murano.common import auth_utils from murano.common import auth_utils
from murano.common.i18n import _LW
from murano.dsl import dsl from murano.dsl import dsl
from murano.dsl import session_local_storage from murano.dsl import session_local_storage
@ -53,7 +52,7 @@ class MistralClient(object):
@session_local_storage.execution_session_memoize @session_local_storage.execution_session_memoize
def _create_client(region): def _create_client(region):
if not mistralcli: if not mistralcli:
LOG.warning(_LW("Mistral client is not available")) LOG.warning("Mistral client is not available")
raise mistral_import_error raise mistral_import_error
mistral_settings = CONF.mistral mistral_settings = CONF.mistral

View File

@ -23,7 +23,7 @@ except ImportError as congress_client_import_error:
from oslo_log import log as logging from oslo_log import log as logging
from murano.common import auth_utils from murano.common import auth_utils
from murano.common.i18n import _, _LI from murano.common.i18n import _
from murano.policy import congress_rules from murano.policy import congress_rules
from murano.policy.modify.actions import action_manager as am from murano.policy.modify.actions import action_manager as am
@ -127,7 +127,7 @@ class ModelPolicyEnforcer(object):
LOG.error(msg) LOG.error(msg)
raise ValidationError(msg) raise ValidationError(msg)
else: else:
LOG.info(_LI('Model valid')) LOG.info('Model valid')
def _execute_simulation(self, package_loader, env_id, model, query): def _execute_simulation(self, package_loader, env_id, model, query):
rules = congress_rules.CongressRulesManager().convert( rules = congress_rules.CongressRulesManager().convert(

View File

@ -31,7 +31,6 @@ from muranoclient.glance import client as glare_client
from oslo_log import log as logging from oslo_log import log as logging
import yaml import yaml
from murano.common.i18n import _LW, _LE
from murano.services import states from murano.services import states
import murano.tests.functional.common.zip_utils_mixin as zip_utils import murano.tests.functional.common.zip_utils_mixin as zip_utils
import murano.tests.functional.engine.config as cfg import murano.tests.functional.engine.config as cfg
@ -203,7 +202,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
deployment = cls.get_last_deployment(environment) deployment = cls.get_last_deployment(environment)
try: try:
details = deployment.result['result']['details'] details = deployment.result['result']['details']
LOG.warning(_LW('Details:\n {details}').format(details=details)) LOG.warning('Details:\n {details}'.format(details=details))
except Exception as e: except Exception as e:
LOG.error(e) LOG.error(e)
report = cls.get_deployment_report(environment, deployment) report = cls.get_deployment_report(environment, deployment)
@ -337,8 +336,8 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
service_type='application-catalog', endpoint_type='publicURL') service_type='application-catalog', endpoint_type='publicURL')
except ks_exceptions.EndpointNotFound: except ks_exceptions.EndpointNotFound:
url = CONF.murano.murano_url url = CONF.murano.murano_url
LOG.warning(_LW("Murano endpoint not found in Keystone. " LOG.warning("Murano endpoint not found in Keystone. "
"Using CONF.")) "Using CONF.")
return url if 'v1' not in url else "/".join( return url if 'v1' not in url else "/".join(
url.split('/')[:url.split('/').index('v1')]) url.split('/')[:url.split('/').index('v1')])
@ -362,7 +361,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin):
raise RuntimeError('Resource at {0}:{1} not exist'. raise RuntimeError('Resource at {0}:{1} not exist'.
format(ip, port)) format(ip, port))
except socket.error as e: except socket.error as e:
LOG.error(_LE('Socket Error: {error}').format(error=e)) LOG.error('Socket Error: {error}'.format(error=e))
@classmethod @classmethod
def get_ip_by_appname(cls, environment, appname): def get_ip_by_appname(cls, environment, appname):

View File

@ -32,8 +32,7 @@ class MiddlewareVersionNegotiationTest(base.MuranoTestCase):
self.assertIsInstance(result, versions.Controller) self.assertIsInstance(result, versions.Controller)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
version_negotiation._LW( "Unknown version. Returning version choices.")
"Unknown version. Returning version choices."))
@mock.patch.object(version_negotiation, 'LOG') @mock.patch.object(version_negotiation, 'LOG')
def test_process_request(self, mock_log): def test_process_request(self, mock_log):
@ -83,8 +82,7 @@ class MiddlewareVersionNegotiationTest(base.MuranoTestCase):
self.assertIsInstance(result, versions.Controller) self.assertIsInstance(result, versions.Controller)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
version_negotiation._LW( "Unknown version. Returning version choices.")
"Unknown version. Returning version choices."))
def test_factory(self): def test_factory(self):
app = version_negotiation.VersionNegotiationFilter.factory(None) app = version_negotiation.VersionNegotiationFilter.factory(None)

View File

@ -19,7 +19,6 @@ from oslo_serialization import base64
from webob import response from webob import response
from murano.cfapi import cfapi as api from murano.cfapi import cfapi as api
from murano.common.i18n import _LE, _LI, _LW
from murano.common import wsgi from murano.common import wsgi
from murano.db import models from murano.db import models
from murano.tests.unit import base from murano.tests.unit import base
@ -225,10 +224,10 @@ class TestController(base.MuranoTestCase):
mock_muranoclient.environments.get.assert_called_once_with( mock_muranoclient.environments.get.assert_called_once_with(
mock.sentinel.environment_id) mock.sentinel.environment_id)
mock_log.info.assert_has_calls([ mock_log.info.assert_has_calls([
mock.call(_LI("Can not find environment_id sentinel.environment_id" mock.call("Can not find environment_id sentinel.environment_id"
", will create a new one.")), ", will create a new one."),
mock.call(_LI("Cloud Foundry foo_space_guid remapped to " mock.call("Cloud Foundry foo_space_guid remapped to "
"sentinel.alt_environment_id")) "sentinel.alt_environment_id")
]) ])
@mock.patch.object(api, 'uuid', autospec=True) @mock.patch.object(api, 'uuid', autospec=True)
@ -308,7 +307,7 @@ class TestController(base.MuranoTestCase):
mock_get_service.assert_called_once_with(self.controller, m_env, mock_get_service.assert_called_once_with(self.controller, m_env,
mock.sentinel.service_id) mock.sentinel.service_id)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW("This application doesn't have actions at all")) "This application doesn't have actions at all")
@mock.patch.object(api, 'LOG', autospec=True) @mock.patch.object(api, 'LOG', autospec=True)
@mock.patch.object(api.Controller, '_get_service', autospec=True) @mock.patch.object(api.Controller, '_get_service', autospec=True)
@ -338,7 +337,7 @@ class TestController(base.MuranoTestCase):
mock_get_service.assert_called_once_with(self.controller, m_env, mock_get_service.assert_called_once_with(self.controller, m_env,
mock.sentinel.service_id) mock.sentinel.service_id)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW("This application doesn't have action getCredentials")) "This application doesn't have action getCredentials")
def test_unbind(self): def test_unbind(self):
self.assertEqual({}, self.controller.unbind(None, None, None)) self.assertEqual({}, self.controller.unbind(None, None, None))
@ -354,8 +353,8 @@ class TestController(base.MuranoTestCase):
self.assertEqual(410, resp.status_code) self.assertEqual(410, resp.status_code)
self.assertEqual({}, resp.json_body) self.assertEqual({}, resp.json_body)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW('Requested service for instance sentinel.instance_id is not ' 'Requested service for instance sentinel.instance_id is not '
'found')) 'found')
@mock.patch.object(api, '_get_muranoclient', autospec=True) @mock.patch.object(api, '_get_muranoclient', autospec=True)
@mock.patch.object(api, 'db_cf', autospec=True) @mock.patch.object(api, 'db_cf', autospec=True)
@ -520,11 +519,11 @@ class TestController(base.MuranoTestCase):
1, None, token=mock.sentinel.token_id, 1, None, token=mock.sentinel.token_id,
artifacts_client=m_artifacts_client) artifacts_client=m_artifacts_client)
mock_log.error.assert_has_calls([ mock_log.error.assert_has_calls([
mock.call(_LE('No glare url is specified and no "artifact" ' mock.call('No glare url is specified and no "artifact" '
'service is registered in keystone.')), 'service is registered in keystone.'),
mock.call(_LE('No murano url is specified and no ' mock.call('No murano url is specified and no '
'"application-catalog" service is registered in ' '"application-catalog" service is registered in '
'keystone.')) 'keystone.')
]) ])
def _override_conf(self, without_urls=False): def _override_conf(self, without_urls=False):

View File

@ -22,7 +22,6 @@ except ImportError:
from io import StringIO from io import StringIO
from murano.cmd import manage from murano.cmd import manage
from murano.common.i18n import _LE
from murano.db.catalog import api as db_catalog_api from murano.db.catalog import api as db_catalog_api
from murano.db import models from murano.db import models
from murano.db import session as db_session from murano.db import session as db_session
@ -146,8 +145,8 @@ class TestManage(test_base.MuranoWithDBTestCase):
manage.do_import_package() manage.do_import_package()
mock_log.error.assert_called_once_with( mock_log.error.assert_called_once_with(
_LE("Package '{name}' exists ({pkg_id}). Use --update.") "Package '{name}' exists ({pkg_id}). Use --update."
.format(name='test_full_name', pkg_id=self.test_package.id)) .format(name='test_full_name', pkg_id=self.test_package.id))
@mock.patch('sys.stdout', new_callable=StringIO) @mock.patch('sys.stdout', new_callable=StringIO)
def test_do_list_categories(self, mock_stdout): def test_do_list_categories(self, mock_stdout):
@ -225,7 +224,7 @@ class TestManage(test_base.MuranoWithDBTestCase):
def test_main_except_general_exception(self, mock_conf): def test_main_except_general_exception(self, mock_conf):
mock_conf.command.func.side_effect = Exception mock_conf.command.func.side_effect = Exception
expected_err_msg = _LE("murano-manage command failed:") expected_err_msg = "murano-manage command failed:"
with self.assertRaisesRegexp(SystemExit, expected_err_msg): with self.assertRaisesRegexp(SystemExit, expected_err_msg):
manage.main() manage.main()

View File

@ -16,7 +16,6 @@
from datetime import datetime from datetime import datetime
import mock import mock
from murano.common.i18n import _LI, _LW
from murano.common import server from murano.common import server
from murano.services import states from murano.services import states
from murano.tests.unit import base from murano.tests.unit import base
@ -75,8 +74,8 @@ class ServerTest(base.MuranoTestCase):
states.SessionState.DEPLOYED, states.SessionState.DEPLOYED,
mock_db_session.get_session().query().filter_by().first().state) mock_db_session.get_session().query().filter_by().first().state)
mock_log.info.assert_called_once_with( mock_log.info.assert_called_once_with(
_LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' 'EnvId: {env_id} TenantId: {tenant_id} Status: '
'Successful Apps: {services}') 'Successful Apps: {services}'
.format(env_id=mock_env.id, .format(env_id=mock_env.id,
tenant_id=mock_env.tenant_id, tenant_id=mock_env.tenant_id,
services=test_result['model']['Objects']['services'])) services=test_result['model']['Objects']['services']))
@ -123,8 +122,8 @@ class ServerTest(base.MuranoTestCase):
states.SessionState.DEPLOY_FAILURE, states.SessionState.DEPLOY_FAILURE,
mock_db_session.get_session().query().filter_by().first().state) mock_db_session.get_session().query().filter_by().first().state)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW('EnvId: {env_id} TenantId: {tenant_id} Status: ' 'EnvId: {env_id} TenantId: {tenant_id} Status: '
'Failed Apps: {services}') 'Failed Apps: {services}'
.format(env_id=mock_env.id, .format(env_id=mock_env.id,
tenant_id=mock_env.tenant_id, tenant_id=mock_env.tenant_id,
services=test_result['model']['Objects']['services'])) services=test_result['model']['Objects']['services']))
@ -170,8 +169,8 @@ class ServerTest(base.MuranoTestCase):
states.SessionState.DELETE_FAILURE, states.SessionState.DELETE_FAILURE,
mock_db_session.get_session().query().filter_by().first().state) mock_db_session.get_session().query().filter_by().first().state)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' 'EnvId: {env_id} TenantId: {tenant_id} Status: '
'Failed Apps: {services}') 'Failed Apps: {services}'
.format(env_id=mock_env.id, .format(env_id=mock_env.id,
tenant_id=mock_env.tenant_id, tenant_id=mock_env.tenant_id,
services=[])) services=[]))
@ -188,9 +187,8 @@ class ServerTest(base.MuranoTestCase):
'test_env_id') 'test_env_id')
self.assertIsNone(result) self.assertIsNone(result)
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW('Environment result could not be handled, ' 'Environment result could not be handled, '
'specified environment not found in database') 'specified environment not found in database')
)
@mock.patch('murano.common.server.environments') @mock.patch('murano.common.server.environments')
@mock.patch('murano.common.server.session') @mock.patch('murano.common.server.session')

View File

@ -16,7 +16,6 @@
import mock import mock
import time import time
from murano.common.i18n import _LE
from murano.common import statservice from murano.common import statservice
from murano.tests.unit import base from murano.tests.unit import base
@ -92,5 +91,5 @@ class StatsCollectingServiceTest(base.MuranoTestCase):
self.service.update_stats() self.service.update_stats()
mock_log.exception.assert_called_once_with( mock_log.exception.assert_called_once_with(
_LE("Failed to get statistics object from a " "Failed to get statistics object from a "
"database. {error_code}").format(error_code='test_error_code')) "database. {error_code}".format(error_code='test_error_code'))

View File

@ -23,7 +23,7 @@ from oslo_config import cfg
from xml.dom import minidom from xml.dom import minidom
from murano.common import exceptions from murano.common import exceptions
from murano.common.i18n import _, _LW from murano.common.i18n import _
from murano.common import wsgi from murano.common import wsgi
from murano.tests.unit import base from murano.tests.unit import base
@ -604,4 +604,4 @@ class TestFormDataDeserializer(base.MuranoTestCase):
mock_log.debug.assert_called_once_with( mock_log.debug.assert_called_once_with(
"Trying to deserialize 'value error' to json") "Trying to deserialize 'value error' to json")
mock_log.warning.assert_called_once_with( mock_log.warning.assert_called_once_with(
_LW('Unable to deserialize to json, using raw text')) 'Unable to deserialize to json, using raw text')

View File

@ -32,7 +32,6 @@ from alembic import script as alembic_script
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from murano.common.i18n import _LE
import murano.db.migration import murano.db.migration
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@ -191,6 +190,6 @@ class BaseWalkMigrationTestCase(object):
if check: if check:
check(engine, data) check(engine, data)
except Exception: except Exception:
LOG.error(_LE("Failed to migrate to version {ver} on engine {eng}") LOG.error("Failed to migrate to version {ver} on engine {eng}"
.format(ver=version, eng=engine)) .format(ver=version, eng=engine))
raise raise

View File

@ -24,7 +24,6 @@ from oslo_config import cfg
import semantic_version import semantic_version
import testtools import testtools
from murano.common.i18n import _LE, _LW
from murano.dsl import exceptions as dsl_exceptions from murano.dsl import exceptions as dsl_exceptions
from murano.dsl import murano_package as dsl_package from murano.dsl import murano_package as dsl_package
from murano.engine import package_loader from murano.engine import package_loader
@ -79,8 +78,8 @@ class TestPackageCache(base.MuranoTestCase):
mock_versionutils.report_deprecated_feature.assert_called_once_with( mock_versionutils.report_deprecated_feature.assert_called_once_with(
package_loader.LOG, package_loader.LOG,
_LW("'glance' packages_service option has been renamed " "'glance' packages_service option has been renamed "
"to 'glare', please update your configuration")) "to 'glare', please update your configuration")
self.assertIsNotNone(client) self.assertIsNotNone(client)
self.assertIsNotNone(self.loader._glare_client) self.assertIsNotNone(self.loader._glare_client)
@ -425,7 +424,7 @@ class TestPackageCache(base.MuranoTestCase):
self.loader._get_package_by_definition(package) self.loader._get_package_by_definition(package)
mock_log.exception.assert_called_once_with( mock_log.exception.assert_called_once_with(
_LE('Unable to load package from cache. Clean-up.')) 'Unable to load package from cache. Clean-up.')
mock_log.exception.reset_mock() mock_log.exception.reset_mock()
# Test that the second instance of the exception is caught. # Test that the second instance of the exception is caught.
@ -434,7 +433,7 @@ class TestPackageCache(base.MuranoTestCase):
self.loader._get_package_by_definition(package) self.loader._get_package_by_definition(package)
mock_log.exception.assert_called_once_with( mock_log.exception.assert_called_once_with(
_LE('Unable to load package from cache. Clean-up.')) 'Unable to load package from cache. Clean-up.')
os.remove(temp_directory) os.remove(temp_directory)
@testtools.skipIf(os.name == 'nt', "Doesn't work on Windows") @testtools.skipIf(os.name == 'nt', "Doesn't work on Windows")

View File

@ -239,7 +239,7 @@ class TestHeatStack(base.MuranoTestCase):
hs.push() hs.push()
mock_log.warning.assert_called_with( mock_log.warning.assert_called_with(
heat_stack._LW('Conflicting operation: ERROR: test_error_msg')) 'Conflicting operation: ERROR: test_error_msg')
@mock.patch(CLS_NAME + '.current') @mock.patch(CLS_NAME + '.current')
def test_update_wrong_template_version(self, current): def test_update_wrong_template_version(self, current):
@ -438,7 +438,7 @@ class TestHeatStack(base.MuranoTestCase):
self.assertTrue(hs._applied) self.assertTrue(hs._applied)
self.assertEqual({}, hs._template) self.assertEqual({}, hs._template)
mock_log.warning.assert_called_with( mock_log.warning.assert_called_with(
heat_stack._LW('Stack test-stack already deleted?')) 'Stack test-stack already deleted?')
@mock.patch(CLS_NAME + '._wait_state') @mock.patch(CLS_NAME + '._wait_state')
@mock.patch(CLS_NAME + '._get_status') @mock.patch(CLS_NAME + '._get_status')
@ -463,8 +463,8 @@ class TestHeatStack(base.MuranoTestCase):
self.assertTrue(hs._applied) self.assertTrue(hs._applied)
self.assertEqual({}, hs._template) self.assertEqual({}, hs._template)
mock_log.warning.assert_called_with( mock_log.warning.assert_called_with('Conflicting operation: '
heat_stack._LW('Conflicting operation: ERROR: test_error_msg')) 'ERROR: test_error_msg')
@mock.patch(CLS_NAME + '._wait_state') @mock.patch(CLS_NAME + '._wait_state')
@mock.patch(CLS_NAME + '._get_status') @mock.patch(CLS_NAME + '._get_status')