Browse Source

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 8c79ae0aeb)
changes/06/673306/1
Zane Bitter 7 months ago
parent
commit
2990b74abc
1 changed files with 4 additions and 4 deletions
  1. 4
    4
      heat/engine/clients/os/designate.py

+ 4
- 4
heat/engine/clients/os/designate.py View File

@@ -57,14 +57,14 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
57 57
                                             name=domain_id_or_name)
58 58
 
59 59
     def get_zone_id(self, zone_id_or_name):
60
+        client = self.client(version=self.V2)
60 61
         try:
61
-            zone_obj = self.client(version=self.V2).zones.get(zone_id_or_name)
62
+            zone_obj = client.zones.get(zone_id_or_name)
62 63
             return zone_obj['id']
63 64
         except exceptions.NotFound:
64
-            zones = self.client().zones.list(
65
-                criterion=dict(name=zone_id_or_name))
65
+            zones = client.zones.list(criterion=dict(name=zone_id_or_name))
66 66
             if len(zones) == 1:
67
-                    return zones[0]['id']
67
+                return zones[0]['id']
68 68
 
69 69
         raise heat_exception.EntityNotFound(entity='Designate Zone',
70 70
                                             name=zone_id_or_name)

Loading…
Cancel
Save