Log missing clients as WARNING instead of ERROR

This will prevent tracebacks from being logged if every client is not
installed when the engine is started.

Change-Id: I53c90f98689070a0b18e49ca7988e4176a8987ac
Closes-Bug: #1597593
This commit is contained in:
Jason Dunsmore 2016-06-30 15:50:42 -05:00
parent 9811510a9d
commit bd1ea9e874
3 changed files with 30 additions and 2 deletions

View File

@ -0,0 +1,24 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_log import log as logging
LOG = logging.getLogger(__name__)
def log_fail_msg(manager, entrypoint, exception):
LOG.warning('Encountered exception while loading %(module_name)s: '
'"%(message)s". Not using %(name)s.' %
{'module_name': entrypoint.module_name,
'message': exception.message,
'name': entrypoint.name})

View File

@ -22,6 +22,7 @@ from stevedore import enabled
from heat.common import exception
from heat.common.i18n import _
from heat.common.i18n import _LW
from heat.common import pluginutils
LOG = logging.getLogger(__name__)
@ -130,7 +131,8 @@ def initialise():
_mgr = enabled.EnabledExtensionManager(
namespace='heat.clients',
check_func=client_is_available,
invoke_on_load=False)
invoke_on_load=False,
on_load_failure_callback=pluginutils.log_fail_msg)
def list_opts():

View File

@ -13,6 +13,7 @@
from stevedore import extension
from heat.common import pluginutils
from heat.engine import clients
from heat.engine import environment
from heat.engine import plugin_manager
@ -42,7 +43,8 @@ def _register_event_sinks(env, type_pairs):
def _get_mapping(namespace):
mgr = extension.ExtensionManager(
namespace=namespace,
invoke_on_load=False)
invoke_on_load=False,
on_load_failure_callback=pluginutils.log_fail_msg)
return [[name, mgr[name].plugin] for name in mgr.names()]