CH Sync for rabbit relation bug fix

Charmhelper sync to pick up the fix to the AMQP context.

Change-Id: I1780896e13011f1c93dc69ca59685cd8028c0ee4
Closes-Bug: #1796886
This commit is contained in:
Liam Young 2020-06-25 10:04:17 +00:00
parent 0ce1ee67f8
commit 52ac09b4a1
4 changed files with 25 additions and 6 deletions

View File

@ -721,6 +721,12 @@ class AMQPContext(OSContextGenerator):
rabbitmq_hosts = []
for unit in related_units(rid):
host = relation_get('private-address', rid=rid, unit=unit)
if not relation_get('password', rid=rid, unit=unit):
log(
("Skipping {} password not sent which indicates "
"unit is not ready.".format(host)),
level=DEBUG)
continue
host = format_ipv6_addr(host) or host
rabbitmq_hosts.append(host)
@ -2714,6 +2720,19 @@ class BridgePortInterfaceMap(object):
self._ifname_mac_map[ifname] = [mac]
self._mac_ifname_map[mac] = ifname
# check if interface is part of a linux bond
_bond_name = get_bond_master(ifname)
if _bond_name and _bond_name != ifname:
log('Add linux bond "{}" to map for physical interface "{}" '
'with mac "{}".'.format(_bond_name, ifname, mac),
level=DEBUG)
# for bonds we want to be able to get a list of the mac
# addresses for the physical interfaces the bond is made up of.
if self._ifname_mac_map.get(_bond_name):
self._ifname_mac_map[_bond_name].append(mac)
else:
self._ifname_mac_map[_bond_name] = [mac]
# In light of the pre-deprecation notice in the docstring of this
# class we will expose the ability to configure OVS bonds as a
# DPDK-only feature, but generally use the data structures internally.

View File

@ -248,7 +248,7 @@ def peer_store_and_set(relation_id=None, peer_relation_name='cluster',
@param relation_id: the id of the relation to store the data on. Defaults
to the current relation.
@param peer_store_fatal: Set to True, the function will raise an exception
should the peer sotrage not be avialable."""
should the peer storage not be available."""
relation_settings = relation_settings if relation_settings else {}
relation_set(relation_id=relation_id,

View File

@ -432,13 +432,13 @@ class ReplicatedPool(Pool):
pool=self.name,
name=self.app_name)
except CalledProcessError:
log('Could not set app name for pool {}'.format(self.name, level=WARNING))
log('Could not set app name for pool {}'.format(self.name), level=WARNING)
if 'pg_autoscaler' in enabled_manager_modules():
try:
enable_pg_autoscale(self.service, self.name)
except CalledProcessError as e:
log('Could not configure auto scaling for pool {}: {}'.format(
self.name, e, level=WARNING))
self.name, e), level=WARNING)
except CalledProcessError:
raise
@ -504,7 +504,7 @@ class ErasurePool(Pool):
pool=self.name,
name=self.app_name)
except CalledProcessError:
log('Could not set app name for pool {}'.format(self.name, level=WARNING))
log('Could not set app name for pool {}'.format(self.name), level=WARNING)
if nautilus_or_later:
# Ensure we set the expected pool ratio
update_pool(client=self.service,
@ -515,7 +515,7 @@ class ErasurePool(Pool):
enable_pg_autoscale(self.service, self.name)
except CalledProcessError as e:
log('Could not configure auto scaling for pool {}: {}'.format(
self.name, e, level=WARNING))
self.name, e), level=WARNING)
except CalledProcessError:
raise

View File

@ -69,7 +69,7 @@ def _snap_exec(commands):
.format(SNAP_NO_LOCK_RETRY_COUNT))
return_code = e.returncode
log('Snap failed to acquire lock, trying again in {} seconds.'
.format(SNAP_NO_LOCK_RETRY_DELAY, level='WARN'))
.format(SNAP_NO_LOCK_RETRY_DELAY), level='WARN')
sleep(SNAP_NO_LOCK_RETRY_DELAY)
return return_code