From 0c6e8bed694bf24a55da3f0829b043fa5b45986e Mon Sep 17 00:00:00 2001 From: Arx Cruz Date: Thu, 10 Mar 2022 11:55:20 +0100 Subject: [PATCH] Move dns zone info to use proxy layer Make it compatible with new SDK. Although this one was already using self.con.dns.zones to retrieve the zones, it wasn't using the to_dict(computed=False) and was still removing the location (which is obsolate when you use to_dict. Change-Id: Ie2a5b772acc0c8c8338f6f1da877564a077e3b7a --- ci/roles/dns_zone_info/tasks/main.yml | 8 ++++++++ plugins/modules/dns_zone_info.py | 8 ++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ci/roles/dns_zone_info/tasks/main.yml b/ci/roles/dns_zone_info/tasks/main.yml index 1b796a80..2263b0fa 100644 --- a/ci/roles/dns_zone_info/tasks/main.yml +++ b/ci/roles/dns_zone_info/tasks/main.yml @@ -34,6 +34,14 @@ - zone is not changed - zone.zones | length == 1 +- name: Assert keys exist + assert: + that: + - '["action", "attributes", "created_at", "description", "email", + "links", "masters", "name", "pool_id", "project_id", "serial", + "status", "ttl", "type", "updated_at", "id"] | + difference(zone.zones.0.keys()) | length == 0' + - name: Drop created dns zone openstack.cloud.dns_zone: cloud: "{{ cloud }}" diff --git a/plugins/modules/dns_zone_info.py b/plugins/modules/dns_zone_info.py index 002fa69b..22a3da5c 100644 --- a/plugins/modules/dns_zone_info.py +++ b/plugins/modules/dns_zone_info.py @@ -161,12 +161,8 @@ class DnsZoneInfoModule(OpenStackModule): if ttl: kwargs['ttl'] = ttl - data = [] - - for raw in self.conn.dns.zones(**kwargs): - dt = raw.to_dict() - dt.pop('location') - data.append(dt) + data = [zone.to_dict(computed=False) for zone in + self.conn.dns.zones(**kwargs)] self.exit_json(zones=data, changed=False)