User-friendly error message for DiscoveryFailure

The passage about discovery document and allow_version_hack makes little
sense for people unfamiliar with keystoneauth internals. What it
actually means in most cases is that the remote service is not
available. Rephrase the error message and add some debug logging.

Change-Id: I156dbb45bd8c07ace1900894f6779ed9f38cf3c6
This commit is contained in:
Dmitry Tantsur 2022-01-20 16:56:00 +01:00
parent 112bcae1fb
commit a3b4718233
1 changed files with 6 additions and 3 deletions

View File

@ -1216,7 +1216,8 @@ class EndpointData(object):
break
except (exceptions.DiscoveryFailure,
exceptions.HttpError,
exceptions.ConnectionError):
exceptions.ConnectionError) as exc:
_LOGGER.debug('No version document at %s: %s', vers_url, exc)
continue
if not self._disc:
# We couldn't find a version discovery document anywhere.
@ -1247,8 +1248,10 @@ class EndpointData(object):
# date enough to properly specify a version and keystoneauth
# can't deliver.
raise exceptions.DiscoveryFailure(
"Version requested but version discovery document was not"
" found and allow_version_hack was False")
"Unable to find a version discovery document at %s, "
"the service is unavailable or misconfigured. "
"Required version range (%s - %s), version hack disabled."
% (self.url, min_version or "any", max_version or "any"))
def _get_discovery_url_choices(
self, project_id=None, allow_version_hack=True,