Keep pre-commit inline with hacking and fix whitespace

The flake8 hook for pre-commit installs its own flake8 which is
not what hacking is pinned to. This results in a bunch of errors.
By doing a local hook we can cause these to be the same.

There are flake8 exclusions in tox.ini that need to be used
in pre-commit. Also we should exclude svg files from the whitespace
modifications, because who cares.

Once those are fixed, running pre-commit -a fixes some whitespace
issues. While the normal use isn't to run -a - if someone does make
a patch that touches any of these they'll get erroneous unrelated
errors compared to their lower work - so fix all of the existing
issues, which are mostly space-at-end-of-line issues it seems.

Change-Id: I78e753492e99c03b30a0a691db3bd75ee3d289c9
This commit is contained in:
Monty Taylor 2019-08-01 10:44:08 -04:00 committed by Stephen Finucane
parent 2e7a0088c2
commit e7cc5efd20
12 changed files with 81 additions and 70 deletions

View File

@ -6,16 +6,27 @@ repos:
- id: trailing-whitespace
- id: mixed-line-ending
args: ['--fix', 'lf']
exclude: '.*\.(svg)$'
- id: check-byte-order-marker
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: debug-statements
- id: flake8
additional_dependencies:
- hacking>=1.1.0,<1.2.0
# nova/cmd/manage.py imports pdb on purpose.
exclude: 'nova/cmd/manage.py'
- id: check-yaml
files: .*\.(yaml|yml)$
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
hooks:
- id: remove-tabs
exclude: '.*\.(svg)$'
- repo: local
hooks:
- id: flake8
name: flake8
additional_dependencies:
- hacking>=1.1.0,<1.2.0
language: python
entry: flake8
files: '^.*\.py$'
exclude: '^(doc|releasenotes|tools)/.*$'

View File

@ -103,7 +103,7 @@ Response
- name: image_name
- minRam: minRam_body
- minDisk: minDisk_body
- metadata: metadata_object
- metadata: metadata_object
- created: created
- updated: updated
- status: image_status
@ -147,7 +147,7 @@ Response
- name: image_name
- minRam: minRam_body
- minDisk: minDisk_body
- metadata: metadata_object
- metadata: metadata_object
- created: created
- updated: updated
- status: image_status
@ -208,7 +208,7 @@ Response
.. rest_parameters:: parameters.yaml
- metadata: metadata_object
- metadata: metadata_object
**Example List Image Metadata Details: JSON response**
@ -233,7 +233,7 @@ Request
.. rest_parameters:: parameters.yaml
- image_id: image_id
- metadata: metadata_object
- metadata: metadata_object
**Example Create Image Metadata: JSON request**
@ -245,7 +245,7 @@ Response
.. rest_parameters:: parameters.yaml
- metadata: metadata_object
- metadata: metadata_object
**Example Create Image Metadata: JSON response**
@ -270,7 +270,7 @@ Request
.. rest_parameters:: parameters.yaml
- image_id: image_id
- metadata: metadata_object
- metadata: metadata_object
**Example Update Image Metadata: JSON request**
@ -282,7 +282,7 @@ Response
.. rest_parameters:: parameters.yaml
- metadata: metadata_object
- metadata: metadata_object
**Example Update Image Metadata: JSON response**

View File

@ -86,7 +86,7 @@ can change these permissions through the ``policy.json`` file.
Normal response codes: 200
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
itemNotFound(404)
Request
@ -131,7 +131,7 @@ can change these permissions through the ``policy.json`` file.
Normal response codes: 200
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
Error response codes: badRequest(400), unauthorized(401), forbidden(403),
itemNotFound(404)
Request

View File

@ -50,7 +50,7 @@ Response
- displayDescription: display_description
- displayName: display_name
- id: volume_id_resp
- metadata: metadata_object
- metadata: metadata_object
- size: size
- snapshotId: snapshot_id
- status: volume_status
@ -110,7 +110,7 @@ Response
- displayName: display_name
- displayDescription: display_description
- id: volume_id_resp
- metadata: metadata_object
- metadata: metadata_object
- size: size
- snapshotId: snapshot_id
- status: volume_status
@ -158,7 +158,7 @@ Response
- displayName: display_name
- displayDescription: display_description
- id: volume_id_resp
- metadata: metadata_object
- metadata: metadata_object
- size: size
- snapshotId: snapshot_id
- status: volume_status
@ -205,7 +205,7 @@ Response
- displayName: display_name
- displayDescription: display_description
- id: volume_id_resp
- metadata: metadata_object
- metadata: metadata_object
- size: size
- snapshotId: snapshot_id
- status: volume_status

View File

@ -28,9 +28,9 @@ in the long-running code path. The sleep call will trigger a context switch
if there are pending threads, and using an argument of 0 will avoid introducing
delays in the case that there is only a single green thread::
from eventlet import greenthread
...
greenthread.sleep(0)
from eventlet import greenthread
...
greenthread.sleep(0)
In current code, time.sleep(0) does the same thing as greenthread.sleep(0) if
time module is patched through eventlet.monkey_patch(). To be explicit, we recommend

View File

@ -5,16 +5,16 @@ repository_id=nova
# The name of the database table used to track the schema version.
# This name shouldn't already be used by your project.
# If this is changed once a database is under version control, you'll need to
# change the table name in each database too.
# If this is changed once a database is under version control, you'll need to
# change the table name in each database too.
version_table=migrate_version
# When committing a change script, Migrate will attempt to generate the
# When committing a change script, Migrate will attempt to generate the
# sql for all supported databases; normally, if one of them fails - probably
# because you don't have that database installed - it is ignored and the
# commit continues, perhaps ending successfully.
# Databases in this list MUST compile successfully during a commit, or the
# entire commit will fail. List the databases your application will actually
# because you don't have that database installed - it is ignored and the
# commit continues, perhaps ending successfully.
# Databases in this list MUST compile successfully during a commit, or the
# entire commit will fail. List the databases your application will actually
# be using to ensure your updates to that database work properly.
# This must be a list; example: ['postgres','sqlite']
required_dbs=[]

View File

@ -36,7 +36,7 @@ How to test Boot from volume in Hyper-V from the OpenStack dashboard:
2. Get the volume ID of the created volume
3. Upload and untar to the Cloud controller the next VHD image:
http://dev.opennebula.org/attachments/download/482/ttylinux.vhd.gz
4. sudo dd if=/path/to/vhdfileofstep3
4. sudo dd if=/path/to/vhdfileofstep3
of=/dev/nova-volumes/volume-XXXXX <- Related to the ID of step 2
5. Launch an instance from any image (this is not important because we are
just booting from a volume) from the dashboard, and don't forget to select

View File

@ -2,7 +2,7 @@
upgrade:
- |
The following deprecated configuration options have been removed from the
``cinder`` section of nova.conf:
``cinder`` section of nova.conf:
- ca_certificates_file
- api_insecure

View File

@ -1,4 +1,4 @@
---
---
upgrade:
- Removed the ``security_group_api`` configuration option that was deprecated
in Mitaka. The correct security_group_api option will be chosen based on

View File

@ -55,7 +55,7 @@ Security Issues
.. releasenotes/notes/12.0.3-cve-bugs-reno-561a450b346edf5e.yaml @ b'0b194187db9da28225cb5e62be3b45aff5a1c793'
- [OSSA 2016-007] Host data leak during resize/migrate for raw-backed instances (CVE-2016-2140)
* `Bug 1548450 <https://bugs.launchpad.net/nova/+bug/1548450>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-March/001009.html>`__
@ -83,12 +83,12 @@ Security Issues
.. releasenotes/notes/12.0.1-cve-bugs-7b04b2e34a3e9a70.yaml @ b'9c3cce75de6069edca35ce5046d4ce25a11b6337'
- [OSSA 2016-001] Nova host data leak through snapshot (CVE-2015-7548)
* `Bug 1524274 <https://bugs.launchpad.net/nova/+bug/1524274>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-January/000911.html>`__
[OSSA 2016-002] Xen connection password leak in logs via StorageError (CVE-2015-8749)
* `Bug 1516765 <https://bugs.launchpad.net/nova/+bug/1516765>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-January/000916.html>`__
@ -103,7 +103,7 @@ Bug Fixes
- Fixes a bug where Nova services won't recover after a temporary DB
connection issue, when service group DB driver is used together with
local conductor, as the driver only handles RPC timeout errors.
For more info see https://bugs.launchpad.net/nova/+bug/1505471
.. releasenotes/notes/bug-1517926-ed0dda23ea525306.yaml @ b'821f644e98475d0af53f621ba13930b3dffc6e7b'
@ -113,7 +113,7 @@ Bug Fixes
remote conductor, as the driver only handles RPC timeout errors and does
not account for other types of errors (e.g. wrapped DB errors on the
remote conductor transported over RPC)
For more info see https://bugs.launchpad.net/nova/+bug/1517926

View File

@ -25,7 +25,7 @@ Security Issues
.. releasenotes/notes/bug-1673569-cve-2017-7214-2d7644b356015c93.yaml @ b'e193201fa1de5b08b29adefd8c149935c5529598'
- [CVE-2017-7214] Failed notification payload is dumped in logs with auth secrets
* `Bug 1673569 <https://bugs.launchpad.net/nova/+bug/1673569>`_
@ -46,7 +46,7 @@ Bug Fixes
legacy v2 API. With this fix, requests to create a server with
``boot_index=None`` will be treated as if ``boot_index`` was not specified,
which defaults to meaning a non-bootable block device.
.. _bug 1662699: https://bugs.launchpad.net/nova/+bug/1662699
@ -331,7 +331,7 @@ New Features
- For the VMware driver, the flavor extra specs for quotas has been extended
to support:
- quota:cpu_limit - The cpu of a virtual machine will not
exceed this limit, even if there are available resources. This is
typically used to ensure a consistent performance of virtual machines
@ -498,7 +498,7 @@ Upgrade Notes
(https://wiki.openstack.org/wiki/ReleaseNotes/Kilo#Upgrade_Notes_2) has
been completely removed in Mitaka. This has been replaced by the new
ec2-api project (http://opendev.org/openstack/ec2-api/).
.. warning:: Some installation tools (such as ``packstack``) hardcode the
value of ``enabled_apis`` in your nova.conf. While the defaults
for ``enabled_apis`` dropped ``ec2`` as a value, if that is hard
@ -510,16 +510,16 @@ Upgrade Notes
- The commit with change-id Idd4bbbe8eea68b9e538fa1567efd304e9115a02a
requires that the nova_api database is setup and Nova is configured to use
it. Instructions on doing that are provided below.
Nova now requires that two databases are available and configured. The
existing nova database needs no changes, but a new nova_api database needs
to be setup. It is configured and managed very similarly to the nova
database. A new connection string configuration option is available in the
api_database group. An example::
[api_database]
connection = mysql+pymysql://user:secret@127.0.0.1/nova_api?charset=utf8
And a new nova-manage command has been added to manage db migrations for
this database. "nova-manage api_db sync" and "nova-manage api_db version"
are available and function like the parallel "nova-manage db ..." version.
@ -584,7 +584,7 @@ Deprecation Notes
replaceable components. There are many config options where you can
replace a manager by specifying a new class. This concept is
deprecated in Mitaka as are the following config options.
* [cells] manager
* metadata_manager
* compute_manager
@ -592,7 +592,7 @@ Deprecation Notes
* consoleauth_manager
* cert_manager
* scheduler_manager
Many of these will be removed in Newton. Users of these options
are encouraged to work with Nova upstream on any features missing
in the default implementations that are needed.
@ -637,15 +637,15 @@ Deprecation Notes
.. releasenotes/notes/zookeeper-servicegroup-driver-removed-c3bcaa6f9fe976ed.yaml @ b'7b1fb84f68bbcef0c496d3990e5d6b99a5360bc8'
- The Zookeeper Service Group driver has been removed.
The driver has no known users and is not actively mantained. A warning log
message about the driver's state was added for the Kilo release. Also,
evzookeeper library that the driver depends on is unmaintained and
`incompatible with recent eventlet releases`_.
A future release of Nova will `use the Tooz library to track
service liveliness`_, and Tooz supports Zookeeper.
.. _`incompatible with recent eventlet releases`: https://bugs.launchpad.net/nova/+bug/1443910
.. _`use the Tooz library to track service liveliness`: http://specs.openstack.org/openstack/nova-specs/specs/liberty/approved/service-group-using-tooz.html
@ -658,17 +658,17 @@ Security Issues
.. releasenotes/notes/13.0.0-cve-bugs-fe43ef267a82f304.yaml @ b'9c0bbda07fdcf134308371644d09becbb18c62b1'
- [OSSA 2016-001] Nova host data leak through snapshot (CVE-2015-7548)
* `Bug 1524274 <https://bugs.launchpad.net/nova/+bug/1524274>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-January/000911.html>`__
[OSSA 2016-002] Xen connection password leak in logs via StorageError (CVE-2015-8749)
* `Bug 1516765 <https://bugs.launchpad.net/nova/+bug/1516765>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-January/000916.html>`__
[OSSA 2016-007] Host data leak during resize/migrate for raw-backed instances (CVE-2016-2140)
* `Bug 1548450 <https://bugs.launchpad.net/nova/+bug/1548450>`_
* `Announcement <http://lists.openstack.org/pipermail/openstack-announce/2016-March/001009.html>`__

View File

@ -13,25 +13,25 @@ _get_nova_manage_subopts () {
_nova_manage()
{
local cur prev subopts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
local cur prev subopts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [ "x$_nova_manage_opts" == "x" ] ; then
_nova_manage_opts="`nova-manage bash-completion 2>/dev/null`"
_nova_manage_opts_exp="`echo $_nova_manage_opts | sed -e "s/\s/|/g"`"
fi
if [ "x$_nova_manage_opts" == "x" ] ; then
_nova_manage_opts="`nova-manage bash-completion 2>/dev/null`"
_nova_manage_opts_exp="`echo $_nova_manage_opts | sed -e "s/\s/|/g"`"
fi
if [[ " `echo $_nova_manage_opts` " =~ " $prev " ]] ; then
if [ "x$(_get_nova_manage_subopts "$prev")" == "x" ] ; then
subopts="`nova-manage bash-completion $prev 2>/dev/null`"
_set_nova_manage_subopts "$prev" "$subopts"
fi
COMPREPLY=($(compgen -W "$(_get_nova_manage_subopts "$prev")" -- ${cur}))
elif [[ ! " ${COMP_WORDS[@]} " =~ " "($_nova_manage_opts_exp)" " ]] ; then
COMPREPLY=($(compgen -W "${_nova_manage_opts}" -- ${cur}))
fi
return 0
if [[ " `echo $_nova_manage_opts` " =~ " $prev " ]] ; then
if [ "x$(_get_nova_manage_subopts "$prev")" == "x" ] ; then
subopts="`nova-manage bash-completion $prev 2>/dev/null`"
_set_nova_manage_subopts "$prev" "$subopts"
fi
COMPREPLY=($(compgen -W "$(_get_nova_manage_subopts "$prev")" -- ${cur}))
elif [[ ! " ${COMP_WORDS[@]} " =~ " "($_nova_manage_opts_exp)" " ]] ; then
COMPREPLY=($(compgen -W "${_nova_manage_opts}" -- ${cur}))
fi
return 0
}
complete -F _nova_manage nova-manage