Use dictionaries instead of lists for pool config
To have ability to override any parameter on system level
we need each pools and targets to be presented as dictionaries.
Change-Id: I4393414e6500f3422ee614dde8f4cc4cb91c0b76
diff --git a/designate/files/mitaka/pools.yaml b/designate/files/mitaka/pools.yaml
index 29ca0e5..8cc8a63 100644
--- a/designate/files/mitaka/pools.yaml
+++ b/designate/files/mitaka/pools.yaml
@@ -1,6 +1,6 @@
{%- from "designate/map.jinja" import server with context %}
-{% for pool in server.pools -%}
-- name: {{ pool.name }}
+{% for pool_name, pool in server.pools.iteritems() -%}
+- name: {{ pool_name }}
# The name is immutable. There will be no option to change the name after
# creation and the only way will to change it will be to delete it
# (and all zones associated with it) and recreate it.
@@ -35,7 +35,7 @@
# List out the targets for this pool. For DNS there will be one
# entry for each DNS server, as we have to run rndc command on each server
targets:
- {% for target in pool.targets -%}
+ {% for target_name, target in pool.targets.iteritems() -%}
- type: {{ target.type }}
description: {{ target.description }}
diff --git a/designate/files/ocata/pools.yaml b/designate/files/ocata/pools.yaml
index 29ca0e5..8cc8a63 100644
--- a/designate/files/ocata/pools.yaml
+++ b/designate/files/ocata/pools.yaml
@@ -1,6 +1,6 @@
{%- from "designate/map.jinja" import server with context %}
-{% for pool in server.pools -%}
-- name: {{ pool.name }}
+{% for pool_name, pool in server.pools.iteritems() -%}
+- name: {{ pool_name }}
# The name is immutable. There will be no option to change the name after
# creation and the only way will to change it will be to delete it
# (and all zones associated with it) and recreate it.
@@ -35,7 +35,7 @@
# List out the targets for this pool. For DNS there will be one
# entry for each DNS server, as we have to run rndc command on each server
targets:
- {% for target in pool.targets -%}
+ {% for target_name, target in pool.targets.iteritems() -%}
- type: {{ target.type }}
description: {{ target.description }}
diff --git a/tests/pillar/designate_mitaka.sls b/tests/pillar/designate_mitaka.sls
index dfa90c3..8543c76 100644
--- a/tests/pillar/designate_mitaka.sls
+++ b/tests/pillar/designate_mitaka.sls
@@ -10,7 +10,7 @@
- host: 127.0.1.1
- host: 127.0.2.1
pools:
- - name: default
+ default:
description: 'default pool'
attributes:
service_tier: GOLD
@@ -26,7 +26,8 @@
- host: 127.0.2.1
port: 53
targets:
- - type: bind9
+ default_target:
+ type: bind9
description: 'default target'
masters:
- host: 127.0.0.1
diff --git a/tests/pillar/designate_ocata.sls b/tests/pillar/designate_ocata.sls
index e434138..4022cdb 100644
--- a/tests/pillar/designate_ocata.sls
+++ b/tests/pillar/designate_ocata.sls
@@ -10,7 +10,7 @@
- host: 127.0.1.1
- host: 127.0.2.1
pools:
- - name: default
+ default:
description: 'default pool'
attributes:
service_tier: GOLD
@@ -26,7 +26,8 @@
- host: 127.0.2.1
port: 53
targets:
- - type: bind9
+ default_target:
+ type: bind9
description: 'default target'
masters:
- host: 127.0.0.1