Commit Graph

77 Commits

Author SHA1 Message Date
Rafael Weingärtner a89aa44535 Remove the manual patch for WSME
WSME was released. Therefore, we can remove this work around.

Change-Id: I1673258da4fa9bcd96db24d635d9f06e3fc4a6a2
2023-09-21 15:45:50 -03:00
Rafael Weingärtner 60077a3cc4 Fix docs jobs in the CI that were broken due to Sphinx upgrade
Change-Id: Ic6278162fefdbfcb2ad6d7d07478b6a1e90c461e
2023-09-12 06:59:58 -03:00
Zuul 1d90a83fc4 Merge "Add missing api-ref envlist to tox" 2023-01-09 17:43:25 +00:00
Rafael Weingärtner 33d7174278 Make tox.ini tox 4.0.0 compatible
* removed skipsdist=True to make sure cloudkitty is available in the
  virtual env

* added find to allowed external commands in tox

* replaced full path to find for readability

Change-Id: I4211e9be3e170f8724246883768247727b1d5d0b
Co-Authored-By: Pierre Riteau <pierre@stackhpc.com>
2023-01-09 15:29:29 +01:00
Mariusz Karpiarz 524e37da18 Add missing api-ref envlist to tox
This is a follow-up to:
https://review.opendev.org/c/openstack/cloudkitty/+/867122

We need to add the `[testenv:api-ref]` section to `tox.ini` to be able
to run `tox -e api-ref`, which is what Zuul uses to build the API refs.

Sphinx had to be capped to the latest version 4 or otherwise `tox` fails
with the "add_content() takes 2 positional arguments but 3 were given"
error message.

Change-Id: I65b008152e2bc64f29229996c87ad4587fe85043
2022-12-14 13:28:11 +00:00
Pierre Riteau 386f086a8b [docs] Install cloudkitty requirements using constraints
The deps configuration for the docs environment only uses upper
constraints for doc/requirements.txt. However, cloudkitty also gets
installed automatically without upper constraints, which produces
various errors on older branches.

Install cloudkitty requirements using constraints to fix this issue.

Change-Id: Ia6f12151be829be6d2f21b3536536697345e05f4
2022-10-03 16:34:02 +02:00
Takashi Kajinami 788970e28f Replace deprecated assertRaisesRegexp
It was deprecated in favor of assertRaisesRegex added in Python 3.2.
We can replace it now because Python 2 is no longer supported.

Change-Id: I4cec6e44d48bcee9808bfd647f3a45cd8b1e2f11
2022-06-27 00:28:14 +09:00
Ghanshyam Mann 937a03b171 Drop lower-constraints.txt and its testing
As discussed in TC PTG[1] and TC resolution[2], we are
dropping the lower-constraints.txt file and its testing.
We will keep lower bounds in the requirements.txt file but
with a note that these are not tested lower bounds and we
try our best to keep them updated.

[1] https://etherpad.opendev.org/p/tc-zed-ptg#L326
[2] https://governance.openstack.org/tc/resolutions/20220414-drop-lower-constraints.html#proposal

Change-Id: I775420251d6e47f60c4a266b4013be84a52378da
2022-06-01 07:34:18 +00:00
Zuul 9fbe163f51 Merge "Use py3 as the default runtime for tox" 2021-08-18 21:59:58 +00:00
wu.shiming d087c358a1 Changed minversion in tox to 3.18.0
The patch bumps min version of tox to 3.18.0 in order to
replace tox's whitelist_externals by allowlist_externals option:
https://github.com/tox-dev/tox/blob/master/docs/changelog.rst#v3180-2020-07-23

Change-Id: I0cf1a50e43a18984d4f299a551c5bbef483d82ec
2021-06-29 09:04:15 +00:00
songwenping e438a2bd6a Use py3 as the default runtime for tox
Moving on py3 as the default runtime for tox to avoid to update this at
each new cycle.

Wallaby support officially the following runtimes [1]:
- Python 3.6
- Python 3.8

During Victoria Python 3.7 was used as the default runtime [2] however this
version isn't longer officially supported.

[1] https://governance.openstack.org/tc/reference/runtimes/wallaby.html#python-runtimes-for-wallaby
[2] https://governance.openstack.org/tc/reference/runtimes/victoria.html#python-runtimes-for-victoria

Change-Id: Id917b883da6010f028a40be7acbe4e3a772f9408
2021-04-20 02:40:02 +00:00
Hervé Beraud b0d5e455fc Add doc/requirements
We need to specify doc requirements in doc/requirements.txt
to avoid problems with the pip resolver [1] for the release team [2][3].
Removed specific doc requirements from test-requirements.txt.

The problem here is that this repos haven't doc/requirements.txt file
and by default in this case zuul will use the test-requirements.txt file
to pull requirements [4].

This requirements file contains extra requirements like flake8 that
collided with those allowed in our job environment and so the new pip
resolver fails to install these requirements and the job exits in error.

This project meet the conditions leading to the bug.

[1] http://lists.openstack.org/pipermail/release-job-failures/2021-January/001500.html
[2] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019611.html
[3] http://lists.openstack.org/pipermail/openstack-discuss/2021-January/019612.html
[4] https://opendev.org/zuul/zuul-jobs/src/branch/master/roles/ensure-sphinx/tasks/main.yaml#L36

Change-Id: I6bdfa9830a32ecf36e1931e1bb0afa366f1dfeb9
2021-01-05 14:00:00 +01:00
Andreas Jaeger 11ff7365a3 Update lower-constraints
This repo has not been testing lower-constraints at all due to
broken install_command. If you look at any lower-constraints run and
compare the install python packages with lower-constraints, you see
that those are completely different.

This change removes install_command and updates deps in tox.ini to
follow best practices (moving constraints into deps).
It also updates lower-constraints to newer versions.

Remove broken hacking test.

Co-Authored-By: Justin Ferrieu <jferrieu@objectif-libre.com>
Change-Id: I13daab9e53617266beff7053e50779d1f281802c
2020-12-14 18:03:59 -03:00
wuchunyang 11ff713042 Replace deprecated UPPER_CONSTRAINTS_FILE variable
UPPER_CONSTRAINTS_FILE is old name and deprecated
-https://zuul-ci.org/docs/zuul-jobs/python-roles.html#rolevar-tox.tox_constraints_file
This allows to use lower-constraints file as more
readable way instead of UPPER_CONSTRAINTS_FILE=<lower-constraints file>.

Change-Id: I7b88b55bfceff177b0ed0586d105353f7159b171
2020-11-27 12:40:47 +00:00
zhangchun 2869666c12 bump py37 to py38 in tox.ini
in 'victoria' cycle, we should test py38 by default.
Trivial change

Change-Id: I80301bac54bb8654f58d4dfc0ff3de5899f3a314
2020-09-20 14:21:04 +00:00
Andreas Jaeger b014dbe64c 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.

Change-Id: I41a5518f1210c9a1b6d5217bbbcd99bbaa3c9b53
2020-08-18 22:27:09 -03:00
Sean McGinnis 3dccfc7643
Fix docs build error due to duplicate references
Class docstrings were being pulled in to multiple locations, causing
sphinx errors due to the duplicate references. This fixes it by adding
the :noindex: option to those references.

Also temporarily disabling the PDF build as that is failing with another
issue that should be fixed in a follow up.

Change-Id: I6de2948ff49e1bb0b6a8b9a3a90f9f2ebbb8b7bb
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
2020-06-24 16:56:51 -05:00
Andreas Jaeger 56609c46f9 [ussuri][goal] Cleanup drop python 2.7 support
OpenStack is dropping the py2.7 support in ussuri cycle.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

this removes some cruft that can be removed now:
* cruft in setup.cfg and setup.py
* tox.ini: Add ignore_basepython_conflict and increase minversion
  for that
* Python 2/3 specific requirements, the repo is Python 3 only.

Change-Id: Iae68e58c82a180eb771bef00a3f44fd28abe5fae
2020-02-24 20:16:56 +01:00
caoyuan 05eb7b9a58 tox: Keeping going with docs
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.

[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045

Change-Id: Ic3a57b513d3646b6931edc6163c2702805d29d57
2019-12-19 15:21:01 +08:00
Luka Peschke 3426a6648a Build docs with -W
This fixes all build warnings in the docs, and makes them build
with -W (consider warnings as errors).

Work items:

* Remove the useless "METRICS_CONF" global variable in the monasca collector.
  It was causing the "load_conf()" function to fail, as the
  /etc/cloudkitty/metrics.yml file couldn't be found.

* Change the docstring indentation in
  cloudkitty/rating/hash/controllers/mapping.py. This was the cause for the
  "doc/source/api-reference/v1/rating/hashmap.rst:12: WARNING: Field list ends
  without a blank line; unexpected unindent." message.

* Added a cloudkitty.conf sample to the admin documentation.

* Deleted unused files.

* Fixed the policy.yaml sample include path.

* Sorted the v2 API parameters alphabetically.

* Ignored the "wsmeext.sphinxext: directive 'autoattribute' is
  already registered" warning

* Added :noindex: directives to functions documented twice.

* Made sphinx always build with -W.

Change-Id: I5f1ab04e18920f3352c2807878cad327692a225f
2019-11-25 11:27:13 +01:00
Ghanshyam Mann afef05aca4 [ussuri][goal] Drop python 2.7 support and testing
OpenStack is dropping the py2.7 support in ussuri cycle.

Cloudkitty is ready with python 3 and ok to drop the
python 2.7 support.

Complete discussion & schedule can be found in
- http://lists.openstack.org/pipermail/openstack-discuss/2019-October/010142.html
- https://etherpad.openstack.org/p/drop-python2-support

Ussuri Communtiy-wide goal:
https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html

Depends-On: https://review.opendev.org/#/c/693631/
Change-Id: I44ea5cfe479558969ccb3ca57f416511614626cc
2019-11-16 14:35:39 +00:00
Luka Peschke b7e8323f63 Add support for PDF doc generation
This adds support for pdf documentation generation. Work items:

* Provide a distinct index for pdf doc. This is required as the toctree in a
  tab fails to render as a pdf document.

* Remove the v2 API reference from the pdf documentation. "rest_expand_all",
  "rest_method" and "rest_parameters" are not supported.

* Add a pdf-docs tox env

* Update conf.py

Story: 2006075
Task: 34808
Change-Id: I848d59b551fe6d5077960dc45554c7281c2372a7
2019-09-16 15:42:55 +02:00
Zuul 7112601861 Merge "Update bandit version" 2019-08-26 14:54:44 +00:00
pengyuesheng 4acc592694 Add lower-constraints job
create a tox environment for running the unit tests against the lower
bounds of the dependencies.

Add openstack-tox-lower-constraints job to the zuul configuration.

See http://lists.openstack.org/pipermail/openstack-dev/2018-March/128352.html
for more details.

Change-Id: Iac8d78c191763121cc580c5cdb070b2673e39c99
2019-08-26 12:18:08 +00:00
Luka Peschke 54c1b98b12 Update bandit version
This fixes the minimal bandit version to 1.6.0 and updates the
format of the -x option.

Change-Id: Ib0691b53669b6f4f7824bd4385640c5a805a1e2a
2019-08-26 12:17:41 +00:00
Justin Ferrieu 16b6fa5ce8 Removing author identification in all files
As specified by the OpenStack Style Guidelines in its 1.1.1.dev15
version, which is the latest version to this day, *author* tags
should not be specified (see H105).

https://docs.openstack.org/hacking/latest/user/hacking.html#general

Change-Id: I0ab7359e15eb04948c7a905378001a66cb901e69
2019-07-22 12:21:54 +00:00
pengyuesheng b0e010a19f Modify the url of upper_constraints_file
Depends-On: http://lists.openstack.org/pipermail/openstack-discuss/2019-May/006478.html

Change-Id: I1f2a012b7f0676cfc343e0755209fb91bef8c0b2
2019-06-18 10:38:07 +08:00
caoyuan 8243e18d78 Replace git.openstack.org URLs with opendev.org URLs
Change-Id: I12e967cd13f063298fa81689646191c81316468a
2019-04-24 14:13:58 +08:00
Ghanshyam Mann 19425bdfa1 Dropping the py35 testing
All the integration testing has been moved to
Bionic now[1] and py3.5 is not tested runtime for
Train or stable/stein[2].

As per below ML thread, we are good to drop the py35
testing now:
http://lists.openstack.org/pipermail/openstack-discuss/2019-April/005097.html

[1] http://lists.openstack.org/pipermail/openstack-discuss/2019-April/004647.html
[2]
https://governance.openstack.org/tc/reference/runtimes/stein.html
https://governance.openstack.org/tc/reference/runtimes/train.html

Change-Id: I607d71e805a86098f8876ff35ad4443dc840740a
2019-04-14 19:18:28 +00:00
zhulingjie f315499d0e Update tox to 2.0
The commands used by constraints need at least tox 2.0

Change-Id: Ida98b68f56552e130f585bce5bf66143b9286248
Closes-Bug: #1824305
2019-04-11 17:09:54 +08:00
Hervé Beraud 60740282c9 Add bandit for security static analysis and fix potential security issues
This change adds a basic bandit config for cloudkitty. It can be invoked
by running the tox environment for bandit;
    tox -e bandit

These changes also fix potential security issues find during bandit checks.
- binding to all interface: remove useless host_ip option to avoid issue
- hash function issue: switch from sha1 to sha512
- use of exec: can't be removed for moment so using #nosec comment

Change-Id: Iae7d7604457345fe6d482cf48311c9b75fdde947
2019-03-25 16:26:05 +00:00
Luka Peschke 1ede03ba2c Delete v2 gnocchi storage
This is part of a global effort to clean up CloudKitty's
unmaintained codebase.

This storage backend was only present for development purposes,
and not production ready. A second v2 backend will be implemented
in the future, with support for HA/clustering.

Change-Id: Iab9d152d2851ca385e607d338c0a09b74ba7e3b3
Story: 2004400
Task: 28568
2019-02-01 16:53:05 +01:00
Luka Peschke 01f702c479 Enable python3.7 testing jobs
Change-Id: I37ed25842cce4267a7c9309863c7d328102a69d2
2018-10-30 11:01:49 +01:00
Dao Cong Tien b3ae81dc92 Adds doc8 check to pep8
This patch adds doc8 check for .rst files to pep8.
Files that fail doc8 check are also fixed.

Change-Id: Ib8556b6eac0fb5a9bd3b7f8dcf000ab1b23e23bc
2018-10-22 11:14:57 +02:00
Nguyen Van Trung b47594bb52 Don't quote {posargs} in tox.ini
Quotes around {posargs} cause the entire string to be combined into one
arg that gets passed to stestr. This prevents passing multiple args
(e.g. '--concurrency=16 some-regex')

Change-Id: Ia95801a67b0db3932fba6b3dd0c4cae6f0a81e56
2018-10-09 10:00:15 +07:00
Luka Peschke d466190cef Use python3 for documentation builds
Pecanwsme 0.9 supports python3, so there is no reason to use python2
anymore.

Change-Id: Ib69afa4968af4db7a7e70e21acdb9d636694b306
2018-10-01 10:44:52 +02:00
Andreas Jaeger 114d7ebaaf Use openstack-tox-cover template
Use openstack-tox-cover template, this runs the cover job as
non-voting in the check queue only.

Remove jobs and use template instead.

Fix cover environment.

Change-Id: I4fa5ac5d852544beffb020b30f2f428ebf56b78b
2018-09-07 14:34:01 +02:00
Luka Peschke 3ab4774f66 Adding a v2 storage backend
This adds a v2 storage interface as well as a gnocchi backend for it to
cloudkitty. This new interface will allow us to implement the v2 API, which will
be more metric-oriented.

This new storage uses the new dataframe format ('desc' is now split up into
'groupby' and 'metadata', following the collect logic); and supports grouping,
filters and pagination.

Modifications:

  * The tenant/scope state management isn't handled by the storage backend
    anymore. A StateManager object has been added.

  * All internal interactions with the storage backend use the v2 interface.
    An adapter class has been added to ensure retrocompatibility with the
    v1 interface.

  * A base class for functional tests testing the v2 storage interface has been
    added. It contains generic tests, which should allow easier testing for new
    v2 backends.

  * Some developer documentation explaining how to implement a v2 storage
    backend has been added. User documentation will be updated once the v2
    storage backend is considered stable.

The v1 is still the default storage version. Note that this new version is
considered unstable and should only be used for upstream development.

Change-Id: I5e9b95c79292582fab3017289d35ee310e35ffea
Story: 2001372
Task: 6585
Task: 14361
Task: 24535
2018-08-22 12:11:25 +02:00
Vu Cong Tuan a3fd90b776 Switch to stestr
According to Openstack summit session [1],
stestr is maintained project to which all Openstack projects should migrate.
Let's switch to stestr as other projects have already moved to it.

[1] https://etherpad.openstack.org/p/YVR-python-pti

Change-Id: Icb3886271885bfee19981a6acdda3163f3cd72f8
2018-07-18 08:00:06 +07:00
MC c234d6330e Force python2 for documentation generation
Due to the Sphinx module of pecanwsme,
which is not python3 compatible,
we need to force the usage of python2
for the documentation generation.
A future patch will remove the usage of pecanwsme completely.
This commit will be reverted at the same time.

Change-Id: Icaa8047d9d15cb75a75bbb04336e5f9d2fefcbe0
2018-06-28 11:24:21 +00:00
Doug Hellmann 4b24e29e4e fix tox python3 overrides
We want to default to running all tox environments under python 3, so
set the basepython value in each environment.

We do not want to specify a minor version number, because we do not
want to have to update the file every time we upgrade python.

We do not want to set the override once in testenv, because that
breaks the more specific versions used in default environments like
py35 and py36.

Change-Id: I03d26060e9b36ed50062a54b9de29d7dc6787fb9
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
2018-06-06 17:11:04 -04:00
Zuul 321bb6de95 Merge "Policy in code" 2017-12-12 22:03:15 +00:00
Jeremy Liu 7eca672645 Policy in code
This patch introduces the implementation for registering
default policy rules in code. Default rules are defined under
cloudkitty.common.policies. Each API's policies are defined in a
sub-folder under that path and __init__.py contains all the
default policies in code which are registered in the ``init``
enforcer function in cloudkitty/common/policy.py.

This commit does the following:
 - Creates the ``policies`` module that contains all the default
   policies in code.
 - Adds the base policy rules into code (context_is_admin,
   admin_or_owner and default rules).
 - Add policies in code for current APIs
 - Add a tox env to generate default policy sample file
 - Delete policy.json from repo as policies in code will be used.

Change-Id: I257e8cefc2b699fc979c717531cd9ba77233d94b
Implements: blueprint policy-in-code
2017-12-08 16:45:13 +00:00
deepakmourya 9585fe174e Add app.wsgi to target of pep8
The app.wsgi file should be adjusted to meet pep8
standards and apply pep8 check to app.wsgi automatically.

Change-Id: I608e9e491dc13ded595c68108d8b8854c8ab0585
2017-11-21 09:00:26 +05:30
Jeremy Liu 6b17052ee1 Add rm to whitelist_externals
This will avoid a warning message when running test.

Change-Id: Ifb308ff2f74fb49b886efe4f503a0c9c63800db1
2017-10-27 17:02:39 +08:00
Jeremy Liu 8fea4e1ec7 Update usage of gabbi in Cloudkitty test
Update usage of gabbi in CK tests, also set upper constraints for CK.

Change-Id: Idb207161d2704200e8e6108d3f3049ce95e9f797
2017-10-24 15:06:04 +00:00
rajat29 3f7b399cdf Add 'rm -f .testrepository/times.dbm' command in testenv
Running py2* post py3* tests results in error. Add
'rm -f .testrepository/times.dbm' command in testenv to
resolve this.
Closes-Bug: #1565928

Change-Id: I9f29c187ff0e2b6ef46c0b8e28e2aff3f36949b8
2017-05-01 10:45:05 +00:00
zhangguoqing 052f8ed653 Delete unused testenv:checkconfig in tox
The testenv:checkconfig is unused and there is not the file
{toxinidir}/tools/config/check_uptodate.sh in cloudkitty.

Change-Id: Ifa8293a7b04557316c7256519b8821b5a668c554
2017-02-27 13:21:18 +08:00
Jenkins 6d597a9d06 Merge "Remove support for py34" 2017-02-11 08:04:01 +00:00
gengchc2 0117a59252 Remove support for py34
The gating on python 3.4 is restricted to <= Mitaka. This is due
to the change from Ubuntu Trusty to Xenial, where only python3.5
is available. There is no need to continue to keep these settings.

Change-Id: I49007c51723bfbe7747bcc611ff669f3c7980a10
2017-02-08 16:27:08 +08:00