Use Tuskar endpoint from Keystone
Change-Id: Ie8b87b8f62a8efafb4a6fe4947aaa312bfa326f2 Closes-bug: #1288261
This commit is contained in:
parent
7df0c8c17c
commit
1efe2cef2c
@ -10,9 +10,9 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import django.conf
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from openstack_dashboard.api import base
|
from openstack_dashboard.api import base
|
||||||
from openstack_dashboard.api import glance
|
from openstack_dashboard.api import glance
|
||||||
@ -23,17 +23,30 @@ from tuskar_ui.cached_property import cached_property # noqa
|
|||||||
from tuskar_ui.handle_errors import handle_errors # noqa
|
from tuskar_ui.handle_errors import handle_errors # noqa
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
TUSKAR_ENDPOINT_URL = getattr(django.conf.settings, 'TUSKAR_ENDPOINT_URL')
|
|
||||||
MASTER_TEMPLATE_NAME = 'plan.yaml'
|
MASTER_TEMPLATE_NAME = 'plan.yaml'
|
||||||
ENVIRONMENT_NAME = 'environment.yaml'
|
ENVIRONMENT_NAME = 'environment.yaml'
|
||||||
|
TUSKAR_SERVICE = 'management'
|
||||||
|
|
||||||
|
|
||||||
# FIXME: request isn't used right in the tuskar client right now,
|
# FIXME: request isn't used right in the tuskar client right now,
|
||||||
# but looking at other clients, it seems like it will be in the future
|
# but looking at other clients, it seems like it will be in the future
|
||||||
def tuskarclient(request):
|
def tuskarclient(request, password=None):
|
||||||
c = tuskar_client.get_client('2', tuskar_url=TUSKAR_ENDPOINT_URL,
|
api_version = "2"
|
||||||
os_auth_token=request.user.token.id)
|
insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False)
|
||||||
return c
|
ca_file = getattr(settings, 'OPENSTACK_SSL_CACERT', None)
|
||||||
|
endpoint = base.url_for(request, TUSKAR_SERVICE)
|
||||||
|
|
||||||
|
LOG.debug('tuskarclient connection created using token "%s" and url "%s"' %
|
||||||
|
(request.user.token.id, endpoint))
|
||||||
|
|
||||||
|
client = tuskar_client.get_client(api_version,
|
||||||
|
tuskar_url=endpoint,
|
||||||
|
insecure=insecure,
|
||||||
|
ca_file=ca_file,
|
||||||
|
username=request.user.username,
|
||||||
|
password=password,
|
||||||
|
os_auth_token=request.user.token.id)
|
||||||
|
return client
|
||||||
|
|
||||||
|
|
||||||
class OvercloudPlan(base.APIResourceWrapper):
|
class OvercloudPlan(base.APIResourceWrapper):
|
||||||
|
@ -58,6 +58,15 @@ class TestCase(openstack_dashboard_helpers.TestCase):
|
|||||||
# load tuskar-specific test data
|
# load tuskar-specific test data
|
||||||
test_data_utils.load_test_data(self)
|
test_data_utils.load_test_data(self)
|
||||||
|
|
||||||
|
# Reload the service catalog
|
||||||
|
tenants = self.context['authorized_tenants']
|
||||||
|
self.setActiveUser(id=self.user.id,
|
||||||
|
token=self.token,
|
||||||
|
username=self.user.name,
|
||||||
|
tenant_id=self.tenant.id,
|
||||||
|
service_catalog=self.service_catalog,
|
||||||
|
authorized_tenants=tenants)
|
||||||
|
|
||||||
|
|
||||||
class BaseAdminViewTests(openstack_dashboard_helpers.BaseAdminViewTests):
|
class BaseAdminViewTests(openstack_dashboard_helpers.BaseAdminViewTests):
|
||||||
"""A ``TestCase`` subclass which sets an active user with the "admin" role
|
"""A ``TestCase`` subclass which sets an active user with the "admin" role
|
||||||
@ -80,3 +89,12 @@ class APITestCase(openstack_dashboard_helpers.APITestCase):
|
|||||||
|
|
||||||
# load tuskar-specfic test data
|
# load tuskar-specfic test data
|
||||||
test_data_utils.load_test_data(self)
|
test_data_utils.load_test_data(self)
|
||||||
|
|
||||||
|
# Reload the service catalog
|
||||||
|
tenants = self.context['authorized_tenants']
|
||||||
|
self.setActiveUser(id=self.user.id,
|
||||||
|
token=self.token,
|
||||||
|
username=self.user.name,
|
||||||
|
tenant_id=self.tenant.id,
|
||||||
|
service_catalog=self.service_catalog,
|
||||||
|
authorized_tenants=tenants)
|
||||||
|
30
tuskar_ui/test/test_data/keystone_data.py
Normal file
30
tuskar_ui/test/test_data/keystone_data.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
|
||||||
|
|
||||||
|
def data(TEST):
|
||||||
|
|
||||||
|
# Add tuskar to the keystone data
|
||||||
|
TEST.service_catalog.append(
|
||||||
|
{"type": "management",
|
||||||
|
"name": "tuskar",
|
||||||
|
"endpoints_links": [],
|
||||||
|
"endpoints": [
|
||||||
|
{"region": "RegionOne",
|
||||||
|
"adminURL": "http://admin.tuskar.example.com:8585/v2",
|
||||||
|
"internalURL": "http://int.tuskar.example.com:8585/v2",
|
||||||
|
"publicURL": "http://public.tuskar.example.com:8585/v2"},
|
||||||
|
{"region": "RegionTwo",
|
||||||
|
"adminURL": "http://admin.tuskar2.example.com:8585/v2",
|
||||||
|
"internalURL": "http://int.tuskar2.example.com:8585/v2",
|
||||||
|
"publicURL": "http://public.tuskar2.example.com:8585/v2"}]},
|
||||||
|
)
|
@ -25,6 +25,7 @@ def load_test_data(load_onto=None):
|
|||||||
from tuskar_ui.test.test_data import exceptions
|
from tuskar_ui.test.test_data import exceptions
|
||||||
from tuskar_ui.test.test_data import flavor_data
|
from tuskar_ui.test.test_data import flavor_data
|
||||||
from tuskar_ui.test.test_data import heat_data as tuskar_heat_data
|
from tuskar_ui.test.test_data import heat_data as tuskar_heat_data
|
||||||
|
from tuskar_ui.test.test_data import keystone_data as tuskar_keystone_data
|
||||||
from tuskar_ui.test.test_data import node_data
|
from tuskar_ui.test.test_data import node_data
|
||||||
from tuskar_ui.test.test_data import tuskar_data
|
from tuskar_ui.test.test_data import tuskar_data
|
||||||
|
|
||||||
@ -40,6 +41,7 @@ def load_test_data(load_onto=None):
|
|||||||
flavor_data.data,
|
flavor_data.data,
|
||||||
node_data.data,
|
node_data.data,
|
||||||
tuskar_heat_data.data,
|
tuskar_heat_data.data,
|
||||||
|
tuskar_keystone_data.data,
|
||||||
tuskar_data.data)
|
tuskar_data.data)
|
||||||
if load_onto:
|
if load_onto:
|
||||||
for data_func in loaders:
|
for data_func in loaders:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user