Ensure HA resources are configured
The barbican charm was missing a configure_ha_resources call when the ha relation is connected. This led to HA deploys missing a VIP resources. This change enables barbican to run configure_ha_resources when the ha relation is connected as the other OpenStack reactive charms do. Change-Id: I92121af2621b9f7d9a7b2eb993abe522d4b0f1a5 Closes-Bug: #1820290
This commit is contained in:
parent
fac18726b7
commit
e7f0a8ad65
@ -123,7 +123,7 @@ class BarbicanCharm(charms_openstack.charm.HAOpenStackCharm):
|
|||||||
BARBICAN_WSGI_CONF: services,
|
BARBICAN_WSGI_CONF: services,
|
||||||
}
|
}
|
||||||
|
|
||||||
ha_resources = ['vips', 'haproxy']
|
ha_resources = ['vips', 'haproxy', 'dnsha']
|
||||||
|
|
||||||
# Package for release version detection
|
# Package for release version detection
|
||||||
release_pkg = 'barbican-common'
|
release_pkg = 'barbican-common'
|
||||||
|
@ -68,3 +68,12 @@ def secrets_plugin_configure():
|
|||||||
reactive.clear_flag('secrets.new-plugin')
|
reactive.clear_flag('secrets.new-plugin')
|
||||||
reactive.set_flag('secrets.available')
|
reactive.set_flag('secrets.available')
|
||||||
reactive.set_flag('config.changed')
|
reactive.set_flag('config.changed')
|
||||||
|
|
||||||
|
|
||||||
|
@reactive.when('ha.connected')
|
||||||
|
@reactive.when_not('ha.available')
|
||||||
|
def cluster_connected(hacluster):
|
||||||
|
"""Configure HA resources in corosync."""
|
||||||
|
with charm.provide_charm_instance() as barbican_charm:
|
||||||
|
barbican_charm.configure_ha_resources(hacluster)
|
||||||
|
barbican_charm.assess_status()
|
||||||
|
@ -39,7 +39,11 @@ class TestRegisteredHooks(test_utils.TestRegisteredHooks):
|
|||||||
'identity-service.available',
|
'identity-service.available',
|
||||||
'amqp.available',),
|
'amqp.available',),
|
||||||
'secrets_plugin_configure': ('secrets.new-plugin',),
|
'secrets_plugin_configure': ('secrets.new-plugin',),
|
||||||
}
|
'cluster_connected': ('ha.connected',),
|
||||||
|
},
|
||||||
|
'when_not': {
|
||||||
|
'cluster_connected': ('ha.available',),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
# test that the hooks were registered via the
|
# test that the hooks were registered via the
|
||||||
# reactive.barbican_handlers
|
# reactive.barbican_handlers
|
||||||
@ -77,3 +81,15 @@ class TestBarbicanHandlers(test_utils.PatchHelper):
|
|||||||
mock.call('secrets.available'),
|
mock.call('secrets.available'),
|
||||||
mock.call('config.changed'),
|
mock.call('config.changed'),
|
||||||
])
|
])
|
||||||
|
|
||||||
|
def test_cluster_connected(self):
|
||||||
|
hacluster = mock.MagicMock()
|
||||||
|
barbican_charm = mock.MagicMock()
|
||||||
|
self.patch_object(handlers.charm, 'provide_charm_instance',
|
||||||
|
new=mock.MagicMock())
|
||||||
|
self.provide_charm_instance().__enter__.return_value = barbican_charm
|
||||||
|
self.provide_charm_instance().__exit__.return_value = None
|
||||||
|
handlers.cluster_connected(hacluster)
|
||||||
|
barbican_charm.configure_ha_resources.assert_called_once_with(
|
||||||
|
hacluster)
|
||||||
|
barbican_charm.assess_status.assert_called_once_with()
|
||||||
|
Loading…
Reference in New Issue
Block a user