Implement "dns-backend" binding

This patchset implements "dns-backend" binding which is required to
properly handle DNS zone transfers between designate and
desigante-bind applications. If "dns-backend" binding is provided
when deploying designate and designate-bind applications, DNZ zone
transfers will now take place over the subnet which belongs to the
provided space.

Change-Id: Icbe0cc790c565f125f0fe8c903e9b755fe764d7c
Depends-On: I927e3958cf929ace9d43f8b3d9509b90b9eab60f
Partial-Bug: #1722794
This commit is contained in:
Tytus Kurek 2017-10-12 17:26:07 +02:00
parent ce297c9a61
commit f514bb5a17
2 changed files with 5 additions and 2 deletions

View File

@ -28,6 +28,8 @@ import charmhelpers.core.decorators as ch_decorators
import charmhelpers.core.hookenv as hookenv
import charmhelpers.core.host as host
from charmhelpers.contrib.network import ip as ch_ip
LEADERDB_SECRET_KEY = 'rndc_key'
LEADERDB_SYNC_SRC_KEY = 'sync_src'
@ -160,7 +162,7 @@ class DNSAdapter(adapters.OpenStackRelationAdapter):
:returns: str: IP local rndc listens on
"""
return hookenv.unit_private_ip()
return ch_ip.get_relation_ip('dns-backend')
@property
def control_ips(self):

View File

@ -141,8 +141,9 @@ class TestDNSAdapter(Helper):
def test_control_listen_ip(self):
relation = mock.MagicMock()
self.patch(designate_bind.ch_ip, 'get_relation_ip')
self.patch(designate_bind.hookenv, 'unit_private_ip')
self.unit_private_ip.return_value = 'ip1'
self.get_relation_ip.return_value = 'ip1'
a = designate_bind.DNSAdapter(relation)
self.assertEqual(a.control_listen_ip, 'ip1')