Don't try to predetermine the Sahara URL
Because guess what, times have changed. When that code was written version discovery wasn't what it is today... Without this change, we couldn't handle unversioned endpoints in the service catalog. Closes-Bug: #1745083 Change-Id: Ie82e8a67b2820909625719c5f8a39ca0e1e2fbc0
This commit is contained in:
parent
e10d47861d
commit
8f2dfd7a8f
|
@ -12,6 +12,8 @@
|
|||
# limitations under the License.
|
||||
|
||||
from django.conf import settings
|
||||
from keystoneauth1 import identity
|
||||
from keystoneauth1 import session
|
||||
from saharaclient.api.base import APIException
|
||||
from saharaclient.api.base import Page
|
||||
from saharaclient import client as api_client
|
||||
|
@ -26,8 +28,6 @@ from sahara_dashboard import utils as u
|
|||
|
||||
# "type" of Sahara service registered in keystone
|
||||
SAHARA_SERVICE = 'data-processing'
|
||||
# Sahara service_type registered in Juno
|
||||
SAHARA_SERVICE_FALLBACK = 'data_processing'
|
||||
|
||||
try:
|
||||
SAHARA_FLOATING_IP_DISABLED = getattr(
|
||||
|
@ -91,21 +91,16 @@ def safe_call(func, *args, **kwargs):
|
|||
|
||||
@memoized
|
||||
def client(request):
|
||||
try:
|
||||
service_type = SAHARA_SERVICE
|
||||
sahara_url = base.url_for(request, service_type)
|
||||
except exceptions.ServiceCatalogException:
|
||||
# if no endpoint found, fallback to the old service_type
|
||||
service_type = SAHARA_SERVICE_FALLBACK
|
||||
sahara_url = base.url_for(request, service_type)
|
||||
|
||||
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||
cacert = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||
# TODO(jfreud): pass token directly to client after bug 1747838 resolved
|
||||
auth = identity.Token(auth_url=request.user.endpoint,
|
||||
token=request.user.token.id,
|
||||
project_id=request.user.project_id)
|
||||
sess = session.Session(auth=auth)
|
||||
return api_client.Client(VERSIONS.get_active_version()["version"],
|
||||
sahara_url=sahara_url,
|
||||
service_type=service_type,
|
||||
project_id=request.user.project_id,
|
||||
input_auth_token=request.user.token.id,
|
||||
service_type=SAHARA_SERVICE,
|
||||
session=sess,
|
||||
insecure=insecure,
|
||||
cacert=cacert)
|
||||
|
||||
|
|
Loading…
Reference in New Issue