From 43cf9864b9091319612926a01b07045806cfce49 Mon Sep 17 00:00:00 2001 From: Changbin Liu Date: Wed, 19 Jun 2013 12:09:28 -0400 Subject: Remove usage of locals() for formatting from nova.scheduler.* Using of locals() for formatting string is a nasty thing because: 1) It is not so clear as using explicit dicts 2) It could produce hidden errors during refactoring 3) Changing name of variable causes change in message 4) Creating a lot of unused variables fixes bug #1171936 Change-Id: I7639631846a9145c3a18f2a704b71184ec781f45 --- nova/scheduler/manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'nova/scheduler/manager.py') diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 9429a0662..5c99feb03 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -208,7 +208,8 @@ class SchedulerManager(manager.Manager): # The refactoring could go further but trying to minimize changes # for essex timeframe - LOG.warning(_("Failed to schedule_%(method)s: %(ex)s") % locals()) + LOG.warning(_("Failed to schedule_%(method)s: %(ex)s"), + {'method': method, 'ex': ex}) vm_state = updates['vm_state'] properties = request_spec.get('instance_properties', {}) @@ -222,8 +223,8 @@ class SchedulerManager(manager.Manager): for instance_uuid in request_spec.get('instance_uuids') or uuids: if instance_uuid: state = vm_state.upper() - LOG.warning(_('Setting instance to %(state)s state.'), - locals(), instance_uuid=instance_uuid) + LOG.warning(_('Setting instance to %s state.'), state, + instance_uuid=instance_uuid) # update instance state and notify on the transition (old_ref, new_ref) = self.db.instance_update_and_get_original( -- cgit