exit_code = '-'
message = _('%(description)s\nCommand: %(cmd)s\n'
'Exit code: %(exit_code)s\nStdout: %(stdout)r\n'
- 'Stderr: %(stderr)r') % locals()
+ 'Stderr: %(stderr)r') % {
+ 'description': description,
+ 'cmd': cmd,
+ 'exit_code': exit_code,
+ 'stdout': stdout,
+ 'stderr': stderr,
+ }
IOError.__init__(self, message)
expire=expire,
project_id=project_id)
- LOG.debug(_("Created reservations %(reservations)s") % locals())
+ LOG.debug(_("Created reservations %s") % reservations)
return reservations
# usage resynchronization and the reservation expiration
# mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal.
- LOG.exception(_("Failed to commit reservations "
- "%(reservations)s") % locals())
+ LOG.exception(_("Failed to commit reservations %s") % reservations)
def rollback(self, context, reservations, project_id=None):
"""Roll back reservations.
# mechanisms will resolve the issue. The exception is
# logged, however, because this is less than optimal.
LOG.exception(_("Failed to roll back reservations "
- "%(reservations)s") % locals())
+ "%s") % reservations)
def destroy_all_by_project(self, context, project_id):
"""
code = 0
if os.WIFSIGNALED(status):
sig = os.WTERMSIG(status)
- LOG.info(_('Child %(pid)d killed by signal %(sig)d'), locals())
+ LOG.info(_('Child %(pid)d killed by signal %(sig)d'),
+ {'pid': pid, 'sig': sig})
else:
code = os.WEXITSTATUS(status)
- LOG.info(_('Child %(pid)d exited with status %(code)d'), locals())
+ LOG.info(_('Child %(pid)d exited with status %(code)d'),
+ {'pid': pid, 'code': code})
if pid not in self.children:
LOG.warning(_('pid %d not in child list'), pid)
# should use secret flag when switch over to openstack-common
if ("_password" in flag or "_key" in flag or
(flag == "sql_connection" and "mysql:" in flag_get)):
- LOG.debug(_('%(flag)s : FLAG SET ') % locals())
+ LOG.debug(_('%s : FLAG SET ') % flag)
else:
- LOG.debug('%(flag)s : %(flag_get)s' % locals())
+ LOG.debug('%(flag)s : %(flag_get)s' %
+ {'flag': flag, 'flag_get': flag_get})
try:
_launcher.wait()
except KeyboardInterrupt:
d1str = str(d1)
d2str = str(d2)
base_msg = ('Dictionaries do not match. %(msg)s d1: %(d1str)s '
- 'd2: %(d2str)s' % locals())
+ 'd2: %(d2str)s' %
+ {'msg': msg, 'd1str': d1str, 'd2str': d2str})
raise AssertionError(base_msg)
d1keys = set(d1.keys())
d1only = d1keys - d2keys
d2only = d2keys - d1keys
raise_assertion('Keys in d1 and not d2: %(d1only)s. '
- 'Keys in d2 and not d1: %(d2only)s' % locals())
+ 'Keys in d2 and not d1: %(d2only)s' %
+ {'d1only': d1only, 'd2only': d2only})
for key in d1keys:
d1value = d1[key]
continue
elif d1value != d2value:
raise_assertion("d1['%(key)s']=%(d1value)s != "
- "d2['%(key)s']=%(d2value)s" % locals())
+ "d2['%(key)s']=%(d2value)s" %
+ {
+ 'key': key,
+ 'd1value': d1value,
+ 'd2value': d2value,
+ })
def assertDictListMatch(self, L1, L2, approx_equal=False, tolerance=0.001):
"""Assert a list of dicts are equivalent."""
L1str = str(L1)
L2str = str(L2)
base_msg = ('List of dictionaries do not match: %(msg)s '
- 'L1: %(L1str)s L2: %(L2str)s' % locals())
+ 'L1: %(L1str)s L2: %(L2str)s' %
+ {'msg': msg, 'L1str': L1str, 'L2str': L2str})
raise AssertionError(base_msg)
L1count = len(L1)
L2count = len(L2)
if L1count != L2count:
raise_assertion('Length mismatch: len(L1)=%(L1count)d != '
- 'len(L2)=%(L2count)d' % locals())
+ 'len(L2)=%(L2count)d' %
+ {'L1count': L1count, 'L2count': L2count})
for d1, d2 in zip(L1, L2):
self.assertDictMatch(d1, d2, approx_equal=approx_equal,
% if_str)
except Exception as ex:
raise exception.Error(_("Couldn't get Link Local IP of %(interface)s"
- " :%(ex)s") % locals())
+ " :%(ex)s") %
+ {'interface': interface, 'ex': ex, })
def parse_mailmap(mailmap='.mailmap'):