13 Commits

Author SHA1 Message Date
Erik Olof Gunnar Andersson
68fc28527a pyupgrade changes for Python3.8+
Result of running

$ pyupgrade --py38-plus $(git ls-files | grep ".py$")

This was inspired by Nova [1] and Octavia [2]

Fixed PEP8 errors introduced by pyupgrade by running:

$ autopep8 --select=E127,E128,E501 --max-line-length 79 -r \
  --in-place designate

and manual updates.

[1]: https://review.opendev.org/c/openstack/nova/+/896986
[2]: https://review.opendev.org/c/openstack/octavia/+/899263

Change-Id: Idfa757d7ba238012db116fdb3e98cc7c5ff4b169
2023-11-03 11:19:07 +00:00
Michael Johnson
0e16095a80 Enable H306 check and fix import ordering
To better align with other OpenStack projects and to reduce the
ongoing problem with duplicate imports, this patch re-enables the
H306 check for proper module import order.

Change-Id: Iced92590829f6d9177d64ad4868aebe6eafd6a8a
2021-11-18 00:30:05 +00:00
Andreas Jaeger
2e3d8ab80d Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found.

Update local hacking checks for new flake8.

# to unbreak gate:
Depends-on: https://review.opendev.org/715835

Change-Id: Icc2f4368cc90689d74510ce36fe77d2346aec625
2020-04-01 21:52:38 +00:00
Graham Hayes
1b0119797f Move pep8 checks to py3 by default
Change-Id: I0964970c1590658754ea59b394835dc1472b7292
2018-04-04 15:37:20 +01:00
Erik Olof Gunnar Andersson
6ad30a39e6 Remove translation of log messages
* Removed all log translation.
* Always lazy-load logging.
* Fixed broken log lines and updated tests.

Logs should no longer be translated (starting with Pike)[1].

Also, according to OpenStack Guideline[2], logged string message should be
interpolated by the logger.

[1]: http://lists.openstack.org/pipermail/openstack-dev/2017-March/thread.html#113365
[2]: https://docs.openstack.org/oslo.i18n/latest/user/guidelines.html#adding-variables-to-log-messages

Change-Id: I07825694f173a8bebd7d62ade089c38d3c666283
2018-03-14 12:54:05 -07:00
Luong Anh Tuan
e5cb2569a6 Using sys.exit(main()) instead of main()
TrivialFix: Similar [1] in Kolla project
As we known, Exceptions are raised by the sys.exit() function. When they
are not handled, no stack traceback is printed in the Python interpreter.
Therefore, when using sys.exit(main()) instead of main()
may be more readable and reasonable.

[1] https://review.openstack.org/#/c/349353/

Change-Id: Ied52a7631da82a72f0dcf2fc9ed81840d24041d9
2016-09-26 03:23:44 +00:00
sonu.kumar
c7eca3fbd8 Another improvement of info level log messages
String interpolation should be delayed to be handled by the
logging code, rather than being done at the point of the
logging call.

So we should use-

LOG.info(_LI('some message: variable=%s'), variable)

instead of

LOG.info(_LI('some message: variable=%s') % variable)
Reference: http://docs.openstack.org/developer/oslo.i18n/guidelines.html

Change-Id: I409358d9e35813f1875993b96fce86a0e2bc940b
2015-11-27 13:15:03 +05:30
Kiall Mac Innes
9552ccc2c9 Switchover to oslo.i18n package
Change-Id: I18d9a21b75053d382fb5bbebba226eda4c174f0c
2014-07-24 14:47:44 -07:00
Jordan Cazamias
50295fb39e Fix style errors H305 and H307
H305: Imports not grouped correctly
H307: Like imports should be grouped together

Change-Id: Ic63d253e015298c7b952121a4b3634d2b1bdaf92
Implements: blueprint new-hacking-style-rules
2014-06-18 17:35:43 -05:00
Jordan Cazamias
cad8ab8785 Update hacking package, fix I18n style issues
Hacking package updated from '>=0.8.0,<0.9' to '>=0.9.2,<0.10'.
Many new style rules have been added, some of which Designate violates.
Only the style rules that pertain to I18n have been addressed.
The rest have been added to the ignore list in tox.ini for further review.

Change-Id: I5c559c491ff9bee2346b1589e7bb7e117137609b
Implements: blueprint standardize-logging
Closes-Bug: bug #1330540
2014-06-18 14:41:11 -05:00
Jordan Cazamias
a0d9b4cac6 Change log statements to meet I18n guidelines
Change-Id: Id76bcb71369302a559d2c2c5bd6046dff05a488e
Implements: blueprint standardize-logging
2014-06-11 17:08:45 -05:00
Kiall Mac Innes
517ec9531a Correct misspelled words
Change-Id: I7f98cd32ecd64e49d2fd7376ce5f4b6df9fe6ff9
Closes-Bug: 1257295
2014-02-20 16:20:58 +00:00
Artom Lifshitz
179a9aa265 Zoneextractor tool
zoneextractor.py helps on the client-side of the new zone
import API. It takes a BIND9 named.conf and writes out or prints a
zonefile for every configured master zone. Said zonefile can then be
curled or otherwise submitted to the zonefile import API.

Change-Id: Ibc15639771da52e678be067ec4474bcbcc2f0865
2013-10-24 09:40:53 -04:00