diff options
author | Zane Bitter <zbitter@redhat.com> | 2019-01-29 19:45:48 +1300 |
---|---|---|
committer | Zane Bitter <zbitter@redhat.com> | 2019-01-30 09:27:00 +0000 |
commit | 7a679652207150797376747e0a56605d1a3cad0a (patch) | |
tree | 702af6cf51ec13b4d625337a75346c8fba01c3b9 | |
parent | 9c2ff64360cde8c4cb44b535fadd28b5036f83fd (diff) | |
download | heat-7a679652207150797376747e0a56605d1a3cad0a.tar.gz |
Fix Designate Zone lookup by name
Zones are a concept of the Designate v2 API. Since v1 is still the
default, we need to explicitly use v2 when doing anything to do with
Zones. We were doing this when looking up a zone directly, but not when
falling back to listing all zones and going through them by name. This
meant that designate.zone constraint validation would fail (including on
the 'zone' property of OS::Designate::RecordSet) when the zone was
specified by name rather than UUID.
Change-Id: Id4194a74398488813f901b255f312f7ac962a426
Task: #29162
(cherry picked from commit 8c79ae0aeb8f937f45d94f5f549de344d7ea5817)
-rw-r--r-- | heat/engine/clients/os/designate.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/heat/engine/clients/os/designate.py b/heat/engine/clients/os/designate.py index 6df4785a2..3989e98b5 100644 --- a/heat/engine/clients/os/designate.py +++ b/heat/engine/clients/os/designate.py @@ -57,14 +57,14 @@ class DesignateClientPlugin(client_plugin.ClientPlugin): name=domain_id_or_name) def get_zone_id(self, zone_id_or_name): + client = self.client(version=self.V2) try: - zone_obj = self.client(version=self.V2).zones.get(zone_id_or_name) + zone_obj = client.zones.get(zone_id_or_name) return zone_obj['id'] except exceptions.NotFound: - zones = self.client().zones.list( - criterion=dict(name=zone_id_or_name)) + zones = client.zones.list(criterion=dict(name=zone_id_or_name)) if len(zones) == 1: - return zones[0]['id'] + return zones[0]['id'] raise heat_exception.EntityNotFound(entity='Designate Zone', name=zone_id_or_name) |