@hooks.hook('cloud-compute-relation-joined')
def compute_joined(rid=None):
# NOTE(james-page) in MAAS environments the actual hostname is a CNAME
# record so won't get scanned based on private-address which is an IP
# add the hostname configured locally to the relation.
settings = {
'hostname': gethostname(), 'private-address': get_relation_ip( 'cloud-compute', cidr_network=config('os-internal-network')),
}
the get_relation_id command will
a) use os-internal-network if set - legacy approach to multi-networks
b) use the network space binding of the 'cloud-compute' relation
c) fallback to 'unit-get private-address'
Groking the code:
@hooks. hook('cloud- compute- relation- joined' ) joined( rid=None) :
'private- address' : get_relation_ip(
'cloud- compute' , cidr_network= config( 'os-internal- network' )),
def compute_
# NOTE(james-page) in MAAS environments the actual hostname is a CNAME
# record so won't get scanned based on private-address which is an IP
# add the hostname configured locally to the relation.
settings = {
'hostname': gethostname(),
}
the get_relation_id command will
a) use os-internal-network if set - legacy approach to multi-networks
b) use the network space binding of the 'cloud-compute' relation
c) fallback to 'unit-get private-address'