Add cluster to cert commands

This patch will update the certificate api to use the term Cluster
instead of Bay.  Bay will still be supported, but will be deprecated
and removed in a future release.

Change-Id: Ie169162a743320813e636597240941b5dd59ded3
Implements: blueprint rename-bay-to-cluster
This commit is contained in:
Jaycen Grant 2016-08-22 08:38:10 -07:00
parent 54fc369b8a
commit 4ebb5717f1
3 changed files with 14 additions and 14 deletions

View File

@ -20,25 +20,25 @@ class CertClient(client.MagnumClient):
url = "/certificates"
@classmethod
def cert_uri(cls, bay_id):
"""Construct bay uri
def cert_uri(cls, cluster_id):
"""Construct cluster uri
:param bay_id: bay uuid or name
:param cluster_id: cluster uuid or name
:returns: url string
"""
return "{0}/{1}".format(cls.url, bay_id)
return "{0}/{1}".format(cls.url, cluster_id)
def get_cert(self, bay_id, **kwargs):
"""Makes GET /certificates/bay_id request and returns CertEntity
def get_cert(self, cluster_id, **kwargs):
"""Makes GET /certificates/cluster_id request and returns CertEntity
Abstracts REST call to return a single cert based on uuid or name
:param bay_id: bay uuid or name
:returns: response object and BayCollection object
:param cluster_id: cluster uuid or name
:returns: response object and ClusterCollection object
"""
resp, body = self.get(self.cert_uri(bay_id))
resp, body = self.get(self.cert_uri(cluster_id))
return self.deserialize(resp, body, cert_model.CertEntity)
def post_cert(self, model, **kwargs):

View File

@ -182,7 +182,7 @@ Q0uA0aVog3f5iJxCa3Hp5gxbJQ6zV6kJ0TEsuaaOhEko9sdpCoPOnRBm2i/XRD2D
resp, cert_model = self.cert_client.post_cert(cert_data_model)
self.LOG.debug("cert resp: %s" % resp)
self.assertEqual(201, resp.status)
self.assertEqual(cert_model.bay_uuid, cluster_model.uuid)
self.assertEqual(cert_model.cluster_uuid, cluster_model.uuid)
self.assertIsNotNone(cert_model.pem)
self.assertIn('-----BEGIN CERTIFICATE-----', cert_model.pem)
self.assertIn('-----END CERTIFICATE-----', cert_model.pem)

View File

@ -322,11 +322,11 @@ def bay_node_count_patch_data(node_count=2):
return baypatch_model.BayPatchCollection.from_dict(data)
def cert_data(bay_uuid, csr_data):
def cert_data(cluster_uuid, csr_data):
data = {
"bay_uuid": bay_uuid,
"csr": csr_data,
}
"cluster_uuid": cluster_uuid,
"csr": csr_data}
model = cert_model.CertEntity.from_dict(data)
return model