← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1514193] [NEW] misuse of log marker functions in neutron

 

Public bug reported:

ref http://docs.openstack.org/developer/oslo.i18n/guidelines.html

" The log marker functions (_LI(), _LW(), _LE(), and _LC()) must only be used when the message is only sent directly to the log. Anytime that the message will be passed outside of the current context (for example as part of an exception) the _() marker function must be used.
 "

and http://docs.openstack.org/developer/oslo.i18n/usage.html

" 
except AnException1:

    # Log only
    LOG.exception(_LE('exception message'))

except AnException2:

    # Raise only
    raise RuntimeError(_('exception message'))

else:

    # Log and Raise
    msg = _('Unexpected error message')
    LOG.exception(msg)
    raise RuntimeError(msg)
"

there several misuses in neutron code now, 
https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
https://github.com/openstack/neutron/blob/master/neutron/agent/linux/iptables_manager.py#L406
...

** Affects: neutron
     Importance: Undecided
         Status: New


** Tags: logging

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1514193

Title:
  misuse of log marker functions in neutron

Status in neutron:
  New

Bug description:
  ref http://docs.openstack.org/developer/oslo.i18n/guidelines.html

  " The log marker functions (_LI(), _LW(), _LE(), and _LC()) must only be used when the message is only sent directly to the log. Anytime that the message will be passed outside of the current context (for example as part of an exception) the _() marker function must be used.
   "

  and http://docs.openstack.org/developer/oslo.i18n/usage.html

  " 
  except AnException1:

      # Log only
      LOG.exception(_LE('exception message'))

  except AnException2:

      # Raise only
      raise RuntimeError(_('exception message'))

  else:

      # Log and Raise
      msg = _('Unexpected error message')
      LOG.exception(msg)
      raise RuntimeError(msg)
  "

  there several misuses in neutron code now, 
  https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
  https://github.com/openstack/neutron/blob/master/neutron/agent/ovsdb/native/commands.py#L334
  https://github.com/openstack/neutron/blob/master/neutron/agent/linux/iptables_manager.py#L406
  ...

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1514193/+subscriptions


Follow ups