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; # This is a cross-platform list tracking distribution packages needed by tests;
# see http://docs.openstack.org/infra/bindep/ for additional information. # see http://docs.openstack.org/infra/bindep/ for additional information.
graphviz [doc test] graphviz [doc test]
vim vim
# PDF Docs package dependencies
tex-gyre [doc platform:dpkg]

View File

@ -14,15 +14,6 @@
# PHYSICAL_NETWORK=public # PHYSICAL_NETWORK=public
# OVS_PHYSICAL_BRIDGE=br-ex # 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 Magnum services
enable_service magnum-api enable_service magnum-api
enable_service magnum-cond enable_service magnum-cond

View File

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

17
tox.ini
View File

@ -1,7 +1,8 @@
[tox] [tox]
minversion = 2.0 minversion = 3.18
envlist = py37,pep8 envlist = py37,pep8
skipsdist = True skipsdist = True
ignore_basepython_conflict = True
[testenv] [testenv]
basepython = python3 basepython = python3
@ -106,16 +107,18 @@ setenv =
commands = {toxinidir}/tools/cover.sh {posargs} commands = {toxinidir}/tools/cover.sh {posargs}
[testenv:docs] [testenv:docs]
deps = -r{toxinidir}/doc/requirements.txt deps =
commands = sphinx-build -W --keep-going -b html doc/source doc/build/html -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] [testenv:pdf-docs]
basepython = python3
deps = {[testenv:docs]deps} deps = {[testenv:docs]deps}
whitelist_externals =
make
commands = 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 make -C doc/build/pdf
[testenv:genconfig] [testenv:genconfig]