Adapter raise_exc=False by default

With the exception of a single spot in the code, every request we were
making through keystoneauth1 Adapter/Session was using raise_exc=False -
i.e. don't raise exceptions on >=400; we process the Response ourselves.

As of keystoneauth1 3.9.0 it is possible to pass a raise_exc kwarg into
the Adapter upon creation, setting that as the default for all requests
on that Adapter.  With this patch, we set raise_exc=False on all Adapter
creations and only override it in the one spot where we were actually
expecting and processing failures as exceptions.

Change-Id: I477afdfce746d405adf77134f57670563fd575e1
This commit is contained in:
Eric Fried
2018-06-22 09:40:33 -05:00
parent 68caa292ce
commit af4d8d3932
10 changed files with 51 additions and 70 deletions

View File

@@ -1175,6 +1175,10 @@ def get_ksa_adapter(service_type, ksa_auth=None, ksa_session=None,
used, ksa auth and/or session options may also be required, or the relevant
parameter supplied.
A raise_exc=False adapter is returned, meaning responses >=400 return the
Response object rather than raising an exception. This behavior can be
overridden on a per-request basis by setting raise_exc=True.
:param service_type: String name of the service type for which the Adapter
is to be constructed.
:param ksa_auth: A keystoneauth1 auth plugin. If not specified, we attempt
@@ -1221,7 +1225,7 @@ def get_ksa_adapter(service_type, ksa_auth=None, ksa_session=None,
return ks_loading.load_adapter_from_conf_options(
CONF, confgrp, session=ksa_session, auth=ksa_auth,
min_version=min_version, max_version=max_version)
min_version=min_version, max_version=max_version, raise_exc=False)
def get_endpoint(ksa_adapter):