diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9d945567450344fa94ec9e6280095e86a6c532b0 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,35 @@ +# We from the Oslo project decided to pin repos based on the +# commit hash instead of the version tag to prevend arbitrary +# code from running in developer's machines. To update to a +# newer version, run `pre-commit autoupdate` and then replace +# the newer versions with their commit hash. + +default_language_version: + python: python3 + +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: ebc15addedad713c86ef18ae9632c88e187dd0af # v3.1.0 + hooks: + - id: trailing-whitespace + # Replaces or checks mixed line ending + - id: mixed-line-ending + args: ['--fix', 'lf'] + exclude: '.*\.(svg)$' + # Forbid files which have a UTF-8 byte-order marker + - id: check-byte-order-marker + # Checks that non-binary executables have a proper shebang + - id: check-executables-have-shebangs + # Check for files that contain merge conflict strings. + - id: check-merge-conflict + # Check for debugger imports and py37+ breakpoint() + # calls in python source + - id: debug-statements + - id: check-yaml + files: .*\.(yaml|yml)$ + - repo: https://gitlab.com/pycqa/flake8 + rev: 181bb46098dddf7e2d45319ea654b4b4d58c2840 # 3.8.3 + hooks: + - id: flake8 + additional_dependencies: + - hacking>=3.0.1,<3.1.0 diff --git a/.zuul.yaml b/.zuul.yaml index 2c16442284303ff92d54a7f0014cd3c82e757b01..842503010e8067207e14a591251da141657d69b2 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -2,8 +2,7 @@ templates: - check-requirements - lib-forward-testing-python3 - - openstack-lower-constraints-jobs - - openstack-python3-victoria-jobs + - openstack-python3-wallaby-jobs - periodic-stable-jobs - publish-openstack-docs-pti - release-notes-jobs-python3 diff --git a/doc/source/conf.py b/doc/source/conf.py index cdfe73395905fc755029c337102e524cf2079538..3e96e805125c287a18fb3b727dbfa48d0df7d437 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2020 Red Hat, Inc. +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -77,6 +79,3 @@ latex_documents = [ u'%s Documentation' % project, u'OpenStack Foundation', 'manual'), ] - -# Example configuration for intersphinx: refer to the Python standard library. -#intersphinx_mapping = {'http://docs.python.org/': None} diff --git a/oslo_service/__init__.py b/oslo_service/__init__.py index 0c3807e0e301acd95adb840733135a57b6facacd..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/oslo_service/__init__.py +++ b/oslo_service/__init__.py @@ -1,33 +0,0 @@ -# Licensed under the Apache License, Version 2.0 (the "License"); you may -# not use this file except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. - -import os - -import eventlet.patcher - - -time = eventlet.patcher.original('time') - - -def service_hub(): - # NOTE(dims): Add a custom impl for EVENTLET_HUB, so we can - # override the clock used in the eventlet hubs. The default - # uses time.time() and we need to use a monotonic timer - # to ensure that things like loopingcall work properly. - hub = eventlet.hubs.get_default_hub().Hub() - hub.clock = time.monotonic - # get_default_hub() will return a hub that is supported on this platform - hub.is_available = lambda: True - return hub - - -os.environ['EVENTLET_HUB'] = 'oslo_service:service_hub' diff --git a/oslo_service/tests/test_service.py b/oslo_service/tests/test_service.py index 4aeff45682acdc97a4213afa410022d973b62e1e..58be122b82e041e6fc7e046498f26f4adf0be6e5 100644 --- a/oslo_service/tests/test_service.py +++ b/oslo_service/tests/test_service.py @@ -164,8 +164,8 @@ class ServiceLauncherTest(ServiceTestBase): # Skip ps header f.readline() - processes = [tuple(int(p) for p in l.strip().split()[:2]) - for l in f] + processes = [tuple(int(p) for p in line.strip().split()[:2]) + for line in f] return [p for p, pp in processes if pp == self.pid] def test_killed_worker_recover(self): diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 1b29268e4d044e1b1f8ace5b4ce4fb703c361a9d..dd1993fb86b5b3b5725a6a755e5cc46c4fbcf536 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -1,4 +1,6 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2020 Red Hat, Inc. +# # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/releasenotes/source/index.rst b/releasenotes/source/index.rst index 88413b6eb7b408b9ba9bae11ec727c8f020627b7..05123c9a74d1822fe2b51758e1956bc92f28203f 100644 --- a/releasenotes/source/index.rst +++ b/releasenotes/source/index.rst @@ -6,6 +6,7 @@ :maxdepth: 1 unreleased + victoria ussuri train stein diff --git a/releasenotes/source/victoria.rst b/releasenotes/source/victoria.rst new file mode 100644 index 0000000000000000000000000000000000000000..4efc7b6f3b1117aae27fed2a9a8a9f7cadc7af8b --- /dev/null +++ b/releasenotes/source/victoria.rst @@ -0,0 +1,6 @@ +============================= +Victoria Series Release Notes +============================= + +.. release-notes:: + :branch: stable/victoria diff --git a/test-requirements.txt b/test-requirements.txt index 10805d3337c24563b43293e2f4758040f0d6e846..b1a1b5747fff970188ce04232b4553094fcc864b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -14,3 +14,5 @@ coverage!=4.4,>=4.0 # Apache-2.0 # Bandit security code scanner bandit>=1.6.0,<1.7.0 # Apache-2.0 + +pre-commit>=2.6.0 # MIT diff --git a/tox.ini b/tox.ini index e029fb6ee123501f726ecb1353f80193add9b4af..2e1e2e34d4fe34f2f74910591cbdf016037425e3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,6 +1,6 @@ [tox] minversion = 3.2.0 -envlist = py38,pep8,bandit +envlist = py3,pep8,bandit ignore_basepython_conflict = true [testenv] @@ -10,7 +10,7 @@ setenv = BRANCH_NAME=master CLIENT_NAME=oslo.service deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/doc/requirements.txt -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt @@ -21,7 +21,7 @@ commands = [testenv:pep8] commands = - flake8 + pre-commit run -a bandit -r oslo_service -n5 -x tests doc8 --ignore-path "doc/source/history.rst" doc/source @@ -54,7 +54,7 @@ commands = oslo_debug_helper -t oslo_service/tests {posargs} [testenv:bandit] deps = - -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} + -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/test-requirements.txt -r{toxinidir}/requirements.txt commands = bandit -r oslo_service -n5 -x tests {posargs}