Skip to content

Commit

Permalink
Keep pre-commit inline with hacking and fix whitespace
Browse files Browse the repository at this point in the history
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
  • Loading branch information
emonty authored and stephenfin committed Dec 12, 2019
1 parent 2e7a008 commit e7cc5ef
Show file tree
Hide file tree
Showing 12 changed files with 81 additions and 70 deletions.
17 changes: 14 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)/.*$'
14 changes: 7 additions & 7 deletions api-ref/source/images.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -208,7 +208,7 @@ Response

.. rest_parameters:: parameters.yaml

- metadata: metadata_object
- metadata: metadata_object

**Example List Image Metadata Details: JSON response**

Expand All @@ -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**

Expand All @@ -245,7 +245,7 @@ Response

.. rest_parameters:: parameters.yaml

- metadata: metadata_object
- metadata: metadata_object

**Example Create Image Metadata: JSON response**

Expand All @@ -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**

Expand All @@ -282,7 +282,7 @@ Response

.. rest_parameters:: parameters.yaml

- metadata: metadata_object
- metadata: metadata_object

**Example Update Image Metadata: JSON response**

Expand Down
4 changes: 2 additions & 2 deletions api-ref/source/os-floating-ips.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions api-ref/source/os-volumes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions doc/source/reference/threading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions nova/db/sqlalchemy/migrate_repo/migrate.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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=[]
2 changes: 1 addition & 1 deletion nova/virt/hyperv/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
12 changes: 6 additions & 6 deletions releasenotes/source/liberty.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`__

Expand Down Expand Up @@ -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>`__

Expand All @@ -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'
Expand All @@ -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


Expand Down
34 changes: 17 additions & 17 deletions releasenotes/source/mitaka.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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>`_


Expand All @@ -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


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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:[email protected]/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.
Expand Down Expand Up @@ -584,15 +584,15 @@ 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
* console_manager
* 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.
Expand Down Expand Up @@ -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

Expand All @@ -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>`__

Expand Down
Loading

0 comments on commit e7cc5ef

Please sign in to comment.