diff --git a/HACKING.rst b/HACKING.rst index 3a8b8720..3c7d8850 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -13,15 +13,17 @@ Cloudkitty Specific Commandments - [C311] Use assertIsNone(...) instead of assertEqual(None, ...). - [C312] Use assertTrue(...) rather than assertEqual(True, ...). - [C313] Validate that logs are not translated. -- [C314] str() and unicode() cannot be used on an exception. Remove or use six.text_type(). +- [C314] str() and unicode() cannot be used on an exception. + Remove or use six.text_type(). - [C315] Translated messages cannot be concatenated. String should be included in translated message. -- [C317] 'oslo_' should be used instead of 'oslo.' +- [C317] `oslo_` should be used instead of `oslo.` - [C318] Must use a dict comprehension instead of a dict constructor with a sequence of key-value pairs. - [C319] Ensure to not use xrange(). - [C320] Do not use LOG.warn as it's deprecated. -- [C321] Ensure that the _() function is explicitly imported to ensure proper translations. +- [C321] Ensure that the _() function is explicitly imported to ensure + proper translations. LOG Translations ---------------- diff --git a/README.rst b/README.rst index 4ee93286..2dc35965 100644 --- a/README.rst +++ b/README.rst @@ -85,7 +85,8 @@ want to install it on an older system, use a virtualenv. Getting release notes --------------------- -Release notes can be found in the `release notes section`_ of the documentation. +Release notes can be found in the `release notes section`_ of the +documentation. .. Global references and images diff --git a/devstack/README.rst b/devstack/README.rst index e9b8b37c..a3126725 100644 --- a/devstack/README.rst +++ b/devstack/README.rst @@ -8,34 +8,44 @@ with DevStack. Configure DevStack to run CloudKitty ==================================== +.. code-block:: bash + $ DEVSTACK_DIR=/path/to/devstack -1. Enable Ceilometer:: +1. Enable Ceilometer: - $ cd ${DEVSTACK_DIR} - $ cat >> local.conf << EOF - [[local|localrc]] - # ceilometer - enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer.git master - EOF + .. code-block:: bash -2. Enable CloudKitty:: + $ cd ${DEVSTACK_DIR} + $ cat >> local.conf << EOF + [[local|localrc]] + # ceilometer + enable_plugin ceilometer https://git.openstack.org/openstack/ceilometer.git master + EOF - $ cd ${DEVSTACK_DIR} - cat >> local.conf << EOF - # cloudkitty - enable_plugin cloudkitty https://git.openstack.org/openstack/cloudkitty master - enable_service ck-api, ck-proc - EOF +2. Enable CloudKitty: -3. Set CloudKitty collector to gnocchi:: + .. code-block:: bash - $ cd ${DEVSTACK_DIR} - cat >> local.conf << EOF - CLOUDKITTY_COLLECTOR=gnocchi - EOF + $ cd ${DEVSTACK_DIR} + cat >> local.conf << EOF + # cloudkitty + enable_plugin cloudkitty https://git.openstack.org/openstack/cloudkitty master + enable_service ck-api, ck-proc + EOF -Run devstack as usual:: +3. Set CloudKitty collector to gnocchi: + + .. code-block:: bash + + $ cd ${DEVSTACK_DIR} + cat >> local.conf << EOF + CLOUDKITTY_COLLECTOR=gnocchi + EOF + +Run devstack as usual: + +.. code-block:: bash $ ./stack.sh diff --git a/doc/source/configuration/configuration.rst b/doc/source/configuration/configuration.rst index 026bf3e5..e54ae414 100644 --- a/doc/source/configuration/configuration.rst +++ b/doc/source/configuration/configuration.rst @@ -153,8 +153,8 @@ the ``mysql`` client:: GRANT ALL PRIVILEGES ON cloudkitty.* TO 'CK_DBUSER'@'localhost' IDENTIFIED BY 'CK_DBPASSWORD'; EOF -If you need to authorize the mysql user associated to cloudkitty from another host you -have to change the line accordingly. +If you need to authorize the mysql user associated to cloudkitty from another +host you have to change the line accordingly. Run the database synchronisation scripts:: @@ -174,10 +174,10 @@ cloudkitty uses Keystone for authentication, and provides a ``rating`` service. To integrate cloudkitty to Keystone, run the following commands (as OpenStack administrator):: - openstack user create cloudkitty --password CK_PASSWORD --email cloudkitty@localhost + openstack user create cloudkitty --password CK_PASSWORD \ + --email cloudkitty@localhost openstack role add --project service --user cloudkitty admin - Give the ``rating`` role to ``cloudkitty`` for each project that should be handled by cloudkitty:: diff --git a/doc/source/configuration/policy.rst b/doc/source/configuration/policy.rst index 4bf89c20..7cea6f49 100644 --- a/doc/source/configuration/policy.rst +++ b/doc/source/configuration/policy.rst @@ -5,8 +5,8 @@ Policy configuration Configuration ~~~~~~~~~~~~~ -The following is an overview of all available policies in Cloudkitty. For a sample -configuration file, refer to :doc:`samples/policy-yaml`. +The following is an overview of all available policies in Cloudkitty. +For a sample configuration file, refer to :doc:`samples/policy-yaml`. .. show-policy:: :config-file: ../../etc/oslo-policy-generator/cloudkitty.conf diff --git a/doc/source/developer/storage.rst b/doc/source/developer/storage.rst index 80ba3472..79dad005 100644 --- a/doc/source/developer/storage.rst +++ b/doc/source/developer/storage.rst @@ -2,17 +2,18 @@ Storage backend (v2) ==================== -.. warning:: This backend is considered unstable and should be used for upstream - development only. +.. warning:: This backend is considered unstable and should be used for + upstream development only. -In order to implement a storage backend for cloudkitty, you'll have to implement -the following abstract class: +In order to implement a storage backend for cloudkitty, you'll have to +implement the following abstract class: .. autoclass:: cloudkitty.storage.v2.BaseStorage :members: -You'll then need to register an entrypoint corresponding to your storage backend -in the ``cloudkitty.storage.v2.backends`` section of the ``setup.cfg`` file. +You'll then need to register an entrypoint corresponding to your storage +backend in the ``cloudkitty.storage.v2.backends`` section of the ``setup.cfg`` +file. Testing ======= diff --git a/doc/source/sample_policy.rst b/doc/source/sample_policy.rst index 5ecfdf29..6ee7be62 100644 --- a/doc/source/sample_policy.rst +++ b/doc/source/sample_policy.rst @@ -6,10 +6,11 @@ The following is a sample Cloudkitty policy file that has been auto-generated from default policy values in code. If you're using the default policies, then the maintenance of this file is not necessary, and it should not be copied into a deployment. Doing so will result in duplicate policy definitions. It is here -to help explain which policy operations protect specific Cloudkitty APIs, but it -is not suggested to copy and paste into a deployment unless you're planning on -providing a different policy for an operation that is not the default. +to help explain which policy operations protect specific Cloudkitty APIs, but +it is not suggested to copy and paste into a deployment unless you're planning +on providing a different policy for an operation that is not the default. -The sample policy file can also be viewed in `file form <_static/policy.yaml.sample>`_. +The sample policy file can also be viewed in +`file form <_static/policy.yaml.sample>`_. .. literalinclude:: _static/policy.yaml.sample diff --git a/lower-constraints.txt b/lower-constraints.txt index ad77e0a5..7eed03b2 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -41,3 +41,5 @@ oslotest==1.10.0 # Apache-2.0 sphinxcontrib-pecanwsme==0.8 # Apache-2.0 reno==1.8.0 # Apache2 sphinxcontrib-httpdomain==1.6.0 # Apache-2.0 +doc8==0.6.0 # Apache-2.0 +Pygments==2.2.0 # BSD diff --git a/test-requirements.txt b/test-requirements.txt index 1290af05..1d028b4b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -18,3 +18,5 @@ oslotest>=1.10.0 # Apache-2.0 sphinxcontrib-httpdomain>=1.6.0 # BSD sphinxcontrib-pecanwsme>=0.8 # Apache-2.0 reno>=1.8.0 # Apache-2.0 +doc8>=0.6.0 # Apache-2.0 +Pygments>=2.2.0 # BSD license diff --git a/tox.ini b/tox.ini index 2dc315ad..5fc18618 100644 --- a/tox.ini +++ b/tox.ini @@ -25,6 +25,7 @@ commands = oslo_debug_helper {posargs} basepython = python3 commands = flake8 {posargs} cloudkitty + doc8 {posargs} [testenv:cover] basepython = python3 @@ -60,6 +61,9 @@ filename = *.py,app.wsgi exclude = .git,.venv,.tox,dist,doc,*egg,build,.ropeproject,releasenotes ignore = H105 +[doc8] +ignore-path = .venv,.git,.tox,.tmp,*cloudkitty/locale*,*lib/python*,cloudkitty.egg*,doc/build,releasenotes/* + [hacking] import_exceptions = cloudkitty.i18n local-check-factory = cloudkitty.hacking.checks.factory