From ae3a080053fce882125453fcd32c47189f151feb Mon Sep 17 00:00:00 2001 From: Phil Day Date: Thu, 31 Jan 2013 12:55:19 +0000 Subject: [PATCH] Default value of monkey_patch_modules is broken The default value of monkey_patch_modules has not kept up with the move of notifier to openstack.common Without this change setting 'monkey_patch=True' in nova.conf will cause runtime errors unless the monkey_patch_modules is also specified pointing to the correct notifier Change-Id: Ib22faa7404b09791799338de2edfe0ddcd662d5f --- nova/utils.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nova/utils.py b/nova/utils.py index de9879393..738b10f37 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -50,14 +50,16 @@ from nova.openstack.common import importutils from nova.openstack.common import log as logging from nova.openstack.common import timeutils +notify_decorator = 'nova.openstack.common.notifier.api.notify_decorator' + monkey_patch_opts = [ cfg.BoolOpt('monkey_patch', default=False, help='Whether to log monkey patching'), cfg.ListOpt('monkey_patch_modules', default=[ - 'nova.api.ec2.cloud:nova.notifier.api.notify_decorator', - 'nova.compute.api:nova.notifier.api.notify_decorator' + 'nova.api.ec2.cloud:%s' % (notify_decorator), + 'nova.compute.api:%s' % (notify_decorator) ], help='List of modules/decorators to monkey patch'), ] @@ -930,10 +932,11 @@ def monkey_patch(): You can set decorators for each modules using CONF.monkey_patch_modules. The format is "Module path:Decorator function". - Example: 'nova.api.ec2.cloud:nova.notifier.api.notify_decorator' + Example: + 'nova.api.ec2.cloud:nova.openstack.common.notifier.api.notify_decorator' Parameters of the decorator is as follows. - (See nova.notifier.api.notify_decorator) + (See nova.openstack.common.notifier.api.notify_decorator) name - name of the function function - object of the function