Use internal address for cluster comms if connected

This commit is contained in:
James Page 2014-09-26 12:35:16 +01:00
parent a643e2fb6b
commit 861e0dc201
2 changed files with 13 additions and 2 deletions

View File

@ -0,0 +1 @@
swift_hooks.py

View File

@ -54,7 +54,8 @@ from charmhelpers.contrib.openstack.ip import (
)
from charmhelpers.contrib.network.ip import (
get_iface_for_address,
get_netmask_for_address
get_netmask_for_address,
get_address_in_network
)
extra_pkgs = [
@ -208,10 +209,19 @@ def config_changed():
do_openstack_upgrade(CONFIGS)
for r_id in relation_ids('identity-service'):
keystone_joined(relid=r_id)
[cluster_joined(rid) for rid in relation_ids('cluster')]
@hooks.hook('cluster-relation-joined')
def cluster_joined(relation_id=None):
address = get_address_in_network(config('os-internal-network'),
unit_get('private-address'))
relation_set(relation_id=relation_id,
relation_settings={'private-address': address})
@hooks.hook('cluster-relation-changed',
'cluster-relation-joined')
'cluster-relation-departed')
@restart_on_change(restart_map())
def cluster_changed():
CONFIGS.write_all()