diff --git a/murano/api/middleware/ext_context.py b/murano/api/middleware/ext_context.py index 5b69e55d0..0cd7ff2d0 100644 --- a/murano/api/middleware/ext_context.py +++ b/murano/api/middleware/ext_context.py @@ -21,7 +21,7 @@ from oslo_config import cfg from oslo_log import log from webob import exc -from murano.common.i18n import _, _LW +from murano.common.i18n import _ from murano.common import wsgi CONF = cfg.CONF @@ -44,7 +44,7 @@ class ExternalContextMiddleware(wsgi.Middleware): elif auth_url.endswith('v3'): pass 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, 'username': user, diff --git a/murano/api/middleware/version_negotiation.py b/murano/api/middleware/version_negotiation.py index b8e7dbac7..4e04c85d1 100644 --- a/murano/api/middleware/version_negotiation.py +++ b/murano/api/middleware/version_negotiation.py @@ -21,7 +21,6 @@ return from oslo_log import log as logging from murano.api import versions -from murano.common.i18n import _LW from murano.common import wsgi LOG = logging.getLogger(__name__) @@ -51,7 +50,7 @@ class VersionNegotiationFilter(wsgi.Middleware): try: version = self._match_version_string(req_version) except ValueError: - LOG.warning(_LW("Unknown version. Returning version choices.")) + LOG.warning("Unknown version. Returning version choices.") return self.versions_app req.environ['api.version'] = version diff --git a/murano/api/v1/actions.py b/murano/api/v1/actions.py index de1d8e0e5..96a7ab048 100644 --- a/murano/api/v1/actions.py +++ b/murano/api/v1/actions.py @@ -20,7 +20,6 @@ from murano.common import wsgi from murano.db.services import environments as envs from murano.db.services import sessions from murano.db import session as db_session -from murano.common.i18n import _LE, _, _LW from murano.services import actions from murano.services import states from murano.utils import verify_env @@ -43,17 +42,17 @@ class Controller(object): env_status = envs.EnvironmentServices.get_status(environment_id) if env_status in (states.EnvironmentStatus.DEPLOYING, states.EnvironmentStatus.DELETING): - LOG.warning(_LW('Could not open session for environment ' - ', environment has deploying ' - 'status.').format(id=environment_id)) + LOG.warning('Could not open session for environment ' + ', environment has deploying ' + 'status.'.format(id=environment_id)) raise exc.HTTPForbidden() user_id = request.context.user session = sessions.SessionServices.create(environment_id, user_id) if not sessions.SessionServices.validate(session): - LOG.error(_LE('Session ' - 'is invalid').format(id=session.id)) + LOG.error('Session ' + 'is invalid'.format(id=session.id)) raise exc.HTTPForbidden() task_id = actions.ActionServices.execute( @@ -72,9 +71,9 @@ class Controller(object): if result is not None: return result - msg = _('Result for task with environment_id: {env_id} and task_id: ' - '{task_id} was not found.').format(env_id=environment_id, - task_id=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=task_id)) LOG.error(msg) raise exc.HTTPNotFound(msg) diff --git a/murano/api/v1/catalog.py b/murano/api/v1/catalog.py index 2e2f9d389..db05bbaed 100644 --- a/murano/api/v1/catalog.py +++ b/murano/api/v1/catalog.py @@ -30,11 +30,11 @@ from webob import exc import murano.api.v1 from murano.api.v1 import validation_schemas from murano.common import exceptions +from murano.common.i18n import _ from murano.common import policy import murano.common.utils as murano_utils from murano.common import wsgi 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 load_utils from muranoclient.glance import client as glare_client @@ -64,8 +64,8 @@ def _get_filters(query_params): for param_pair in query_params: k, v = param_pair if k not in SUPPORTED_PARAMS: - LOG.warning(_LW("Search by parameter '{name}' " - "is not supported. Skipping it.").format(name=k)) + LOG.warning("Search by parameter '{name}' " + "is not supported. Skipping it.".format(name=k)) continue if k in LIST_PARAMS: @@ -74,10 +74,10 @@ def _get_filters(query_params): try: filters[k] = murano_utils.split_for_quotes(in_value) except ValueError as err: - LOG.warning(_LW("Search by parameter '{name}' " - "caused an {message} error." - "Skipping it.").format(name=k, - message=err)) + LOG.warning("Search by parameter '{name}' " + "caused an {message} error." + "Skipping it.".format(name=k, + message=err)) else: filters.setdefault(k, []).append(v) else: @@ -86,8 +86,8 @@ def _get_filters(query_params): for i in order_by[:]: if ORDER_VALUES and i not in ORDER_VALUES: filters['order_by'].remove(i) - LOG.warning(_LW("Value of 'order_by' parameter is not valid. " - "Allowed values are: {values}. Skipping it.") + LOG.warning("Value of 'order_by' parameter is not valid. " + "Allowed values are: {values}. Skipping it." .format(values=", ".join(ORDER_VALUES))) return filters diff --git a/murano/api/v1/deployments.py b/murano/api/v1/deployments.py index 618f8993d..d9d521857 100644 --- a/murano/api/v1/deployments.py +++ b/murano/api/v1/deployments.py @@ -19,7 +19,6 @@ from webob import exc from murano.api.v1 import request_statistics from murano.common.helpers import token_sanitizer -from murano.common.i18n import _LE from murano.common import policy from murano.common import utils from murano.common import wsgi @@ -111,13 +110,13 @@ def _patch_description(description): def verify_and_get_deployment(db_session, environment_id, deployment_id): deployment = db_session.query(models.Task).get(deployment_id) if not deployment: - LOG.error(_LE('Deployment with id {id} not found') + LOG.error('Deployment with id {id} not found' .format(id=deployment_id)) raise exc.HTTPNotFound if deployment.environment_id != environment_id: - LOG.error(_LE('Deployment with id {d_id} not found in environment ' - '{env_id}').format(d_id=deployment_id, - env_id=environment_id)) + LOG.error('Deployment with id {d_id} not found in environment ' + '{env_id}'.format(d_id=deployment_id, + env_id=environment_id)) raise exc.HTTPBadRequest deployment.description = _patch_description(deployment.description) diff --git a/murano/api/v1/request_statistics.py b/murano/api/v1/request_statistics.py index 2af981ef8..359d02de4 100644 --- a/murano/api/v1/request_statistics.py +++ b/murano/api/v1/request_statistics.py @@ -17,7 +17,6 @@ import time from oslo_log import log as logging from murano.api import v1 -from murano.common.i18n import _LE from murano.common import wsgi from murano.db.services import stats @@ -63,8 +62,8 @@ def stats_count(api, method): except Exception: te = time.time() tenant = args[1].context.tenant - LOG.exception(_LE('API {api} method {method} raised an ' - 'exception').format(api=api, method=method)) + LOG.exception('API {api} method {method} raised an ' + 'exception'.format(api=api, method=method)) update_error_count(api, method, te - te, tenant) raise return wrap diff --git a/murano/api/v1/static_actions.py b/murano/api/v1/static_actions.py index 2d8cc3e42..d8fe8464d 100644 --- a/murano/api/v1/static_actions.py +++ b/murano/api/v1/static_actions.py @@ -16,7 +16,7 @@ from oslo_log import log as logging from oslo_messaging.rpc import client from webob import exc -from murano.common.i18n import _LE, _ +from murano.common.i18n import _ from murano.common import policy from murano.common import wsgi from murano.services import static_actions @@ -56,8 +56,8 @@ class Controller(object): method_name, class_name, pkg_name, class_version, args, credentials) except client.RemoteError as e: - LOG.error(_LE('Exception during call of the method {method_name}: ' - '{exc}').format(method_name=method_name, exc=str(e))) + LOG.error('Exception during call of the method {method_name}: ' + '{exc}'.format(method_name=method_name, exc=str(e))) if e.exc_type in ( 'NoClassFound', 'NoMethodFound', 'NoPackageFound', 'NoPackageForClassFound', 'MethodNotExposed', @@ -67,8 +67,8 @@ class Controller(object): raise exc.HTTPBadRequest(e.value) raise exc.HTTPServiceUnavailable(e.value) except ValueError as e: - LOG.error(_LE('Exception during call of the method {method_name}: ' - '{exc}').format(method_name=method_name, exc=str(e))) + LOG.error('Exception during call of the method {method_name}: ' + '{exc}'.format(method_name=method_name, exc=str(e))) raise exc.HTTPBadRequest(e.message) diff --git a/murano/api/v1/templates.py b/murano/api/v1/templates.py index 6f27b16c1..26ab19c11 100644 --- a/murano/api/v1/templates.py +++ b/murano/api/v1/templates.py @@ -18,7 +18,7 @@ import six from webob import exc 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 utils from murano.common import wsgi @@ -237,7 +237,7 @@ class Controller(object): old_env_template = self._validate_exists(env_template_id) 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) raise exc.HTTPForbidden(explanation=msg) self._validate_body_name(body) @@ -262,7 +262,7 @@ class Controller(object): if env_template.is_public or request.context.is_admin: return 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) raise exc.HTTPForbidden(explanation=msg) diff --git a/murano/cfapi/cfapi.py b/murano/cfapi/cfapi.py index 691156d9d..b634c4dd7 100644 --- a/murano/cfapi/cfapi.py +++ b/murano/cfapi/cfapi.py @@ -21,7 +21,6 @@ import six import tenacity from webob import response -from murano.common.i18n import _LI, _LW, _LE from murano.common import auth_utils # noqa from murano.common import wsgi from murano.db.services import cf_connections as db_cf @@ -111,9 +110,9 @@ class Controller(object): except AttributeError: tenant = req.headers['X-Project-Id'] db_cf.set_tenant_for_org(org_guid, tenant) - LOG.info(_LI("Cloud Foundry {org_id} mapped to tenant " - "{tenant_name}").format(org_id=org_guid, - tenant_name=tenant)) + LOG.info("Cloud Foundry {org_id} mapped to tenant " + "{tenant_name}".format(org_id=org_guid, + tenant_name=tenant)) token = req.headers['X-Auth-Token'] m_cli = _get_muranoclient(token, req) @@ -133,19 +132,19 @@ class Controller(object): try: env = m_cli.environments.get(environment_id) except exceptions.HTTPNotFound: - msg = (_LI("Can not find environment_id {environment_id}, " - "will create a new one." - ).format(environment_id=environment_id)) + msg = ("Can not find environment_id {environment_id}, " + "will create a new one." + .format(environment_id=environment_id)) LOG.info(msg) env = {} if not env: - log_msg = (_LI("Cloud Foundry {space_id} remapped to " - "{environment_id}")) + log_msg = ("Cloud Foundry {space_id} remapped to " + "{environment_id}") environment_id = _set_new_environment_for_space( space_guid, log_msg) except AttributeError: - log_msg = (_LI("Cloud Foundry {space_id} mapped to " - "{environment_id}")) + log_msg = ("Cloud Foundry {space_id} mapped to " + "{environment_id}") environment_id = _set_new_environment_for_space( space_guid, log_msg) @@ -162,9 +161,9 @@ class Controller(object): # necessary in our scenario if '?' in parameters.keys(): parameters.pop('?', None) - LOG.warning(_LW("Incorrect input parameters. Package related " - "parameters shouldn't be passed through Cloud " - "Foundry")) + LOG.warning("Incorrect input parameters. Package related " + "parameters shouldn't be passed through Cloud " + "Foundry") params = [parameters] while params: a = params.pop() @@ -238,13 +237,13 @@ class Controller(object): result = _get_creds(m_cli, task_id, environment_id) if not result: - LOG.warning(_LW("This application doesn't have action " - "getCredentials")) + LOG.warning("This application doesn't have action " + "getCredentials") return response.Response(status=500) except KeyError: # NOTE(starodubcevna): In CF service broker API spec return # 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) if 'credentials' in list(result): @@ -269,8 +268,8 @@ class Controller(object): # NOTE(freerunner): Prevent code 500 if requested environment # already doesn't exist. if not service: - LOG.warning(_LW('Requested service for instance {0} is not found') - .format(instance_id)) + LOG.warning('Requested service for instance {0} is not ' + 'found'.format(instance_id)) body = {} resp = response.Response(status=410, json_body=body) return resp @@ -307,9 +306,9 @@ def _get_muranoclient(token_id, req): murano_url = CONF.murano.url or req.endpoints.get('murano') if not murano_url: - LOG.error(_LE('No murano url is specified and no ' - '"application-catalog" ' - 'service is registered in keystone.')) + LOG.error('No murano url is specified and no ' + '"application-catalog" ' + 'service is registered in keystone.') return muranoclient.Client(1, murano_url, token=token_id, artifacts_client=artifacts_client) @@ -320,8 +319,8 @@ def _get_glareclient(token_id, req): url = glare_settings.url or req.endpoints.get('glare') if not url: - LOG.error(_LE('No glare url is specified and no "artifact" ' - 'service is registered in keystone.')) + LOG.error('No glare url is specified and no "artifact" ' + 'service is registered in keystone.') return glare_client.Client( endpoint=url, token=token_id, diff --git a/murano/cmd/manage.py b/murano/cmd/manage.py index a8ca9eb70..c46b7478b 100644 --- a/murano/cmd/manage.py +++ b/murano/cmd/manage.py @@ -26,7 +26,6 @@ from oslo_log import log as logging from murano.common import consts 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 import version @@ -55,7 +54,7 @@ def _do_import_package(_dir, categories, update=False): exst_pkg_id=existing_pkg.id) db_catalog_api.package_delete(existing_pkg.id, AdminContext()) 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)) 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 result = db_catalog_api.package_upload(package, '') - LOG.info(_LI("Finished import of package {res_id}").format( - res_id=result.id)) + LOG.info("Finished import of package {res_id}".format(res_id=result.id)) # TODO(ruhe): proper error handling @@ -155,7 +153,7 @@ def main(): version=version.version_string, default_config_files=default_config_files) 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)) sys.exit("ERROR: %s" % e) @@ -163,8 +161,8 @@ def main(): CONF.command.func() except Exception as e: tb = traceback.format_exc() - err_msg = _LE("murano-manage command failed: {error}\n" - "{traceback}").format(error=e, traceback=tb) + err_msg = ("murano-manage command failed: {error}\n" + "{traceback}").format(error=e, traceback=tb) LOG.error(err_msg) sys.exit(err_msg) diff --git a/murano/cmd/test_runner.py b/murano/cmd/test_runner.py index 43cf822c8..640cc3a07 100644 --- a/murano/cmd/test_runner.py +++ b/murano/cmd/test_runner.py @@ -27,10 +27,9 @@ from oslo_utils import importutils from oslo_utils import timeutils import six -from murano import version -from murano.common.i18n import _, _LE from murano.common import config from murano.common import engine +from murano.common.i18n import _ from murano.dsl import dsl_exception from murano.dsl import dsl_types from murano.dsl import exceptions @@ -39,6 +38,7 @@ from murano.dsl import helpers from murano.engine import execution_session from murano.engine import mock_context_manager from murano.engine import package_loader +from murano import version CONF = cfg.CONF @@ -178,8 +178,8 @@ class MuranoTestRunner(object): 'project_name': getattr(args, 'os_project_name', None)} if None in ks_opts.values() and not CONF.default_config_files: - msg = _LE('Please provide murano config file or credentials for ' - 'authorization: {0}').format( + msg = ('Please provide murano config file or credentials for ' + 'authorization: {0}').format( ', '.join(['--os-auth-url', '--os-username', '--os-password', '--os-project-name', '--os-tenant-id'])) LOG.error(msg) @@ -367,7 +367,7 @@ def main(): CONF.set_default('use_stderr', False) logging.setup(CONF, 'murano') 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) try: @@ -378,7 +378,7 @@ def main(): tb = e.format() else: 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) sys.exit(err_msg) diff --git a/murano/common/engine.py b/murano/common/engine.py index 9b1b7328d..bd3478e73 100644 --- a/murano/common/engine.py +++ b/murano/common/engine.py @@ -39,7 +39,6 @@ from murano.engine import execution_session from murano.engine import package_loader from murano.engine.system import status_reporter from murano.engine.system import yaql_functions -from murano.common.i18n import _LI, _LE, _LW from murano.policy import model_policy_enforcer as enforcer CONF = cfg.CONF @@ -128,7 +127,7 @@ class TaskProcessingEndpoint(object): @staticmethod def execute(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))) result = None @@ -139,7 +138,7 @@ class TaskProcessingEndpoint(object): result = task_executor.execute() return result finally: - LOG.info(_LI('Finished processing task: {task_desc}').format( + LOG.info('Finished processing task: {task_desc}'.format( task_desc=jsonutils.dumps(result))) @@ -147,8 +146,8 @@ class StaticActionEndpoint(object): @classmethod def call_static_action(cls, context, task): s_task = token_sanitizer.TokenSanitizer().sanitize(task) - LOG.info(_LI('Starting execution of static action: ' - '{task_desc}').format(task_desc=jsonutils.dumps(s_task))) + LOG.info('Starting execution of static action: ' + '{task_desc}'.format(task_desc=jsonutils.dumps(s_task))) result = None reporter = status_reporter.StatusReporter(task['id']) @@ -158,8 +157,8 @@ class StaticActionEndpoint(object): result = task_executor.execute() return result finally: - LOG.info(_LI('Finished execution of static action: ' - '{task_desc}').format(task_desc=jsonutils.dumps(result))) + LOG.info('Finished execution of static action: ' + '{task_desc}'.format(task_desc=jsonutils.dumps(result))) class TaskExecutor(object): @@ -214,7 +213,7 @@ class TaskExecutor(object): try: self._delete_trust() except Exception: - LOG.warning(_LW('Cannot delete trust'), exc_info=True) + LOG.warning('Cannot delete trust', exc_info=True) return result @@ -277,8 +276,8 @@ class TaskExecutor(object): else: exception_traceback = traceback.format_exc() LOG.exception( - _LE("Exception %(exc)s occurred" - " during invocation of %(method)s"), + ("Exception %(exc)s occurred" + " during invocation of %(method)s"), {'exc': exception, 'method': method_name}) self._reporter.report_error(root, str(exception)) diff --git a/murano/common/i18n.py b/murano/common/i18n.py index 676643704..a1aa8cb7e 100644 --- a/murano/common/i18n.py +++ b/murano/common/i18n.py @@ -22,13 +22,3 @@ _translators = oslo_i18n.TranslatorFactory(domain='murano') # The primary translation function using the well-known name "_" _ = _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 diff --git a/murano/common/plugins/extensions_loader.py b/murano/common/plugins/extensions_loader.py index d4e88e653..d8c28f986 100644 --- a/murano/common/plugins/extensions_loader.py +++ b/murano/common/plugins/extensions_loader.py @@ -20,7 +20,6 @@ from oslo_log import log as logging import six from stevedore import dispatch -from murano.common.i18n import _LE, _LI, _LW from murano.dsl import murano_package @@ -50,7 +49,7 @@ class PluginLoader(object): dist_name = str(extension.entry_point.dist) name = extension.entry_point.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)) return name_map.setdefault(name, []).append(dist_name) @@ -64,21 +63,21 @@ class PluginLoader(object): try: package.classes[name] = initialize_plugin(plugin) except Exception: - LOG.exception(_LE("Unable to initialize plugin for {name}").format( + LOG.exception("Unable to initialize plugin for {name}".format( name=name)) 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)) def cleanup_duplicates(self, name_map): for class_name, package_names in six.iteritems(name_map): 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: - LOG.warning(_LW("Disabling class {class_name} in {dist} " - "due to conflict").format( - class_name=class_name, - dist=package_name)) + LOG.warning( + "Disabling class {class_name} in {dist} due to " + "conflict".format( + class_name=class_name, dist=package_name)) self.packages[package_name].classes.pop(class_name) @staticmethod @@ -92,8 +91,8 @@ class PluginLoader(object): @staticmethod def _on_load_failure(manager, ep, exc): - LOG.warning(_LW("Error loading entry-point {ep} from package {dist}: " - "{err}").format(ep=ep.name, dist=ep.dist, err=exc)) + LOG.warning("Error loading entry-point {ep} from package {dist}: " + "{err}".format(ep=ep.name, dist=ep.dist, err=exc)) def register_in_loader(self, package_loader): 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') for class_name, clazz in six.iteritems(package_definition.classes): if hasattr(clazz, "_murano_class_name"): - LOG.warning(_LW("Class '%(class_name)s' has a MuranoPL " - "name '%(name)s' defined which will be " - "ignored") % + LOG.warning("Class '%(class_name)s' has a MuranoPL " + "name '%(name)s' defined which will be " + "ignored" % 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", class_name, package_definition.name) self.register_class(clazz, class_name) diff --git a/murano/common/plugins/package_types_loader.py b/murano/common/plugins/package_types_loader.py index a3982d9db..1233266bd 100644 --- a/murano/common/plugins/package_types_loader.py +++ b/murano/common/plugins/package_types_loader.py @@ -18,8 +18,6 @@ from oslo_config import cfg from oslo_log import log as logging from stevedore import dispatch -from murano.common.i18n import _LE, _LW, _LI - CONF = cfg.CONF LOG = logging.getLogger(__name__) @@ -28,7 +26,7 @@ NAMESPACE = 'io.murano.plugins.packages' class PluginLoader(object): def __init__(self): - LOG.info(_LI('Loading package type plugins')) + LOG.info('Loading package type plugins') extension_manager = dispatch.EnabledExtensionManager( NAMESPACE, self._is_plugin_enabled, @@ -52,14 +50,14 @@ class PluginLoader(object): @staticmethod def _on_load_failure(manager, ep, exc): - LOG.warning(_LW("Error loading entry-point {ep} from package {dist}: " - "{err}").format(ep=ep.name, dist=ep.dist, err=exc)) + LOG.warning("Error loading entry-point {ep} from package {dist}: " + "{err}".format(ep=ep.name, dist=ep.dist, err=exc)) @staticmethod def _parse_format_string(format_string): parts = format_string.rsplit('/', 1) if len(parts) != 2: - LOG.error(_LE("Incorrect format name {name}").format( + LOG.error("Incorrect format name {name}".format( name=format_string)) raise ValueError(format_string) return ( @@ -75,7 +73,7 @@ class PluginLoader(object): else: self._initialize_plugin(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)) def get_package_handler(self, format_name): diff --git a/murano/common/server.py b/murano/common/server.py index 88013733a..556a8484b 100644 --- a/murano/common/server.py +++ b/murano/common/server.py @@ -28,7 +28,6 @@ from murano.db import models from murano.db.services import environments from murano.db.services import instances from murano.db import session -from murano.common.i18n import _LI, _LW from murano.services import states CONF = cfg.CONF @@ -50,8 +49,8 @@ class ResultEndpoint(object): environment = unit.query(models.Environment).get(environment_id) if not environment: - LOG.warning(_LW('Environment result could not be handled, ' - 'specified environment not found in database')) + LOG.warning('Environment result could not be handled, ' + 'specified environment not found in database') return if model['Objects'] is None and model.get('ObjectsCopy', {}) is None: @@ -113,14 +112,14 @@ class ResultEndpoint(object): if objects: services = objects.get('services') if num_errors + num_warnings > 0: - LOG.warning(_LW('EnvId: {env_id} TenantId: {tenant_id} Status: ' - 'Failed Apps: {services}') + LOG.warning('EnvId: {env_id} TenantId: {tenant_id} Status: ' + 'Failed Apps: {services}' .format(env_id=environment.id, tenant_id=environment.tenant_id, services=services)) else: - LOG.info(_LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' - 'Successful Apps: {services}') + LOG.info('EnvId: {env_id} TenantId: {tenant_id} Status: ' + 'Successful Apps: {services}' .format(env_id=environment.id, tenant_id=environment.tenant_id, services=services)) diff --git a/murano/common/statservice.py b/murano/common/statservice.py index f2cbdf973..6de14f761 100644 --- a/murano/common/statservice.py +++ b/murano/common/statservice.py @@ -26,7 +26,6 @@ import psutil from murano.api import v1 from murano.api.v1 import request_statistics -from murano.common.i18n import _LE from murano.db.services import stats as db_stats CONF = cfg.CONF @@ -94,5 +93,5 @@ class StatsCollectingService(service.Service): stats.cpu_percent = psutil.cpu_percent() self._stats_db.update(self._hostname, stats) except Exception as e: - LOG.exception(_LE("Failed to get statistics object from a " - "database. {error_code}").format(error_code=e)) + LOG.exception("Failed to get statistics object from a " + "database. {error_code}".format(error_code=e)) diff --git a/murano/common/wsgi.py b/murano/common/wsgi.py index a517d4928..1ce20ee89 100644 --- a/murano/common/wsgi.py +++ b/murano/common/wsgi.py @@ -41,7 +41,7 @@ import webob.exc from murano.api.v1 import validation_schemas from murano.common import config from murano.common import exceptions -from murano.common.i18n import _, _LE, _LW +from murano.common.i18n import _ from murano.common import xmlutils eventlet.patcher.monkey_patch(all=False, socket=True) @@ -378,7 +378,7 @@ class ResourceExceptionHandler(object): # convert to webob exceptions. if isinstance(ex_value, TypeError): 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) raise webob.exc.HTTPBadRequest() @@ -778,8 +778,8 @@ class RequestDeserializer(object): try: content_type = request.get_content_type() except exceptions.UnsupportedContentType as e: - LOG.error(_LE("Unrecognized Content-Type provided in request: " - "{error}").format(error=str(e))) + LOG.error("Unrecognized Content-Type provided in request: " + "{error}".format(error=str(e))) raise if content_type is None: @@ -947,7 +947,7 @@ class JSONPatchDeserializer(TextDeserializer): try: jsonschema.validate(property_to_update, schema) 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) def _decode_json_pointer(self, pointer): @@ -1111,7 +1111,7 @@ class FormDataDeserializer(TextDeserializer): data=datastring)) value = jsonutils.loads(datastring) 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 def default(self, request): diff --git a/murano/db/catalog/api.py b/murano/db/catalog/api.py index 256ae24fb..160b49a17 100644 --- a/murano/db/catalog/api.py +++ b/murano/db/catalog/api.py @@ -24,9 +24,9 @@ from sqlalchemy.orm import attributes # TODO(ruhe) use exception declared in openstack/common/db from webob import exc +from murano.common.i18n import _ from murano.db import models from murano.db import session as db_session -from murano.common.i18n import _, _LW SEARCH_MAPPING = {'fqn': 'fully_qualified_name', @@ -189,9 +189,8 @@ def _do_add(package, change): try: getattr(package, path).append(item) except AssertionError: - LOG.warning(_LW('One of the specified {path} is already associated' - ' with a package. Doing nothing.').format( - path=path)) + LOG.warning('One of the specified {path} is already associated' + ' with a package. Doing nothing.'.format(path=path)) return package diff --git a/murano/dsl/executor.py b/murano/dsl/executor.py index 41c93b9d5..a75476350 100644 --- a/murano/dsl/executor.py +++ b/murano/dsl/executor.py @@ -24,7 +24,6 @@ from yaql.language import exceptions as yaql_exceptions from yaql.language import specs from yaql.language import utils -from murano.common.i18n import _LW, _LE from murano.dsl import attribute_store from murano.dsl import constants from murano.dsl import dsl @@ -348,9 +347,9 @@ class MuranoDslExecutor(object): method, subscriber, None, [obj], {}, invoke_action=False) except Exception as e: - LOG.warning(_LW( - 'Muted exception during destruction dependency ' - 'execution in {0}: {1}').format(obj, e), exc_info=True) + LOG.warning('Muted exception during destruction dependency ' + 'execution in {0}: {1}'.format(obj, e), + exc_info=True) obj.load_dependencies(None) def destroy_objects(self, *objects): @@ -372,9 +371,9 @@ class MuranoDslExecutor(object): tb = e.format(prefix=' ') else: tb = traceback.format_exc() - LOG.warning(_LW( + LOG.warning( '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): context = self._root_context_cache.get(runtime_version) @@ -478,8 +477,8 @@ class MuranoDslExecutor(object): return model except Exception as e: LOG.exception( - _LE("Exception %s occurred" - " during MuranoDslExecutor finalization"), e) + "Exception %s occurred" + " during MuranoDslExecutor finalization", e) return None def __enter__(self): diff --git a/murano/dsl/murano_method.py b/murano/dsl/murano_method.py index bf99b31ac..5783f261c 100644 --- a/murano/dsl/murano_method.py +++ b/murano/dsl/murano_method.py @@ -32,8 +32,6 @@ from murano.dsl import virtual_exceptions from murano.dsl import yaql_integration -from murano.common.i18n import _LW - LOG = logging.getLogger(__name__) macros.register() virtual_exceptions.register() @@ -139,8 +137,8 @@ class MuranoMethod(dsl_types.MuranoMethod, meta.MetaProvider): if self._usage == dsl_types.MethodUsages.Action: runtime_version = self.declaring_type.package.runtime_version if runtime_version > constants.RUNTIME_VERSION_1_3: - LOG.warning(_LW('"Usage: Action" is deprecated, ' - 'use "Scope: Public" instead')) + LOG.warning('"Usage: Action" is deprecated, ' + 'use "Scope: Public" instead') if self._scope == dsl_types.MethodScopes.Session: raise ValueError( 'Both "Usage: Action" and "Scope: Session" are ' diff --git a/murano/engine/execution_session.py b/murano/engine/execution_session.py index de50ebd4d..83a32661b 100644 --- a/murano/engine/execution_session.py +++ b/murano/engine/execution_session.py @@ -15,7 +15,6 @@ from oslo_log import log as logging -from murano.common.i18n import _LE LOG = logging.getLogger(__name__) @@ -43,8 +42,8 @@ class ExecutionSession(object): try: delegate() except Exception: - LOG.exception(_LE('Unhandled exception on invocation of ' - 'pre-execution hook')) + LOG.exception('Unhandled exception on invocation of ' + 'pre-execution hook') self._set_up_list = [] def finish(self): @@ -52,6 +51,6 @@ class ExecutionSession(object): try: delegate() except Exception: - LOG.exception(_LE('Unhandled exception on invocation of ' - 'post-execution hook')) + LOG.exception('Unhandled exception on invocation of ' + 'post-execution hook') self._tear_down_list = [] diff --git a/murano/engine/package_loader.py b/murano/engine/package_loader.py index 1c395d77f..284fcce7e 100644 --- a/murano/engine/package_loader.py +++ b/murano/engine/package_loader.py @@ -33,7 +33,6 @@ from oslo_utils import fileutils import six from murano.common import auth_utils -from murano.common.i18n import _LE, _LI, _LW from murano.dsl import constants from murano.dsl import exceptions 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 == 'glance': versionutils.report_deprecated_feature( - LOG, - _LW("'glance' packages_service option has been renamed " - "to 'glare', please update your configuration")) + LOG, "'glance' packages_service option has been renamed " + "to 'glare', please update your configuration") artifacts_client = self._get_glare_client() else: artifacts_client = None @@ -241,8 +239,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): try: return load_utils.load_from_dir(package_directory) except pkg_exc.PackageLoadError: - LOG.exception( - _LE('Unable to load package from cache. Clean-up.')) + LOG.exception('Unable to load package from cache. Clean-up.') shutil.rmtree(package_directory, ignore_errors=True) # the package is not yet in cache, let's try to download it. @@ -260,8 +257,7 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): try: return load_utils.load_from_dir(package_directory) except pkg_exc.PackageLoadError: - LOG.error( - _LE('Unable to load package from cache. Clean-up.')) + LOG.error('Unable to load package from cache. Clean-up.') shutil.rmtree(package_directory, ignore_errors=True) # attempt the download itself @@ -286,9 +282,10 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): package_file.name, target_dir=package_directory, drop_dir=False) as app_package: - LOG.info(_LI( - "Successfully downloaded and unpacked package {} {}") - .format(package_def.fully_qualified_name, package_id)) + LOG.info( + "Successfully downloaded and unpacked " + "package {} {}".format( + package_def.fully_qualified_name, package_id)) self._downloaded.append(app_package) self.try_cleanup_cache( @@ -365,9 +362,8 @@ class ApiPackageLoader(package_loader.MuranoPackageLoader): try: os.remove(lock_path) except OSError: - LOG.warning( - _LW("Couldn't delete lock file: " - "{}").format(lock_path)) + LOG.warning("Couldn't delete lock file: " + "{}".format(lock_path)) except RuntimeError: # couldn't upgrade read lock to write-lock. go on. continue @@ -470,10 +466,10 @@ class DirectoryPackageLoader(package_loader.MuranoPackageLoader): system_objects.register(dsl_package) self.register_package(dsl_package) 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)) 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): self._fixations = deserialize_package_fixations(fixations) diff --git a/murano/engine/system/agent_listener.py b/murano/engine/system/agent_listener.py index 19b65a377..66d83de95 100644 --- a/murano/engine/system/agent_listener.py +++ b/murano/engine/system/agent_listener.py @@ -18,7 +18,6 @@ from oslo_config import cfg from oslo_log import log as logging from murano.common import exceptions -from murano.common.i18n import _LE from murano.dsl import dsl from murano.engine.system import common @@ -40,8 +39,8 @@ class AgentListener(object): def _check_enabled(self): if CONF.engine.disable_murano_agent: - LOG.error(_LE('Use of murano-agent is disallowed ' - 'by the server configuration')) + LOG.error('Use of murano-agent is disallowed ' + 'by the server configuration') raise exceptions.PolicyViolationException( 'Use of murano-agent is disallowed ' diff --git a/murano/engine/system/heat_stack.py b/murano/engine/system/heat_stack.py index 7d50863ad..13a798d3c 100644 --- a/murano/engine/system/heat_stack.py +++ b/murano/engine/system/heat_stack.py @@ -24,7 +24,6 @@ from oslo_log import log as logging import six from murano.common import auth_utils -from murano.common.i18n import _LW from murano.dsl import dsl from murano.dsl import helpers from murano.dsl import session_local_storage @@ -252,7 +251,7 @@ class HeatStack(object): else: self.delete() 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) else: break @@ -300,11 +299,11 @@ class HeatStack(object): lambda status: status in ('DELETE_COMPLETE', 'NOT_FOUND'), wait_progress=True) except heat_exc.NotFound: - LOG.warning(_LW('Stack {stack_name} already deleted?') + LOG.warning('Stack {stack_name} already deleted?' .format(stack_name=self._name)) break 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) else: break diff --git a/murano/engine/system/net_explorer.py b/murano/engine/system/net_explorer.py index 04a5d1ca4..4cc504afd 100644 --- a/murano/engine/system/net_explorer.py +++ b/murano/engine/system/net_explorer.py @@ -24,7 +24,6 @@ import tenacity from murano.common import auth_utils from murano.common import exceptions as exc -from murano.common.i18n import _LI from murano.dsl import dsl from murano.dsl import helpers from murano.dsl import session_local_storage @@ -98,7 +97,7 @@ class NetworkExplorer(object): } router = self._client.create_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'] else: raise KeyError('Router %s was not found' % router_name) diff --git a/murano/engine/system/workflowclient.py b/murano/engine/system/workflowclient.py index 717c1e912..a922c34f9 100644 --- a/murano/engine/system/workflowclient.py +++ b/murano/engine/system/workflowclient.py @@ -25,7 +25,6 @@ from oslo_config import cfg from oslo_log import log as logging from murano.common import auth_utils -from murano.common.i18n import _LW from murano.dsl import dsl from murano.dsl import session_local_storage @@ -53,7 +52,7 @@ class MistralClient(object): @session_local_storage.execution_session_memoize def _create_client(region): if not mistralcli: - LOG.warning(_LW("Mistral client is not available")) + LOG.warning("Mistral client is not available") raise mistral_import_error mistral_settings = CONF.mistral diff --git a/murano/policy/model_policy_enforcer.py b/murano/policy/model_policy_enforcer.py index affdbbb82..43e2c4eb9 100644 --- a/murano/policy/model_policy_enforcer.py +++ b/murano/policy/model_policy_enforcer.py @@ -23,7 +23,7 @@ except ImportError as congress_client_import_error: from oslo_log import log as logging 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.modify.actions import action_manager as am @@ -127,7 +127,7 @@ class ModelPolicyEnforcer(object): LOG.error(msg) raise ValidationError(msg) else: - LOG.info(_LI('Model valid')) + LOG.info('Model valid') def _execute_simulation(self, package_loader, env_id, model, query): rules = congress_rules.CongressRulesManager().convert( diff --git a/murano/tests/functional/common/utils.py b/murano/tests/functional/common/utils.py index fec06d262..b57a0652f 100644 --- a/murano/tests/functional/common/utils.py +++ b/murano/tests/functional/common/utils.py @@ -31,7 +31,6 @@ from muranoclient.glance import client as glare_client from oslo_log import log as logging import yaml -from murano.common.i18n import _LW, _LE from murano.services import states import murano.tests.functional.common.zip_utils_mixin as zip_utils import murano.tests.functional.engine.config as cfg @@ -203,7 +202,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin): deployment = cls.get_last_deployment(environment) try: 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: LOG.error(e) report = cls.get_deployment_report(environment, deployment) @@ -337,8 +336,8 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin): service_type='application-catalog', endpoint_type='publicURL') except ks_exceptions.EndpointNotFound: url = CONF.murano.murano_url - LOG.warning(_LW("Murano endpoint not found in Keystone. " - "Using CONF.")) + LOG.warning("Murano endpoint not found in Keystone. " + "Using CONF.") return url if 'v1' not in url else "/".join( url.split('/')[:url.split('/').index('v1')]) @@ -362,7 +361,7 @@ class DeployTestMixin(zip_utils.ZipUtilsMixin): raise RuntimeError('Resource at {0}:{1} not exist'. format(ip, port)) except socket.error as e: - LOG.error(_LE('Socket Error: {error}').format(error=e)) + LOG.error('Socket Error: {error}'.format(error=e)) @classmethod def get_ip_by_appname(cls, environment, appname): diff --git a/murano/tests/unit/api/middleware/test_version_negotiation.py b/murano/tests/unit/api/middleware/test_version_negotiation.py index c32a82189..0eac9c71a 100644 --- a/murano/tests/unit/api/middleware/test_version_negotiation.py +++ b/murano/tests/unit/api/middleware/test_version_negotiation.py @@ -32,8 +32,7 @@ class MiddlewareVersionNegotiationTest(base.MuranoTestCase): self.assertIsInstance(result, versions.Controller) 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') def test_process_request(self, mock_log): @@ -83,8 +82,7 @@ class MiddlewareVersionNegotiationTest(base.MuranoTestCase): self.assertIsInstance(result, versions.Controller) mock_log.warning.assert_called_once_with( - version_negotiation._LW( - "Unknown version. Returning version choices.")) + "Unknown version. Returning version choices.") def test_factory(self): app = version_negotiation.VersionNegotiationFilter.factory(None) diff --git a/murano/tests/unit/api/v1/cloudfoundry/test_cfapi.py b/murano/tests/unit/api/v1/cloudfoundry/test_cfapi.py index 1cc734dc8..0ebbeb890 100644 --- a/murano/tests/unit/api/v1/cloudfoundry/test_cfapi.py +++ b/murano/tests/unit/api/v1/cloudfoundry/test_cfapi.py @@ -19,7 +19,6 @@ from oslo_serialization import base64 from webob import response from murano.cfapi import cfapi as api -from murano.common.i18n import _LE, _LI, _LW from murano.common import wsgi from murano.db import models from murano.tests.unit import base @@ -225,10 +224,10 @@ class TestController(base.MuranoTestCase): mock_muranoclient.environments.get.assert_called_once_with( mock.sentinel.environment_id) mock_log.info.assert_has_calls([ - mock.call(_LI("Can not find environment_id sentinel.environment_id" - ", will create a new one.")), - mock.call(_LI("Cloud Foundry foo_space_guid remapped to " - "sentinel.alt_environment_id")) + mock.call("Can not find environment_id sentinel.environment_id" + ", will create a new one."), + mock.call("Cloud Foundry foo_space_guid remapped to " + "sentinel.alt_environment_id") ]) @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.sentinel.service_id) 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.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.sentinel.service_id) 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): self.assertEqual({}, self.controller.unbind(None, None, None)) @@ -354,8 +353,8 @@ class TestController(base.MuranoTestCase): self.assertEqual(410, resp.status_code) self.assertEqual({}, resp.json_body) mock_log.warning.assert_called_once_with( - _LW('Requested service for instance sentinel.instance_id is not ' - 'found')) + 'Requested service for instance sentinel.instance_id is not ' + 'found') @mock.patch.object(api, '_get_muranoclient', 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, artifacts_client=m_artifacts_client) mock_log.error.assert_has_calls([ - mock.call(_LE('No glare url is specified and no "artifact" ' - 'service is registered in keystone.')), - mock.call(_LE('No murano url is specified and no ' - '"application-catalog" service is registered in ' - 'keystone.')) + mock.call('No glare url is specified and no "artifact" ' + 'service is registered in keystone.'), + mock.call('No murano url is specified and no ' + '"application-catalog" service is registered in ' + 'keystone.') ]) def _override_conf(self, without_urls=False): diff --git a/murano/tests/unit/cmd/test_manage.py b/murano/tests/unit/cmd/test_manage.py index 1d9d5004a..5098152f8 100644 --- a/murano/tests/unit/cmd/test_manage.py +++ b/murano/tests/unit/cmd/test_manage.py @@ -22,7 +22,6 @@ except ImportError: from io import StringIO from murano.cmd import manage -from murano.common.i18n import _LE from murano.db.catalog import api as db_catalog_api from murano.db import models from murano.db import session as db_session @@ -146,8 +145,8 @@ class TestManage(test_base.MuranoWithDBTestCase): manage.do_import_package() mock_log.error.assert_called_once_with( - _LE("Package '{name}' exists ({pkg_id}). Use --update.") - .format(name='test_full_name', pkg_id=self.test_package.id)) + "Package '{name}' exists ({pkg_id}). Use --update." + .format(name='test_full_name', pkg_id=self.test_package.id)) @mock.patch('sys.stdout', new_callable=StringIO) 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): 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): manage.main() diff --git a/murano/tests/unit/common/test_server.py b/murano/tests/unit/common/test_server.py index 6e06a8354..7efeece96 100644 --- a/murano/tests/unit/common/test_server.py +++ b/murano/tests/unit/common/test_server.py @@ -16,7 +16,6 @@ from datetime import datetime import mock -from murano.common.i18n import _LI, _LW from murano.common import server from murano.services import states from murano.tests.unit import base @@ -75,8 +74,8 @@ class ServerTest(base.MuranoTestCase): states.SessionState.DEPLOYED, mock_db_session.get_session().query().filter_by().first().state) mock_log.info.assert_called_once_with( - _LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' - 'Successful Apps: {services}') + 'EnvId: {env_id} TenantId: {tenant_id} Status: ' + 'Successful Apps: {services}' .format(env_id=mock_env.id, tenant_id=mock_env.tenant_id, services=test_result['model']['Objects']['services'])) @@ -123,8 +122,8 @@ class ServerTest(base.MuranoTestCase): states.SessionState.DEPLOY_FAILURE, mock_db_session.get_session().query().filter_by().first().state) mock_log.warning.assert_called_once_with( - _LW('EnvId: {env_id} TenantId: {tenant_id} Status: ' - 'Failed Apps: {services}') + 'EnvId: {env_id} TenantId: {tenant_id} Status: ' + 'Failed Apps: {services}' .format(env_id=mock_env.id, tenant_id=mock_env.tenant_id, services=test_result['model']['Objects']['services'])) @@ -170,8 +169,8 @@ class ServerTest(base.MuranoTestCase): states.SessionState.DELETE_FAILURE, mock_db_session.get_session().query().filter_by().first().state) mock_log.warning.assert_called_once_with( - _LI('EnvId: {env_id} TenantId: {tenant_id} Status: ' - 'Failed Apps: {services}') + 'EnvId: {env_id} TenantId: {tenant_id} Status: ' + 'Failed Apps: {services}' .format(env_id=mock_env.id, tenant_id=mock_env.tenant_id, services=[])) @@ -188,9 +187,8 @@ class ServerTest(base.MuranoTestCase): 'test_env_id') self.assertIsNone(result) mock_log.warning.assert_called_once_with( - _LW('Environment result could not be handled, ' - 'specified environment not found in database') - ) + 'Environment result could not be handled, ' + 'specified environment not found in database') @mock.patch('murano.common.server.environments') @mock.patch('murano.common.server.session') diff --git a/murano/tests/unit/common/test_statservice.py b/murano/tests/unit/common/test_statservice.py index 90a5e98d9..de90900d9 100644 --- a/murano/tests/unit/common/test_statservice.py +++ b/murano/tests/unit/common/test_statservice.py @@ -16,7 +16,6 @@ import mock import time -from murano.common.i18n import _LE from murano.common import statservice from murano.tests.unit import base @@ -92,5 +91,5 @@ class StatsCollectingServiceTest(base.MuranoTestCase): self.service.update_stats() mock_log.exception.assert_called_once_with( - _LE("Failed to get statistics object from a " - "database. {error_code}").format(error_code='test_error_code')) + "Failed to get statistics object from a " + "database. {error_code}".format(error_code='test_error_code')) diff --git a/murano/tests/unit/common/test_wsgi.py b/murano/tests/unit/common/test_wsgi.py index c17ce6751..bbad6442c 100644 --- a/murano/tests/unit/common/test_wsgi.py +++ b/murano/tests/unit/common/test_wsgi.py @@ -23,7 +23,7 @@ from oslo_config import cfg from xml.dom import minidom from murano.common import exceptions -from murano.common.i18n import _, _LW +from murano.common.i18n import _ from murano.common import wsgi from murano.tests.unit import base @@ -604,4 +604,4 @@ class TestFormDataDeserializer(base.MuranoTestCase): mock_log.debug.assert_called_once_with( "Trying to deserialize 'value error' to json") mock_log.warning.assert_called_once_with( - _LW('Unable to deserialize to json, using raw text')) + 'Unable to deserialize to json, using raw text') diff --git a/murano/tests/unit/db/migration/test_migrations_base.py b/murano/tests/unit/db/migration/test_migrations_base.py index 577877670..7c9f462e3 100644 --- a/murano/tests/unit/db/migration/test_migrations_base.py +++ b/murano/tests/unit/db/migration/test_migrations_base.py @@ -32,7 +32,6 @@ from alembic import script as alembic_script from oslo_config import cfg from oslo_log import log as logging -from murano.common.i18n import _LE import murano.db.migration LOG = logging.getLogger(__name__) @@ -191,6 +190,6 @@ class BaseWalkMigrationTestCase(object): if check: check(engine, data) 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)) raise diff --git a/murano/tests/unit/engine/test_package_loader.py b/murano/tests/unit/engine/test_package_loader.py index c4359bc62..33c302b85 100644 --- a/murano/tests/unit/engine/test_package_loader.py +++ b/murano/tests/unit/engine/test_package_loader.py @@ -24,7 +24,6 @@ from oslo_config import cfg import semantic_version import testtools -from murano.common.i18n import _LE, _LW from murano.dsl import exceptions as dsl_exceptions from murano.dsl import murano_package as dsl_package from murano.engine import package_loader @@ -79,8 +78,8 @@ class TestPackageCache(base.MuranoTestCase): mock_versionutils.report_deprecated_feature.assert_called_once_with( package_loader.LOG, - _LW("'glance' packages_service option has been renamed " - "to 'glare', please update your configuration")) + "'glance' packages_service option has been renamed " + "to 'glare', please update your configuration") self.assertIsNotNone(client) self.assertIsNotNone(self.loader._glare_client) @@ -425,7 +424,7 @@ class TestPackageCache(base.MuranoTestCase): self.loader._get_package_by_definition(package) 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() # 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) 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) @testtools.skipIf(os.name == 'nt', "Doesn't work on Windows") diff --git a/murano/tests/unit/test_heat_stack.py b/murano/tests/unit/test_heat_stack.py index 378ced312..34e90836f 100644 --- a/murano/tests/unit/test_heat_stack.py +++ b/murano/tests/unit/test_heat_stack.py @@ -239,7 +239,7 @@ class TestHeatStack(base.MuranoTestCase): hs.push() 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') def test_update_wrong_template_version(self, current): @@ -438,7 +438,7 @@ class TestHeatStack(base.MuranoTestCase): self.assertTrue(hs._applied) self.assertEqual({}, hs._template) 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 + '._get_status') @@ -463,8 +463,8 @@ class TestHeatStack(base.MuranoTestCase): self.assertTrue(hs._applied) self.assertEqual({}, hs._template) - mock_log.warning.assert_called_with( - heat_stack._LW('Conflicting operation: ERROR: test_error_msg')) + mock_log.warning.assert_called_with('Conflicting operation: ' + 'ERROR: test_error_msg') @mock.patch(CLS_NAME + '._wait_state') @mock.patch(CLS_NAME + '._get_status')