Change default endpoint_type to "public"

Change-Id: Ic8935d3069225d95ef800e98c1d9c842f17b4639
This commit is contained in:
Rohan Kanade 2014-10-06 14:20:24 +02:00
parent bf8381435d
commit d3ba7792f4
7 changed files with 37 additions and 29 deletions

View File

@ -2,7 +2,7 @@
"type": "ExistingCloud",
"auth_url": "http://example.net:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "internal",
"endpoint_type": "public",
"admin_port": 35357,
"admin": {
"username": "admin",

View File

@ -2,7 +2,7 @@
"type": "ExistingCloud",
"auth_url": "http://example.net:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "internal",
"endpoint_type": "public",
"admin_port": 35357,
"admin": {
"username": "admin",

View File

@ -57,12 +57,12 @@ This engine in fact does not deploy anything, but uses an existing OpenStack ins
{
"type": "ExistingCloud",
"endpoint": {
"auth_url": "http://192.168.122.22:5000/v2.0/",
"auth_url": "http://192.168.122.22:5000/v2.0/",
"endpoint_type": "public",
"admin": {
"username": "admin",
"password": "password",
"tenant_name": "admin",
"endpoint_type": "internal"
}
}
@ -71,17 +71,17 @@ Or using keystone v3 API endpoint:
.. code-block:: none
{
"type": "ExistingCloud,
"endpoint": {
"auth_url": "http://localhost:5000/v3/,
"username": "engineer1,
"user_domain_name": "qa,
"project_name": "qa_admin_project,
"project_domain_name": "qa,
"password": "password,
"region_name": "RegionOne,
"endpoint_type": "internal",
"admin_port": 35357
"type": "ExistingCloud",
"auth_url": "http://localhost:5000/v3/",
"endpoint_type": "public",
"admin_port": 35357,
"admin": {
"username": "engineer1",
"user_domain_name": "qa",
"project_name": "qa_admin_project",
"project_domain_name": "qa",
"password": "password",
"region_name": "RegionOne",
}
}
..

View File

@ -27,7 +27,7 @@ class ExistingCloud(engine.EngineFactory):
"type": "ExistingCloud",
"auth_url": "http://localhost:5000/v2.0/",
"region_name": "RegionOne",
"endpoint_type": "admin",
"endpoint_type": "public",
"admin_port": 35357,
"admin": {
"username": "admin",
@ -42,7 +42,7 @@ class ExistingCloud(engine.EngineFactory):
"type": "ExistingCloud",
"auth_url": "http://localhost:5000/v3/",
"region_name": "RegionOne",
"endpoint_type": "admin",
"endpoint_type": "public",
"admin_port": 35357,
"admin": {
"username": "admin",
@ -123,7 +123,7 @@ class ExistingCloud(engine.EngineFactory):
permission=permission,
region_name=common.get("region_name"),
endpoint_type=common.get("endpoint_type",
consts.EndpointType.INTERNAL),
consts.EndpointType.PUBLIC),
admin_port=common.get("admin_port", 35357),
domain_name=user.get("domain_name"),
user_domain_name=user.get("user_domain_name", "Default"),

View File

@ -20,7 +20,7 @@ class Endpoint(object):
def __init__(self, auth_url, username, password, tenant_name=None,
permission=consts.EndpointPermission.USER,
region_name=None, endpoint_type=consts.EndpointType.INTERNAL,
region_name=None, endpoint_type=consts.EndpointType.PUBLIC,
admin_port=35357, domain_name=None,
user_domain_name='Default',
project_domain_name='Default'):

View File

@ -27,7 +27,7 @@ class EndpointTestCase(test.TestCase):
"password": "pwd", "tenant_name": "tenant",
"region_name": None, "permission": "admin",
"domain_name": None,
"endpoint_type": consts.EndpointType.INTERNAL,
"endpoint_type": consts.EndpointType.PUBLIC,
"project_domain_name": "Default",
"user_domain_name": "Default",
'admin_port': 35357})

View File

@ -13,6 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import urlparse
from keystoneclient import exceptions as keystone_exceptions
import mock
from oslo.config import cfg
@ -50,8 +52,14 @@ class OSClientsTestCase(test.TestCase):
self.assertTrue("keystone" not in self.clients.cache)
client = self.clients.keystone()
self.assertEqual(client, self.fake_keystone)
mgmt_url = urlparse.urlparse(self.endpoint.auth_url)
auth_url = "{0}://{1}:{2}{3}".format(mgmt_url.scheme,
mgmt_url.hostname,
self.endpoint.admin_port,
mgmt_url.path)
endpoint = {"timeout": cfg.CONF.openstack_client_http_timeout,
"insecure": False, "cacert": None}
"insecure": False, "cacert": None,
"endpoint": auth_url}
kwargs = dict(self.endpoint.to_dict().items() + endpoint.items())
self.mock_create_keystone_client.assert_called_once_with(kwargs)
self.assertEqual(self.clients.cache["keystone"], self.fake_keystone)
@ -86,7 +94,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_nova)
self.service_catalog.url_for.assert_called_once_with(
service_type='compute',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
mock_nova.Client.assert_called_once_with(
"2",
@ -113,7 +121,7 @@ class OSClientsTestCase(test.TestCase):
"ca_cert": cfg.CONF.https_cacert
}
self.service_catalog.url_for.assert_called_once_with(
service_type='network', endpoint_type=consts.EndpointType.INTERNAL,
service_type='network', endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
mock_neutron.Client.assert_called_once_with("2.0", **kw)
self.assertEqual(self.clients.cache["neutron"], fake_neutron)
@ -131,7 +139,7 @@ class OSClientsTestCase(test.TestCase):
"insecure": False, "cacert": None}
self.service_catalog.url_for.assert_called_once_with(
service_type='image',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
mock_glance.Client.assert_called_once_with("1", **kw)
self.assertEqual(self.clients.cache["glance"], fake_glance)
@ -146,7 +154,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_cinder)
self.service_catalog.url_for.assert_called_once_with(
service_type='volume',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
mock_cinder.Client.assert_called_once_with(
"1", None, None, http_log_debug=False,
@ -168,7 +176,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_ceilometer)
self.service_catalog.url_for.assert_called_once_with(
service_type='metering',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
kw = {"endpoint": self.service_catalog.url_for.return_value,
"token": self.fake_keystone.auth_token,
@ -187,7 +195,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_ironic)
self.service_catalog.url_for.assert_called_once_with(
service_type='baremetal',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
kw = {
"os_auth_token": self.fake_keystone.auth_token,
@ -224,7 +232,7 @@ class OSClientsTestCase(test.TestCase):
self.assertEqual(client, fake_zaqar)
self.service_catalog.url_for.assert_called_once_with(
service_type='messaging',
endpoint_type=consts.EndpointType.INTERNAL,
endpoint_type=consts.EndpointType.PUBLIC,
region_name=self.endpoint.region_name)
fake_zaqar_url = self.service_catalog.url_for.return_value
conf = {'auth_opts': {'backend': 'keystone', 'options': {