Rename designate domains to zones

In anticipation of the Big Rename, rename domains to zones. This helps
be less conflicty with keystone.

Change-Id: I6e9ad746b0fdafae81ce76f77fa12c7ad8907bd4
Blueprint: the-big-rename
This commit is contained in:
Monty Taylor 2015-10-19 15:39:33 -04:00
parent ef613d4cd5
commit 6afb7ad42f
3 changed files with 28 additions and 27 deletions

View File

@ -959,12 +959,12 @@ class OpenStackCloud(object):
floating_ips = self.list_floating_ips()
return _utils._filter_list(floating_ips, id, filters)
def search_domains(self, name_or_id=None, filters=None):
domains = self.list_domains()
return _utils._filter_list(domains, name_or_id, filters)
def search_zones(self, name_or_id=None, filters=None):
zones = self.list_zones()
return _utils._filter_list(zones, name_or_id, filters)
def search_records(self, domain_id, name_or_id=None, filters=None):
records = self.list_records(domain_id=domain_id)
def search_records(self, zone_id, name_or_id=None, filters=None):
records = self.list_records(zone_id=zone_id)
return _utils._filter_list(records, name_or_id, filters)
def list_keypairs(self):
@ -1235,21 +1235,22 @@ class OpenStackCloud(object):
raise OpenStackCloudException(
"error fetching floating IPs list: {msg}".format(msg=str(e)))
def list_domains(self):
"""List all available DNS domains.
def list_zones(self):
"""List all available DNS zones.
:returns: A list of domain dicts.
:returns: A list of zone dicts.
"""
try:
return self.manager.submitTask(_tasks.DomainList())
return self.manager.submitTask(_tasks.ZoneList())
except Exception as e:
raise OpenStackCloudException(
"Error fetching domain list: %s" % e)
"Error fetching zone list: %s" % e)
def list_records(self, domain_id):
def list_records(self, zone_id):
# TODO(mordred) switch domain= to zone= after the Big Rename
try:
return self.manager.submitTask(_tasks.RecordList(domain=domain_id))
return self.manager.submitTask(_tasks.RecordList(domain=zone_id))
except Exception as e:
raise OpenStackCloudException(
"Error fetching record list: %s" % e)
@ -1561,10 +1562,10 @@ class OpenStackCloud(object):
"""
return _utils._get_entity(self.search_floating_ips, id, filters)
def get_domain(self, name_or_id, filters=None):
"""Get a DNS domain by name or ID.
def get_zone(self, name_or_id, filters=None):
"""Get a DNS zone by name or ID.
:param name_or_id: Name or ID of the DNS domain.
:param name_or_id: Name or ID of the DNS zone.
:param dict filters:
A dictionary of meta data to use for further filtering. Elements
of this dictionary may, themselves, be dictionaries. Example::
@ -1576,15 +1577,15 @@ class OpenStackCloud(object):
}
}
:returns: A domain dict or None if no matching DNS domain is
:returns: A zone dict or None if no matching DNS zone is
found.
"""
return _utils._get_entity(self.search_domains, name_or_id, filters)
return _utils._get_entity(self.search_zones, name_or_id, filters)
def get_record(self, domain_id, name_or_id, filters=None):
def get_record(self, zone_id, name_or_id, filters=None):
f = lambda name_or_id, filters: self.search_records(
domain_id, name_or_id, filters)
zone_id, name_or_id, filters)
return _utils._get_entity(f, name_or_id, filters)
def create_keypair(self, name, public_key):

View File

@ -566,12 +566,12 @@ class IdentityDomainDelete(task_manager.Task):
return client.keystone_client.domains.delete(**self.args)
class DomainList(task_manager.Task):
class ZoneList(task_manager.Task):
def main(self, client):
return client.designate_client.domains.list()
class DomainGet(task_manager.Task):
class ZoneGet(task_manager.Task):
def main(self, client):
return client.designate_client.domains.get(**self.args)

View File

@ -368,13 +368,13 @@ class TestShade(base.TestCase):
self.assertRaises(exc.OpenStackCloudException,
self.cloud.list_networks)
@mock.patch.object(shade.OpenStackCloud, 'list_domains')
def test_get_domain(self, mock_search):
domain1 = dict(id='123', name='mickey')
mock_search.return_value = [domain1]
r = self.cloud.get_domain('mickey')
@mock.patch.object(shade.OpenStackCloud, 'list_zones')
def test_get_zone(self, mock_search):
zone1 = dict(id='123', name='mickey')
mock_search.return_value = [zone1]
r = self.cloud.get_zone('mickey')
self.assertIsNotNone(r)
self.assertDictEqual(domain1, r)
self.assertDictEqual(zone1, r)
@mock.patch.object(shade.OpenStackCloud, 'list_records')
def test_get_record(self, mock_search):