From a3b4718233d0bd5fd8708998087ea9cac0b78259 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 20 Jan 2022 16:56:00 +0100 Subject: [PATCH] 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 --- keystoneauth1/discover.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/keystoneauth1/discover.py b/keystoneauth1/discover.py index 146bc33e..5faecd05 100644 --- a/keystoneauth1/discover.py +++ b/keystoneauth1/discover.py @@ -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,