Commit Graph

17 Commits

Author SHA1 Message Date
Zhao Chao 2fd8c66f64 Remove log translations
According to discussions on the ML, log messages should not be
translated any more. This patch also:
* removes all usage of _LI, _LW, _LE, _LC;
* updates log translation hacking rule.

ML discussions:
http://lists.openstack.org/pipermail/openstack-i18n/2016-November/002574.html
http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html

The original commit messages are kept as following to make a historic
note:

remove unwanted log translations

recent discussions on the ML have led to the decision to eliminate all
translations for messages that are destined for log files but retain
them for messages that are going to be returned as exceptions and
potentially shown to end users via an API. see [1], [2].

This change does that as follows.

1. If a string is being used to generate an exception, it will still
be translated. Still Trove used both _LE and _ for these translations,
there are some cases where _LE has been simply changed to _, and not
removed.

2. If a string is used for a logging message, remove the use of _,
_LE, _LW, _LI.

Also, I have long felt that we have had a creep of checks in the pep8
tests that apparently make the code easier to read. I strongly believe
that these kinds of "easier to read" things make sense if they are
followed across all projects and not just gratuitously added one
project at a time.

I've taken this opportunity to reduce the merge mess caused by this
change, to sync up our ignore flags with a long list of ignores from
Nova. When they made the change for removing log translation, they
could do it in an automated-way like I have because they didn't have
to deal with under and overindented lines for visual edit (E127). Same
for Cinder.

Changes 448443 [3] and 447839 [4] were inadequate because they only
addressed a little part of the problem, namely removing the use of
_LE, _LI, and _LW, and I think this is a change we don't need to
dribble in a few files at a time. The changes are straightforward and
should be taken in a single lump to make it easy to deal with the
merges coming.

[1] http://lists.openstack.org/pipermail/openstack-operators/2017-March/012887.html
[2] http://lists.openstack.org/pipermail/openstack-dev/2017-March/113365.html
[3] https://review.openstack.org/448443
[4] https://review.openstack.org/447839

Co-Authored-By: Amrith Kumar <amrith@amrith.org>
Co-Authored-By: Valencia Serrao <vserrao@us.ibm.com>
Change-Id: I5f86c982469e625997fc8bd15c6fae0fc77a8c64
2018-01-24 17:21:26 +00:00
Zhao Chao 08ea56b21c Fix api exception with unicode tenant name.
There are a lot request debug logging in Trove, when some values of
headers are encoded in utf8, UnicodeEncodeError will be raised by
webob.Request. Override how webob.Request is represented will fix.

Closes-Bug: #1720121

Change-Id: I91683b8dd24262b0f643e8d2bc7886a7c03be40a
Signed-off-by: Zhao Chao <zhaochao1984@gmail.com>
2018-01-23 20:06:40 +08:00
Gábor Antal ded64b45c6 Handle log message interpolation by the logger in common/
According to OpenStack Guideline[1], logged string message should be
interpolated by the logger.

[1]: http://docs.openstack.org/developer/oslo.i18n/guidelines.html#adding-variables-to-log-messages

Change-Id: I946422e662b5efc453bfe76f3631ece1716dbb4c
Related-Bug: #1642552
2017-05-31 11:37:25 +00:00
Victor Stinner 74e2aaabe5 Python 3: fix relative imports
On Python 3, imports are absolute by default. By default, OpenStack
coding style requires to use relative imports.

Fix imports two use the full "path" to relative imports.

Partially implements: blueprint trove-python3
Change-Id: I2866fdc1a39fb3a20d8384a4082ca468b57d92d3
2016-04-20 15:33:46 +02:00
Sergey Vilgelm 19862628e4 Switch to the oslo_log library
Remove the log module of oslo-incubator.
Move the WritableLogger wrapper to the base_wsgi module.
Add oslo.log to the requirements.

Change-Id: I724fa6090cebf40e7d7c78cc6b8458dfba9508a8
2015-07-23 19:31:58 +03:00
Sushil Kumar 843bb0cd53 Fixes hacking rules
This patchset helps reducing the ignored pep8 errors.

Fixed some ignored hacking rules, as listed follows:
- E111 indentation is not a multiple of four
- E122 continuation line missing indentation or outdented
- E123 closing bracket does not match indentation of opening bracket's line
- E128 continuation line under-indented for visual indent
- E251 unexpected spaces around keyword / parameter equals
- E265 block comment should start with '# '
- E713 test for membership should be 'not in'
- H105  Don't use author tags
- H306  imports not in alphabetical order

Change-Id: Iadf2af4f6ec90420153ad63b5a41650392ef2cbd
2015-05-29 07:27:59 +00:00
Amrith Kumar 5f370b5f74 Error message missing tenant id
The code just doesn't render the string correctly, adding the tenant
id. Also, since this is a message that causes us to throw an
exception, I've changed it from LOG.debug to LOG.error.

Change-Id: Iafd5ba3cf12df9c60c491d39677231eee8be0a42
Closes-Bug: #1459067
2015-05-26 22:03:46 -04:00
Doug Hellmann 3ce4756d2c Drop use of 'oslo' namespace package
The Oslo libraries have moved all of their code out of the 'oslo'
namespace package into per-library packages. The namespace package was
retained during kilo for backwards compatibility, but will be removed by
the liberty-2 milestone. This change removes the use of the namespace
package, replacing it with the new package names.

The patches in the libraries will be put on hold until application
patches have landed, or L2, whichever comes first. At that point, new
versions of the libraries without namespace packages will be released as
a major version update.

Please merge this patch, or an equivalent, before L2 to avoid problems
with those library releases.

Blueprint: remove-namespace-packages
https://blueprints.launchpad.net/oslo-incubator/+spec/remove-namespace-packages

Change-Id: I9d3e80d94795060d375aae30ce249513aae3fd97
2015-05-06 20:01:57 +00:00
Amrith Kumar 6ea94c4bf7 resync oslo-incubator code
This commit syncs the following oslo incubator modules used by Trove
and all dependent changes.

__init__.py

6b048e79 Let oslotest manage the six.move setting for mox

context.py

411ba356 Simplify is_user_context method
9b73877b Add a RequestContext.from_dict method
85d1ce6e Python 3: enable tests/unit/middleware/test_request_id.py
c0d357bb Add model_query() to db.sqlalchemy.utils module

eventlet_backdoor.py

a3220c51 add list_opts to all modules with configuration options
5d40e143 Remove code that moved to oslo.i18n
90ae24bf Remove redundant default=None for config options
fcf517d7 Update oslo log messages with translation domains
ad17a697 Fix filter() usage due to python 3 compability
8b2b0b74 Use hacking import_exceptions for gettextutils._
12bcdb71 Remove vim header

log.py

943cb94a Merge "Make use_syslog=True log to syslog via /dev/log"
8345204c Merge "add list_opts to all modules with configuration options"
ac4330dd Make use_syslog=True log to syslog via /dev/log
df774ff4 Import PublishErrorsHandler from oslo.messaging
a3220c51 add list_opts to all modules with configuration options
6c706c5c Delete graduated serialization files
5d40e143 Remove code that moved to oslo.i18n
6ff6b4b4 Switch oslo-incubator to use oslo.utils and remove old modules
aa744115 log: add missing space in error message
037dee00 Set stevedore log level to WARN by default
759bd879 Merge "Set keystonemiddleware and routes.middleware to log on WARN level"
71d072f1 Merge "Except socket.error if syslog isn't running"
37c00918 Add unicode coercion of logged messages to ContextFormatter
66144135 Correct coercion of logged message to unicode

loopingcall.py

5d40e143 Remove code that moved to oslo.i18n
e3773930 Changes calcuation of variable delay
ab5d5f1c Use timestamp in loopingcall
bc48099a Log the function name of looping call
fb4e863c Remove deprecated LoopingCall
fcf517d7 Update oslo log messages with translation domains
8b2b0b74 Use hacking import_exceptions for gettextutils._
12bcdb71 Remove vim header

service.py

5d40e143 Remove code that moved to oslo.i18n
6ede600f rpc, notifier: remove deprecated modules

threadgroup.py

1523f000 threadgroup: don't log GreenletExit
5a1a0166 Make stop_timers() method public
fdc88831 Add graceful stop function to ThreadGroup.stop
5f8ace05 Merge "threadgroup: use threading rather than greenthread"
2d06d6ca Simple typo correction
4d18b57a threadgroup: use threading rather than greenthread
25ff65e9 Make wait & stop methods work on all threads
12bcdb71 Remove vim header
9d3c34b5 Add a link method to Thread

versionutils.py

5d40e143 Remove code that moved to oslo.i18n
1c3ecfcd Enhance versionutils.deprecated to work with classes
7d42c107 Merge "Add Kilo release name to versionutils"
9a462718 Add Kilo release name to versionutils
a2ad3a25 Allow deprecated decorator to specify no plan for removal
05ae498b Add JUNO as a target to versionutils module
de4adbc4 pep8: fixed multiple violations

Closes-Bug: #1366189
Change-Id: I2289452a9b838e22bb6d4dd1a854fbeb326042d2
2015-02-03 23:26:05 +00:00
Amrith Kumar 3e56c2177b Obsolete oslo-incubator modules - gettextutils (now oslo.i18n)
This change is part of a multi-part change set to handle obsolete and
graduated oslo modules. This commit handles the gettextutils module
which is now oslo.i18n. The change here is to remove it from
openstack-common.conf and point all people who used to use that at
oslo.i18n. requirements.txt has been updated to point to this
dependency.

We aren't deleting gettextutils.py from openstack/common because it is
used by other oslo-incubator modules.

This change has been rebased on https://review.openstack.org/#/c/129668/

Change-Id: I39fd288fb29a8317f896812a2f64bcd69a6b8e21
Partial-Bug: #1380789
blueprint: retire-unused-oslo-incubator-modules
2014-12-25 15:10:42 +00:00
Christian Berendt 6d051af5d9 debug level logs should not be translated
According to the OpenStack translation policy available at
https://wiki.openstack.org/wiki/LoggingStandards debug messages
should not be translated. Like mentioned in several changes in
Nova by garyk this is to help prioritize log translation.

Change-Id: Ia38a426a1a3154302b19f2dc603487175566c863
Closes-Bug: #1318384
2014-05-21 10:46:24 +02:00
He Yongli 52db0a385a Remove extraneous vim configuration comments
Remove vim setting, Remove line containing:
comment - # vim: tabstop=4 shiftwidth=4 softtabstop=4

at the top of source code files, except for files in
openstack/common.

Change-Id: I5e2aad6dca8407890fc3c2afbda541bd4f124ea8
Closes-Bug: #1229324
2014-02-27 15:05:21 +08:00
Khyati Sheth a65dcdd952 Mask database user's password in trove logs
Currently passwords are logged in plaintext in trove-api and
trove-taskmanager logs. This fix will mask the passwords in the logs.
Syncing modules log, common.py from rpc  and versionutils from oslo.
common.py requires versionutils.py.

Change-Id:I50deb003d866e85e7c7ec8ab3ce7248d1c005e57
Closes-Bug: #1254914
2014-01-21 12:18:27 -08:00
Sushil Kumar 5aaac4c6fa Removes unused import statements
Updates tox.ini to remove suppressed F401 standard.

Updates the code files containing unused import statements

Change-Id: Ib44bd1509fdb17f457a205f9e62caf85cebee830
Closes-Bug: #1257267
2013-12-03 19:22:40 +00:00
Denis M cd2230d2c9 PEP8 rules. H102,103,201
Implements: blueprint reduce-amount-of-pep8-ignored-rules-in-tox-tests
Change-Id: Ia199e891148dcf3a88d9e179c09917fac7906e59
2013-09-17 11:21:19 +03:00
Dirk Mueller b71ca1334b Do not use locals() for string formatting
Fix all occurrences of H501 of Hacking 0.7.x so that
the check can be enabled later for gating.

Change-Id: Ib193e4923349fd7d8e6015989642c3fbc4ae345e
2013-09-07 10:26:43 +02:00
Michael Basnight 7ab80b554d Rename from reddwarf to trove.
Implements Blueprint reddwarf-trove-rename

Change-Id: Ia9ee609bbc06a1d8b9d6917642529f30347541fd
2013-06-24 14:11:15 -07:00