Make code compatible with SQLAlchemy 1.4.18

Also, plugins do not need to enable any network service other than what
devstack is already doing [1].

Also, fix doc build:
- bump up tox minversion to 3.18
- set ignore_basepython_conflict to True [2]
- add tex-gyre to binddep.txt [3]

[1] https://review.opendev.org/c/openstack/devstack/+/791436
[2] a0ec2de968/tox.ini (L7)
[3] https://review.opendev.org/c/openstack/openstack-health/+/793984

Change-Id: Ib6e3ed40dc8b075c3cecb967b7417097e3cab60d
Co-authored-by: Ghanshyam Mann <gmann@ghanshyammann.com>
This commit is contained in:
Bharat Kunwar 2021-06-24 16:01:54 +00:00
parent 042d2ad144
commit b2e20a1143
4 changed files with 23 additions and 27 deletions

View File

@ -1,5 +1,7 @@
# This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information.
graphviz [doc test]
vim
# PDF Docs package dependencies
tex-gyre [doc platform:dpkg]

View File

@ -14,15 +14,6 @@
# PHYSICAL_NETWORK=public
# OVS_PHYSICAL_BRIDGE=br-ex
# Enable Neutron which is required by Magnum and disable nova-network.
disable_service n-net
enable_service q-svc
enable_service q-agt
enable_service q-dhcp
enable_service q-l3
enable_service q-meta
enable_service neutron
# Enable Magnum services
enable_service magnum-api
enable_service magnum-cond

View File

@ -286,7 +286,7 @@ class Connection(api.Connection):
query = model_query(models.Cluster, session=session)
query = add_identity_filter(query, cluster_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.ClusterNotFound(cluster=cluster_id)
@ -344,7 +344,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(id=cluster_template_id)
query = query.filter_by(cluster_template_id=cluster_template_id)
try:
return query.one()
except NoResultFound:
@ -356,7 +356,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(uuid=cluster_template_uuid)
query = query.filter_by(cluster_template_uuid=cluster_template_uuid)
try:
return query.one()
except NoResultFound:
@ -368,7 +368,7 @@ class Connection(api.Connection):
query = self._add_tenant_filters(context, query)
public_q = model_query(models.ClusterTemplate).filter_by(public=True)
query = query.union(public_q)
query = query.filter_by(name=cluster_template_name)
query = query.filter_by(cluster_template_name=cluster_template_name)
try:
return query.one()
except MultipleResultsFound:
@ -427,7 +427,7 @@ class Connection(api.Connection):
query = model_query(models.ClusterTemplate, session=session)
query = add_identity_filter(query, cluster_template_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.ClusterTemplateNotFound(
clustertemplate=cluster_template_id)
@ -497,7 +497,7 @@ class Connection(api.Connection):
query = model_query(models.X509KeyPair, session=session)
query = add_identity_filter(query, x509keypair_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.X509KeyPairNotFound(x509keypair=x509keypair_id)
@ -539,7 +539,7 @@ class Connection(api.Connection):
query = model_query(models.MagnumService, session=session)
query = add_identity_filter(query, magnum_service_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.MagnumServiceNotFound(
magnum_service_id=magnum_service_id)
@ -623,7 +623,7 @@ class Connection(api.Connection):
try:
query = query.filter_by(project_id=project_id).filter_by(
resource=resource)
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
msg = (_('project_id %(project_id)s resource %(resource)s.') %
{'project_id': project_id, 'resource': resource})
@ -775,7 +775,7 @@ class Connection(api.Connection):
query = model_query(models.Federation, session=session)
query = add_identity_filter(query, federation_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.FederationNotFound(federation=federation_id)
@ -837,7 +837,7 @@ class Connection(api.Connection):
query = add_identity_filter(query, nodegroup_id)
query = query.filter_by(cluster_id=cluster_id)
try:
ref = query.with_lockmode('update').one()
ref = query.with_for_update().one()
except NoResultFound:
raise exception.NodeGroupNotFound(nodegroup=nodegroup_id)

17
tox.ini
View File

@ -1,7 +1,8 @@
[tox]
minversion = 2.0
minversion = 3.18
envlist = py37,pep8
skipsdist = True
ignore_basepython_conflict = True
[testenv]
basepython = python3
@ -106,16 +107,18 @@ setenv =
commands = {toxinidir}/tools/cover.sh {posargs}
[testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt
commands = sphinx-build -W --keep-going -b html doc/source doc/build/html
deps =
-c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/doc/requirements.txt
commands =
rm -rf doc/build/html doc/build/doctrees
sphinx-build -W --keep-going -b html -j auto doc/source doc/build/html
[testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps}
whitelist_externals =
make
commands =
sphinx-build -b latex doc/source doc/build/pdf
rm -rf doc/build/pdf
sphinx-build -W --keep-going -b latex -j auto doc/source doc/build/pdf
make -C doc/build/pdf
[testenv:genconfig]