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
This commit is contained in:
Ian Wienand 2021-11-04 10:04:58 +11:00 committed by rabi
parent ef187fc65b
commit bf9186a37e
6 changed files with 22 additions and 1 deletions

View File

@ -471,10 +471,19 @@ function configure_tempest_for_heat {
source $TOP_DIR/openrc admin admin source $TOP_DIR/openrc admin admin
iniset $TEMPEST_CONFIG heat_plugin admin_username $OS_USERNAME iniset $TEMPEST_CONFIG heat_plugin admin_username $OS_USERNAME
iniset $TEMPEST_CONFIG heat_plugin admin_password $OS_PASSWORD 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 if [[ -e /etc/ci/mirror_info.sh ]]; then
source /etc/ci/mirror_info.sh source /etc/ci/mirror_info.sh
fi 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) TOKEN=$(openstack token issue -c id -f value)
local image_exists=$( openstack image list | grep "Fedora-Cloud-Base-33-1.2.x86_64" ) local image_exists=$( openstack image list | grep "Fedora-Cloud-Base-33-1.2.x86_64" )
if [[ -z $image_exists ]]; then if [[ -z $image_exists ]]; then

View File

@ -21,6 +21,7 @@ loads = jsonutils.loads
class LongText(types.TypeDecorator): class LongText(types.TypeDecorator):
impl = types.Text impl = types.Text
def load_dialect_impl(self, dialect): def load_dialect_impl(self, dialect):
@ -42,6 +43,7 @@ class Json(LongText):
class List(types.TypeDecorator): class List(types.TypeDecorator):
impl = types.Text impl = types.Text
def load_dialect_impl(self, dialect): def load_dialect_impl(self, dialect):

View File

@ -26,6 +26,7 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
from oslo_utils import importutils from oslo_utils import importutils
from heat.common import config
from heat.common import context from heat.common import context
from heat.common import exception from heat.common import exception
from heat.common.i18n import _ from heat.common.i18n import _
@ -76,6 +77,8 @@ class KsClientWrapper(object):
self._domain_admin_auth = None self._domain_admin_auth = None
self._domain_admin_client = None self._domain_admin_client = None
self._region_name = region_name self._region_name = region_name
self._interface = config.get_client_option('keystone',
'endpoint_type')
self.session = self.context.keystone_session self.session = self.context.keystone_session
self.v3_endpoint = self.context.keystone_v3_endpoint self.v3_endpoint = self.context.keystone_v3_endpoint
@ -158,6 +161,7 @@ class KsClientWrapper(object):
session=self.session, session=self.session,
auth=self.domain_admin_auth, auth=self.domain_admin_auth,
connect_retries=cfg.CONF.client_retry_limit, connect_retries=cfg.CONF.client_retry_limit,
interface=self._interface,
region_name=self.auth_region_name) region_name=self.auth_region_name)
return self._domain_admin_client return self._domain_admin_client
@ -165,6 +169,7 @@ class KsClientWrapper(object):
def _v3_client_init(self): def _v3_client_init(self):
client = kc_v3.Client(session=self.session, client = kc_v3.Client(session=self.session,
connect_retries=cfg.CONF.client_retry_limit, connect_retries=cfg.CONF.client_retry_limit,
interface=self._interface,
region_name=self.auth_region_name) region_name=self.auth_region_name)
if hasattr(self.context.auth_plugin, 'get_access'): if hasattr(self.context.auth_plugin, 'get_access'):

View File

@ -86,6 +86,7 @@ class KeystoneClientTest(common.HeatTestCase):
session=utils.AnyInstance(ks_session.Session), session=utils.AnyInstance(ks_session.Session),
auth=self.mock_ks_auth, auth=self.mock_ks_auth,
connect_retries=2, connect_retries=2,
interface='publicURL',
region_name=None) region_name=None)
def _stubs_auth(self, method='token', trust_scoped=True, def _stubs_auth(self, method='token', trust_scoped=True,
@ -168,6 +169,7 @@ class KeystoneClientTest(common.HeatTestCase):
self.m_client.assert_any_call( self.m_client.assert_any_call(
session=utils.AnyInstance(ks_session.Session), session=utils.AnyInstance(ks_session.Session),
connect_retries=2, connect_retries=2,
interface='publicURL',
region_name=None) region_name=None)
if self.stub_admin_auth: if self.stub_admin_auth:
self.mock_admin_ks_auth.get_user_id.assert_called_once_with( 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), session=utils.AnyInstance(ks_session.Session),
auth=self.mock_ks_auth, auth=self.mock_ks_auth,
connect_retries=2, connect_retries=2,
interface='publicURL',
region_name=None) region_name=None)
def _stub_domain_admin_client(self, domain_id='adomain123'): def _stub_domain_admin_client(self, domain_id='adomain123'):

View File

@ -144,6 +144,7 @@ class ClientManager(object):
# Create our default Keystone client to use in testing # Create our default Keystone client to use in testing
return kc_v3.Client( return kc_v3.Client(
session=self.identity_client.session, session=self.identity_client.session,
interface='publicURL',
region_name=self.conf.region) region_name=self.conf.region)
def _get_compute_client(self): def _get_compute_client(self):

View File

@ -9,6 +9,7 @@ basepython = python3
setenv = VIRTUAL_ENV={envdir} setenv = VIRTUAL_ENV={envdir}
PYTHONWARNINGS=default::DeprecationWarning PYTHONWARNINGS=default::DeprecationWarning
OS_TEST_PATH=heat/tests 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 usedevelop = True
deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master} deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/master}
-r{toxinidir}/requirements.txt -r{toxinidir}/requirements.txt