Rename clustering to cluster service
This patch renames the 'clustering' service to 'cluster' service and makes it appear in the profile module. Change-Id: Iea0f0041ec4860ef0226cad4d28e5f63bacbe69c
This commit is contained in:
parent
506c07d93c
commit
4530cbbd55
|
@ -13,15 +13,15 @@
|
|||
from openstack.auth import service_filter
|
||||
|
||||
|
||||
class ClusteringService(service_filter.ServiceFilter):
|
||||
"""The clustering service."""
|
||||
class ClusterService(service_filter.ServiceFilter):
|
||||
"""The cluster service."""
|
||||
|
||||
valid_versions = [service_filter.ValidVersion('v1')]
|
||||
UNVERSIONED = None
|
||||
|
||||
def __init__(self, version=None):
|
||||
"""Create a clustering service."""
|
||||
super(ClusteringService, self).__init__(
|
||||
"""Create a cluster service."""
|
||||
super(ClusterService, self).__init__(
|
||||
service_type='clustering',
|
||||
version=version
|
||||
)
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.clustering.v1 import cluster
|
||||
from openstack.cluster.v1 import cluster
|
||||
from openstack import proxy
|
||||
|
||||
|
||||
|
@ -20,11 +20,11 @@ class Proxy(proxy.BaseProxy):
|
|||
"""Create a new cluster from attributes.
|
||||
|
||||
:param dict attrs: Keyword arguments that will be used to create a
|
||||
:class:`~openstack.clustering.v1.cluster.Cluster`, it is comprised
|
||||
:class:`~openstack.cluster.v1.cluster.Cluster`, it is comprised
|
||||
of the properties on the Cluster class.
|
||||
|
||||
:returns: The results of cluster creation.
|
||||
:rtype: :class:`~openstack.clustering.v1.cluster.Cluster`.
|
||||
:rtype: :class:`~openstack.cluster.v1.cluster.Cluster`.
|
||||
"""
|
||||
return self._create(cluster.Cluster, **attrs)
|
||||
|
||||
|
@ -32,7 +32,7 @@ class Proxy(proxy.BaseProxy):
|
|||
"""Delete a cluster.
|
||||
|
||||
:param value: The value can be either the name or ID of a cluster or a
|
||||
:class:`~openstack.clustering.v1.cluster.Cluster` instance.
|
||||
:class:`~openstack.cluster.v1.cluster.Cluster` instance.
|
||||
:param bool ignore_missing: When set to ``False``, an exception
|
||||
:class:`~openstack.exceptions.ResourceNotFound` will be raised when
|
||||
the cluster could not be found. When set to ``True``, no exception
|
||||
|
@ -46,7 +46,7 @@ class Proxy(proxy.BaseProxy):
|
|||
"""Find a single cluster.
|
||||
|
||||
:param name_or_id: The name or ID of a cluster.
|
||||
:returns: One :class:`~openstack.clustering.v1.cluster.Cluster` object
|
||||
:returns: One :class:`~openstack.cluster.v1.cluster.Cluster` object
|
||||
or None
|
||||
"""
|
||||
return cluster.Cluster.find(self.session, name_or_id)
|
||||
|
@ -55,9 +55,9 @@ class Proxy(proxy.BaseProxy):
|
|||
"""Get a single cluster.
|
||||
|
||||
:param name_or_id: The value can be the name or ID of a cluster or a
|
||||
:class:`~openstack.clustering.v1.cluster.Cluster` instance.
|
||||
:class:`~openstack.cluster.v1.cluster.Cluster` instance.
|
||||
|
||||
:returns: One :class:`~openstack.clustering.v1.cluster.Cluster`
|
||||
:returns: One :class:`~openstack.cluster.v1.cluster.Cluster`
|
||||
:raises: :class:`~openstack.exceptions.ResourceNotFound` when no
|
||||
cluster matching the criteria could be found.
|
||||
"""
|
||||
|
@ -91,11 +91,11 @@ class Proxy(proxy.BaseProxy):
|
|||
"""Update a cluster.
|
||||
|
||||
:param value: Either the name or the ID of the cluster, or an instance
|
||||
of :class:`~openstack.clustering.v1.cluster.Cluster`.
|
||||
of :class:`~openstack.cluster.v1.cluster.Cluster`.
|
||||
:param attrs: The attributes to update on the cluster represented by
|
||||
the ``value`` parameter.
|
||||
|
||||
:returns: The updated cluster.
|
||||
:rtype: :class:`~openstack.clustering.v1.cluster.Cluster`
|
||||
:rtype: :class:`~openstack.cluster.v1.cluster.Cluster`
|
||||
"""
|
||||
return self._update(cluster.Cluster, value, **attrs)
|
|
@ -10,7 +10,7 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.clustering import clustering_service
|
||||
from openstack.cluster import cluster_service
|
||||
from openstack import resource
|
||||
from openstack import utils
|
||||
|
||||
|
@ -19,7 +19,7 @@ class Cluster(resource.Resource):
|
|||
resource_key = 'cluster'
|
||||
resources_key = 'clusters'
|
||||
base_path = '/clusters'
|
||||
service = clustering_service.ClusteringService()
|
||||
service = cluster_service.ClusterService()
|
||||
|
||||
# capabilities
|
||||
allow_create = True
|
|
@ -11,7 +11,7 @@
|
|||
# under the License.
|
||||
|
||||
|
||||
from openstack.clustering import clustering_service
|
||||
from openstack.cluster import cluster_service
|
||||
from openstack import resource
|
||||
|
||||
|
||||
|
@ -19,8 +19,8 @@ class Version(resource.Resource):
|
|||
resource_key = 'version'
|
||||
resources_key = 'versions'
|
||||
base_path = '/'
|
||||
service = clustering_service.ClusteringService(
|
||||
version=clustering_service.ClusteringService.UNVERSIONED
|
||||
service = cluster_service.ClusterService(
|
||||
version=cluster_service.ClusterService.UNVERSIONED
|
||||
)
|
||||
|
||||
# capabilities
|
|
@ -53,6 +53,7 @@ The resulting preference print out would look something like::
|
|||
|
||||
import six
|
||||
|
||||
from openstack.cluster import cluster_service
|
||||
from openstack.compute import compute_service
|
||||
from openstack.database import database_service
|
||||
from openstack import exceptions
|
||||
|
@ -88,6 +89,9 @@ class Profile(object):
|
|||
than brute force create all the services. Maybe use entry points
|
||||
or something, but I'd like to leave that work for another commit.
|
||||
"""
|
||||
serv = cluster_service.ClusterService()
|
||||
serv.set_visibility(None)
|
||||
self._services[serv.service_type] = serv
|
||||
serv = compute_service.ComputeService()
|
||||
serv.set_visibility(None)
|
||||
self._services[serv.service_type] = serv
|
||||
|
|
|
@ -12,13 +12,13 @@
|
|||
|
||||
import testtools
|
||||
|
||||
from openstack.clustering import clustering_service
|
||||
from openstack.cluster import cluster_service
|
||||
|
||||
|
||||
class TestClusteringService(testtools.TestCase):
|
||||
class TestClusterService(testtools.TestCase):
|
||||
|
||||
def test_service(self):
|
||||
sot = clustering_service.ClusteringService()
|
||||
sot = cluster_service.ClusterService()
|
||||
self.assertEqual('clustering', sot.service_type)
|
||||
self.assertEqual('public', sot.visibility)
|
||||
self.assertIsNone(sot.region)
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
import testtools
|
||||
|
||||
from openstack.clustering import version
|
||||
from openstack.cluster import version
|
||||
|
||||
IDENTIFIER = 'IDENTIFIER'
|
||||
EXAMPLE = {
|
|
@ -13,7 +13,7 @@
|
|||
import mock
|
||||
import testtools
|
||||
|
||||
from openstack.clustering.v1 import cluster
|
||||
from openstack.cluster.v1 import cluster
|
||||
|
||||
|
||||
FAKE_ID = '092d0955-2645-461a-b8fa-6a44655cdb2c'
|
|
@ -10,14 +10,14 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from openstack.clustering.v1 import _proxy
|
||||
from openstack.clustering.v1 import cluster
|
||||
from openstack.cluster.v1 import _proxy
|
||||
from openstack.cluster.v1 import cluster
|
||||
from openstack.tests.unit import test_proxy_base
|
||||
|
||||
|
||||
class TestClusteringProxy(test_proxy_base.TestProxyBase):
|
||||
class TestClusterProxy(test_proxy_base.TestProxyBase):
|
||||
def setUp(self):
|
||||
super(TestClusteringProxy, self).setUp()
|
||||
super(TestClusterProxy, self).setUp()
|
||||
self.proxy = _proxy.Proxy(self.session)
|
||||
|
||||
def test_cluster_create(self):
|
||||
|
@ -30,7 +30,7 @@ class TestClusteringProxy(test_proxy_base.TestProxyBase):
|
|||
self.verify_delete(self.proxy.delete_cluster, cluster.Cluster, True)
|
||||
|
||||
def test_cluster_find(self):
|
||||
self.verify_find('openstack.clustering.v1.cluster.Cluster.find',
|
||||
self.verify_find('openstack.cluster.v1.cluster.Cluster.find',
|
||||
self.proxy.find_cluster)
|
||||
|
||||
def test_cluster_get(self):
|
|
@ -106,6 +106,8 @@ class TestConnection(base.TestCase):
|
|||
self.assertEqual(self.xport, conn.session.transport)
|
||||
self.assertEqual(self.auth, conn.session.authenticator)
|
||||
self.assertEqual(self.prof, conn.session.profile)
|
||||
self.assertEqual('openstack.cluster.v1._proxy',
|
||||
conn.cluster.__class__.__module__)
|
||||
self.assertEqual('openstack.compute.v2._proxy',
|
||||
conn.compute.__class__.__module__)
|
||||
self.assertEqual('openstack.database.v1._proxy',
|
||||
|
|
|
@ -19,6 +19,7 @@ class TestProfile(base.TestCase):
|
|||
def test_init(self):
|
||||
prof = profile.Profile()
|
||||
expected = [
|
||||
'clustering',
|
||||
'compute',
|
||||
'database',
|
||||
'identity',
|
||||
|
@ -39,6 +40,9 @@ class TestProfile(base.TestCase):
|
|||
self.assertEqual(None, prof.get_preference('compute'))
|
||||
prof.set_version('compute', 'v2')
|
||||
self.assertEqual('v2', prof.get_preference('compute').version)
|
||||
self.assertEqual(None, prof.get_preference('clustering'))
|
||||
prof.set_version('clustering', 'v1')
|
||||
self.assertEqual('v1', prof.get_preference('clustering').version)
|
||||
self.assertEqual(None, prof.get_preference('database'))
|
||||
prof.set_version('database', 'v3')
|
||||
self.assertEqual('v3', prof.get_preference('database').version)
|
||||
|
|
Loading…
Reference in New Issue