'The charms should be updated to use "network-get <bindname> --preferred-address" instead of just "unit-get private-address". unit-get doesn't pass the information to Juju for us to know which bit of the configuration we're supposed to be reporting.'
In the OpenStack charms most of the time we use charmhelpers.contrib.openstack.ip resolve_address() which does the right thing checking network-get first.
However, we have some isolated instances where unit_get(private-address) is defaulted to. Which according to John can be unpredictable.
Specifically, calls to get_host_ip() functions that return the private-address by default in nova-compute and percona-cluster. Leading to unpredictable IPs in configuration files.
We need to also check other charms for this issue.
Nova compute HostIPContext returns the private-address:
class HostIPContext(context.OSContextGenerator):
def __call__(self):
ctxt = {}
if config('prefer-ipv6'):
host_ip = get_ipv6_addr()[0]
else:
host_ip = get_host_ip(unit_get('private-address'))
if host_ip:
# NOTE: do not format this even for ipv6 (see bug 1499656) ctxt['host_ip'] = host_ip
return ctxt
percona-cluster in render_config returns the private-address:
context = { 'cluster_name': 'juju_cluster', 'private_address': get_host_ip(),
According to John Meinel:
'The charms should be updated to use "network-get <bindname> --preferred- address" instead of just "unit-get private-address". unit-get doesn't pass the information to Juju for us to know which bit of the configuration we're supposed to be reporting.'
In the OpenStack charms most of the time we use charmhelpers. contrib. openstack. ip resolve_address() which does the right thing checking network-get first.
However, we have some isolated instances where unit_get( private- address) is defaulted to. Which according to John can be unpredictable.
Specifically, calls to get_host_ip() functions that return the private-address by default in nova-compute and percona-cluster. Leading to unpredictable IPs in configuration files.
We need to also check other charms for this issue.
Nova compute HostIPContext returns the private-address: context. OSContextGenera tor): 'prefer- ipv6'): ip(unit_ get('private- address' ))
class HostIPContext(
def __call__(self):
ctxt = {}
if config(
host_ip = get_ipv6_addr()[0]
else:
host_ip = get_host_
if host_ip:
ctxt[ 'host_ip' ] = host_ip
# NOTE: do not format this even for ipv6 (see bug 1499656)
return ctxt
percona-cluster in render_config returns the private-address:
'cluster_ name': 'juju_cluster',
'private_ address' : get_host_ip(),
context = {