From b2e20a11432103b664bafc0862252122063c32e6 Mon Sep 17 00:00:00 2001 From: Bharat Kunwar Date: Thu, 24 Jun 2021 16:01:54 +0000 Subject: [PATCH] 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] https://github.com/openstack/nova/blob/a0ec2de968cfded8b88c2f3af1152b5932d675b7/tox.ini#L7 [3] https://review.opendev.org/c/openstack/openstack-health/+/793984 Change-Id: Ib6e3ed40dc8b075c3cecb967b7417097e3cab60d Co-authored-by: Ghanshyam Mann --- bindep.txt | 4 +++- devstack/settings | 9 --------- magnum/db/sqlalchemy/api.py | 20 ++++++++++---------- tox.ini | 17 ++++++++++------- 4 files changed, 23 insertions(+), 27 deletions(-) diff --git a/bindep.txt b/bindep.txt index 4448b52eca..05ba2e57a4 100644 --- a/bindep.txt +++ b/bindep.txt @@ -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] diff --git a/devstack/settings b/devstack/settings index db4102951c..4d6dff966d 100644 --- a/devstack/settings +++ b/devstack/settings @@ -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 diff --git a/magnum/db/sqlalchemy/api.py b/magnum/db/sqlalchemy/api.py index b206a173c4..2ddc95fa93 100644 --- a/magnum/db/sqlalchemy/api.py +++ b/magnum/db/sqlalchemy/api.py @@ -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) diff --git a/tox.ini b/tox.ini index f5f7797bdf..7c018d7152 100644 --- a/tox.ini +++ b/tox.ini @@ -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]