Commit Graph

9 Commits

Author SHA1 Message Date
Hasan Acar a24fd834d0 fix: migrate CI to jammy
fix: change tox.ini

fix: change queries for list_dimension_names and list_dimension_values because of influxdb time filter problem

fix: remove build_sphinx group from setup.cfg

fix: handle hashlib security problem

Change-Id: I0d31a8db5ed71c70e7b878ce5e7940e041d0fa43

Change-Id: I6f7066da10e834550cbf0c053c7bf425ac0ead93

Change-Id: If9575aee73d600bbc84fcdf58deb1c57b508d9c2

Change-Id: If515eaeee7539da3ca49997e88785dc65572b334
2024-02-22 14:35:03 +00:00
Martin Chacon Piza 7466a2f962 Replace removed DB methods with current ones
Replace removed Binary with LargeBinary import
Remove reflect=True from Alembic MetaData
Replace removed idle_timeout with connection_recycle_time option

- Binary was removed in SQLAlchemy 1.4.x [1]
- SQLAlchemy was updated to 1.4.15 in u-c [2]
- idle_timeout was removed in oslo.db 10.0.0 [3]
- oslo.db was updated to 10.0.0 in u-c [4]
- idle_timeout was already deprecated and renamed as
  connection_recycle_time [5]

[1] https://github.com/sqlalchemy/sqlalchemy/issues/6263#issuecomment-819645247
[2] dc86260b28
[3] a857b83c9c
[4] f322cc13d8
[5] 6634218415

Change-Id: I13ec9c2b53174cfb2e3cb990ec773588cf68007c
2021-07-22 22:35:58 +02:00
Hervé Beraud 72bc9a91ab Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ifd61bc8e043ac9af446ae31bffd82f67f34facbc
2020-06-02 20:24:41 +02:00
Andreas Jaeger abad342eb2 Update hacking for Python3
The repo is Python 3 now, so update hacking to version 3.0 which
supports Python 3.

Fix problems found by updated hacking version.

Remove hacking and friends from lower-constraints, they are not needed
there at all.

Change-Id: I35d848e9af297d3561ea2838a4808166d1c36601
2020-04-22 07:37:55 +00:00
Doug Szumski 712f693a72 Fix notification method type DB schema migration
The Stein release does away with the concept of built in notifications,
in favour of treating all notification types equally.

This patch fixes an issue with the DB schema migration associated
with this change, which will fail if any notifications using
built-in notification types are configured at the time of the upgrade.

Story: 2006984
Task: 37746
Change-Id: I2e3f08edf1ab6aec526ad93d04effb91ddca600a
2020-01-14 09:27:30 +00:00
Witold Bedyk 6409d06439 Set up DB schema in DevStack plugin using Alembic
SQL schema scripts are replaced with Alembic command line tool.
Notification plugins are enabled in notification engine configuration
file.

The change also fixes the `sub_alarm` table schema. The foreign key must
refer to the field with the same data type, charset and collation.
Otherwise the schema migration fails occasionally with Python 3 with the
IntegrityError[1]:

  oslo_db.exception.DBError: (pymysql.err.IntegrityError) (1215, 'Cannot add foreign key constraint')

[1] http://logs.openstack.org/61/622361/8/gate/monasca-tempest-python3-influxdb/26104a3/controller/logs/devstacklog.txt.gz#_2019-01-30_15_52_45_455

Change-Id: I95d7e91e62ff13e84f963fdbb3bca6b7dfd7c310
Story: 2001654
Task: 14421
2019-02-20 14:53:10 +01:00
Doug Szumski ff0c1cc67d Remove built-in plugins from database schema
Add an alembic migration to remove the built-in plugins. Monasca-notification
becomes responsible for creating them, if they are enabled in the
monasca-notification config file. This also adds some very basic tests and
fixes an issue with Python 3 support (highlighted by the tests) where the
schema was stored as unicode which prevented hashing.

Story: 2003801
Task: 26533
Change-Id: I74848bac2137e446c8825f23778f6a16a96a2048
2018-12-11 09:56:04 +00:00
Johannes Grassler 0250f81cdc Add monasca_db command line tool
This commit adds a schema management tool for the Monasca
configuration database. Apart from the usual OpenStack schema
management tool subcommands (stamp, upgrade, version) it has
two extra subcommands:

* fingerprint: for computing a SHA1 fingerprint of the
               currently currently active database schema.
* detect-revision: for identifiying the Alembic revision
                   (if any) corresponding to a database
                   schema that was created with one of the
                   legacy SQL scripts.

The data provided by the detect-revision subcommand can be
used for stamping the database with Alembic version metadata
when transitioning an existing Monasca configuration database
to Alembic based database migrations.

Story: 2001654
Task: 14341

Change-Id: Ibdd877a23ab5d6d1bbf8d83515c0197554098526
2018-08-01 11:10:14 +00:00
Johannes Grassler 39d5bbbb0a Alembic migrations for all SQL script revisions
This commit adds

* An alembic environment for running database migrations
* Alembic database migrations for all revisions
  of the legacy SQL script currently being used to set up the
  Monasca database.
* The get_all_metadata() function for exposing full data model
  metadata. This function is needed generating migrations from
  the current state of the model and should be kept up to date
  as the model is being extended.

Change-Id: I41b4577d8334791f712177348cadfe9b07b62ef1
Story: 2001654
Task: 14339
2018-06-22 08:16:35 +00:00