From bf9186a37e77cb105fd50b4dc2cb89a2556037cc Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 4 Nov 2021 10:04:58 +1100 Subject: Fallback to upstream for Fedora image OpenDev infra only keep around the latest two Fedora releases in their mirrors. Probe for the image from the local test mirror, but if not found, fallback to upstream. This will be much less reliable, but can avoid gate breakage until new images can be used. Also, use endpoint_type when creating keystoneclient Keystone admin endpoint has been removed from devstack with[1]. This would use the public endpoint by default. Change-Id: I96ab14871ee8c5d5b83cc0cd4abc840ef0218ca8 --- devstack/lib/heat | 11 ++++++++++- heat/db/sqlalchemy/types.py | 2 ++ heat/engine/clients/os/keystone/heat_keystoneclient.py | 5 +++++ heat/tests/clients/test_heat_client.py | 3 +++ heat_integrationtests/common/clients.py | 1 + tox.ini | 1 + 6 files changed, 22 insertions(+), 1 deletion(-) diff --git a/devstack/lib/heat b/devstack/lib/heat index 5993d7de2..5f5f17252 100644 --- a/devstack/lib/heat +++ b/devstack/lib/heat @@ -471,10 +471,19 @@ function configure_tempest_for_heat { source $TOP_DIR/openrc admin admin iniset $TEMPEST_CONFIG heat_plugin admin_username $OS_USERNAME iniset $TEMPEST_CONFIG heat_plugin admin_password $OS_PASSWORD + + # NOTE(ianw) OpenDev infra only keeps the latest two Fedora's + # around; prefer the mirror but allow fallback if [[ -e /etc/ci/mirror_info.sh ]]; then source /etc/ci/mirror_info.sh fi - export HEAT_TEST_FEDORA_IMAGE=${NODEPOOL_FEDORA_MIRROR:-https://download.fedoraproject.org/pub/fedora/linux}/releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 + HEAT_TEST_FEDORA_IMAGE_UPSTREAM=https://download.fedoraproject.org/pub/fedora/linux + HEAT_TEST_FEDORA_IMAGE_PATH=releases/33/Cloud/x86_64/images/Fedora-Cloud-Base-33-1.2.x86_64.qcow2 + if curl --output /dev/null --silent --head --fail "${NODEPOOL_FEDORA_MIRROR}/${HEAT_TEST_FEDORA_IMAGE_PATH}"; then + export HEAT_TEST_FEDORA_IMAGE="${NODEPOOL_FEDORA_MIRROR}/${HEAT_TEST_FEDORA_IMAGE_PATH}" + else + export HEAT_TEST_FEDORA_IMAGE="${HEAT_TEST_FEDORA_IMAGE_UPSTREAM}/${HEAT_TEST_FEDORA_IMAGE_PATH}" + fi TOKEN=$(openstack token issue -c id -f value) local image_exists=$( openstack image list | grep "Fedora-Cloud-Base-33-1.2.x86_64" ) if [[ -z $image_exists ]]; then diff --git a/heat/db/sqlalchemy/types.py b/heat/db/sqlalchemy/types.py index 723d0bc4e..39766b893 100644 --- a/heat/db/sqlalchemy/types.py +++ b/heat/db/sqlalchemy/types.py @@ -21,6 +21,7 @@ loads = jsonutils.loads class LongText(types.TypeDecorator): + impl = types.Text def load_dialect_impl(self, dialect): @@ -42,6 +43,7 @@ class Json(LongText): class List(types.TypeDecorator): + impl = types.Text def load_dialect_impl(self, dialect): diff --git a/heat/engine/clients/os/keystone/heat_keystoneclient.py b/heat/engine/clients/os/keystone/heat_keystoneclient.py index 9754491a9..7f993ec9c 100644 --- a/heat/engine/clients/os/keystone/heat_keystoneclient.py +++ b/heat/engine/clients/os/keystone/heat_keystoneclient.py @@ -26,6 +26,7 @@ from oslo_log import log as logging from oslo_serialization import jsonutils from oslo_utils import importutils +from heat.common import config from heat.common import context from heat.common import exception from heat.common.i18n import _ @@ -76,6 +77,8 @@ class KsClientWrapper(object): self._domain_admin_auth = None self._domain_admin_client = None self._region_name = region_name + self._interface = config.get_client_option('keystone', + 'endpoint_type') self.session = self.context.keystone_session self.v3_endpoint = self.context.keystone_v3_endpoint @@ -158,6 +161,7 @@ class KsClientWrapper(object): session=self.session, auth=self.domain_admin_auth, connect_retries=cfg.CONF.client_retry_limit, + interface=self._interface, region_name=self.auth_region_name) return self._domain_admin_client @@ -165,6 +169,7 @@ class KsClientWrapper(object): def _v3_client_init(self): client = kc_v3.Client(session=self.session, connect_retries=cfg.CONF.client_retry_limit, + interface=self._interface, region_name=self.auth_region_name) if hasattr(self.context.auth_plugin, 'get_access'): diff --git a/heat/tests/clients/test_heat_client.py b/heat/tests/clients/test_heat_client.py index dabd00436..300ad5da9 100644 --- a/heat/tests/clients/test_heat_client.py +++ b/heat/tests/clients/test_heat_client.py @@ -86,6 +86,7 @@ class KeystoneClientTest(common.HeatTestCase): session=utils.AnyInstance(ks_session.Session), auth=self.mock_ks_auth, connect_retries=2, + interface='publicURL', region_name=None) def _stubs_auth(self, method='token', trust_scoped=True, @@ -168,6 +169,7 @@ class KeystoneClientTest(common.HeatTestCase): self.m_client.assert_any_call( session=utils.AnyInstance(ks_session.Session), connect_retries=2, + interface='publicURL', region_name=None) if self.stub_admin_auth: self.mock_admin_ks_auth.get_user_id.assert_called_once_with( @@ -1579,6 +1581,7 @@ class KeystoneClientTestDomainName(KeystoneClientTest): session=utils.AnyInstance(ks_session.Session), auth=self.mock_ks_auth, connect_retries=2, + interface='publicURL', region_name=None) def _stub_domain_admin_client(self, domain_id='adomain123'): diff --git a/heat_integrationtests/common/clients.py b/heat_integrationtests/common/clients.py index 67c1d59b0..2eece155a 100644 --- a/heat_integrationtests/common/clients.py +++ b/heat_integrationtests/common/clients.py @@ -144,6 +144,7 @@ class ClientManager(object): # Create our default Keystone client to use in testing return kc_v3.Client( session=self.identity_client.session, + interface='publicURL', region_name=self.conf.region) def _get_compute_client(self): diff --git a/tox.ini b/tox.ini index 6df056455..d50ea095d 100644 --- a/tox.ini +++ b/tox.ini @@ -9,6 +9,7 @@ basepython = python3 setenv = VIRTUAL_ENV={envdir} PYTHONWARNINGS=default::DeprecationWarning OS_TEST_PATH=heat/tests +install_command = pip install -c{env:UPPER_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} {opts} {packages} usedevelop = True deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} -r{toxinidir}/requirements.txt -- cgit v1.2.1