call sm-api through mgmt interface

As part of creating independent sm-api, sm-api binds to mgmt and oam
floating interface.
With this change, horizon retrieves sm-api service endpoint and
accesses sm-api via the endpoint.

Story: 2002827
Taks: 22745

Depends-On: I743f6b0f09c06325d3c9dc6e11902420882e7931
Change-Id: I6e264d868db7862772840149e7452a352eda9e9f
Signed-off-by: Bin Qian <bin.qian@windriver.com>
This commit is contained in:
Bin Qian 2018-07-03 09:19:29 -04:00
parent a814981a9f
commit 314a64a34f
1 changed files with 4 additions and 5 deletions

View File

@ -19,21 +19,20 @@ import logging
from django.conf import settings
import sm_client as smc
from openstack_dashboard.api import base
# Swap out with SM API
LOG = logging.getLogger(__name__)
SM_API_SERVICENAME = "smapi"
def sm_client(request):
# o = urlparse.urlparse(url_for(request, 'inventory'))
# url = "://".join((o.scheme, o.netloc))
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
# LOG.debug('sysinv client conn using token "%s" and url "%s"'
# % (request.user.token.id, url))
# return smc.Client('1', url, token=request.user.token.id,
# insecure=insecure)
return smc.Client('1', 'http://localhost:7777',
sm_api_path = base.url_for(request, SM_API_SERVICENAME)
return smc.Client('1', sm_api_path,
token=request.user.token.id,
insecure=insecure)