Ensure access-network address provided if required

When the shared-db relation is joined and the db application
has provided an access-network, ensure that the local address
we provide is withing the access network cidr.

Change-Id: I180ed3f2eebf59848d12b091551cfc038f837f84
Closes-Bug: 1659805
This commit is contained in:
Edward Hope-Morley 2017-09-08 17:09:13 +01:00
parent 1ef3522f86
commit 656cffa5a9
1 changed files with 4 additions and 2 deletions

View File

@ -17,6 +17,7 @@ import subprocess
import charm.openstack.designate as designate
import charms.reactive as reactive
import charmhelpers.core.hookenv as hookenv
import charmhelpers.contrib.network.ip as ip
from charms_openstack.charm import provide_charm_instance
from charms_openstack.charm.utils import is_data_changed
@ -85,10 +86,11 @@ def setup_amqp_req(amqp):
@reactive.when_not('shared-db.setup')
def setup_database(database):
"""Send request designate accounts and dbs"""
hostname = ip.get_address_in_network(database.access_network())
database.configure('designate', 'designate',
prefix='designate')
prefix='designate', hostname=hostname)
database.configure('dpm', 'dpm',
prefix='dpm')
prefix='dpm', hostname=hostname)
reactive.set_state('shared-db.setup')