Commit Graph

15 Commits

Author SHA1 Message Date
Brian Haley eaf990b2bc Fix pep8 E128 warnings in non-test code
Reduces E128 warnings by ~260 to just ~900,
no way we're getting rid of all of them at once (or ever).
Files under neutron/tests still have a ton of E128 warnings.

Change-Id: I9137150ccf129bf443e33428267cd4bc9c323b54
Co-Authored-By: Akihiro Motoki <amotoki@gmail.com>
2019-03-12 21:22:33 +00:00
Brian Haley bc4f93c232 Fix best_match() deprecation warning
wsgi call to best_match() generates the following warning:

DeprecationWarning: The behavior of AcceptValidHeader.best_match
is currently being maintained for backward compatibility, but it
will be deprecated in the future, as it does not conform to the RFC.

Change to use acceptable_offers() as was done in nova code.

Simlar changes in the wsgi best language code as well, except
new call is to lookup().

Required bump to get WebOb 1.8.2.

Trivialfix

Change-Id: I45a222c098658eef6a49adcc168b0f5625ea49db
2018-10-03 19:30:40 +00:00
Boden R 0e25b403a5 use FAULT_MAP from neutron-lib
Idfd956fa213e1ba6c3b1c983f246c5b515951e6d rehomed the FAULT_MAP into
neutron-lib. This patch consumes it from lib and removes its definition
from neutron.

NeutronLibImpact

Change-Id: Ib051555ea8496ed7eec8ed30733c964012e31c32
2017-11-02 12:16:31 -06:00
Inessa Vasilevskaya 7322bd6efb Make code follow log translation guideline
Since Pike log messages should not be translated.
This patch removes calls to i18n _LC, _LI, _LE, _LW from
logging logic throughout the code. Translators definition
from neutron._i18n is removed as well.
This patch also removes log translation verification from
ignore directive in tox.ini.

Change-Id: If9aa76fcf121c0e61a7c08088006c5873faee56e
2017-08-14 02:01:48 +00:00
Kevin Benton a1c194cf06 Make exception translation common and add to pecan
This moves the exception translation logic from the
legacy api.v2.resource module to a common module and
re-uses it from pecan to bring consistency to the
way language and exception translation is handled
between the two.

This also adjusts the policy enforcement hook to correctly
handle the unsupported method case since 'after' hooks
are executed after 'on_error' hooks that return an exception.

Closes-Bug: #1583844
Change-Id: If3c2d8c94ca6c1615f3b909accf0f718e320d1c2
2016-05-13 20:23:43 -07:00
Gary Kotton d2630f2dd4 Pecan: remove deprecation warning
Addresses the warning below:

DeprecationWarning: BaseException.message has been deprecated as of Python 2.6

Change-Id: I1aaebb28c3c9ca2ede9e900428fb5c7eef6d29e6
Closes-bug: #1582522
2016-05-18 08:41:02 +00:00
Kevin Benton 19348ecd6e Pecan: skip all notifications on failures
If there was a bad status code, none of the notification
logic should attempt to process. A bad status code means
that the assumptions the notification code makes about
original resources being present may not be true.

This also fixes the exception translator so the correct
status code is set by the hook on exceptions that have
a fault map entry.

Closes-Bug: #1557516
Change-Id: Ibff419e7caa6de422f04eb1e43fd2aed304bdd97
2016-05-09 08:20:57 +00:00
Kevin Benton e433c2870a Add metrics notifier to Pecan
This adds the standard 'object.(create|update|delete).(start|end)'
notifications to the Pecan notification hook and adds unit tests
to exercise them.

This patch also corrects the on_error handler for untranslated
exceptions which was incorrectly raising the exception rather than
returning it. This was resulting in the other hooks not getting
the correct status code on an untranslated exception.

Closes-Bug: #1552979
Change-Id: I400f8d3988db204caed25e7c848a415b45d47172
2016-03-11 15:47:11 -08:00
Gary Kotton 1548f1bb73 Translations: use neutron._18n instead of neutron.18n
The neutron.18n import will be deprecated. In addition to this
this removes deprecation warnings.

TrivialFix

Change-Id: I3daf14fe317e28c18d00af56f4f4e4a41d103361
2016-02-28 04:37:17 -08:00
Jenkins 134299bedd Merge "HACKING: fix edge case with log hints" 2015-12-07 18:24:18 +00:00
Akihiro Motoki 2d8632e412 Use _ from neutron._i18n
Partial-Bug: #1520094
Change-Id: I874a4aa1d71d1f7034a1ff0b7450b419ef5c6864
2015-12-06 19:39:04 +09:00
Gary Kotton 0ce4510b35 HACKING: fix edge case with log hints
A log message with _() was not raised as an error, for example:
LOG.info(_('who let the dogs out!')).

This should be:
LOG.info(_LI('who who who who!'))

Change-Id: I040f01b19ff5de00467b80be7399b998534d9a57
Closes-bug: #1522054
2015-12-02 06:52:25 -08:00
JuPing 6364ce646e Fix the bug of "Spelling error of a word"
The word "occured" should be spelled as "occurred".
So it is changed.

Change-Id: Ice5212dc8565edb0c5b5c55f979b27440eeeb9aa
Closes-Bug: #1505043
2015-10-12 17:21:08 +08:00
Kevin Benton 3cf7838344 Log exception.msg before exception.message
The exception translation hook was logging the exception messages
before variables were interpolated, making it really unhelpful.
This patch corrects that and falls back to e.message if e.msg isn't
available.

Change-Id: I331444d577b03257db2fcc96324d020eff9bef08
2015-09-15 11:58:21 -07:00
Kevin Benton be9bff66be Rename 'newapi' to 'pecan_wsgi'
'newapi' was too generic and not really descriptive of the conversion
to pecan. Since there isn't any ambiguity, we will just keep all of
the pecan components in a directory called 'pecan_wsgi'.

Change-Id: I61f1cfcad4ff00582e0a481400642dd656d5245e
2015-09-02 15:53:34 +00:00