Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'heartbeat_timeout_threshold` option #588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions charmhelpers/contrib/openstack/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,22 +751,13 @@ def __call__(self):
ctxt['oslo_messaging_flags'] = config_flags_parser(
oslo_messaging_flags)

oslo_messaging_driver = conf.get(
ctxt['oslo_messaging_driver'] = conf.get(
'oslo-messaging-driver', DEFAULT_OSLO_MESSAGING_DRIVER)
if oslo_messaging_driver:
ctxt['oslo_messaging_driver'] = oslo_messaging_driver

notification_format = conf.get('notification-format', None)
if notification_format:
ctxt['notification_format'] = notification_format

notification_topics = conf.get('notification-topics', None)
if notification_topics:
ctxt['notification_topics'] = notification_topics

send_notifications_to_logs = conf.get('send-notifications-to-logs', None)
if send_notifications_to_logs:
ctxt['send_notifications_to_logs'] = send_notifications_to_logs
ctxt['notification_format'] = conf.get('notification-format')
ctxt['notification_topics'] = conf.get('notification-topics')
ctxt['send_notifications_to_logs'] = conf.get('send-notifications-to-logs')
ctxt['rabbit_heartbeat_timeout_threshold'] = conf.get(
'rabbit-heartbeat-timeout-threshold')

if not self.complete:
return {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ ssl = True
{% if rabbit_ssl_ca -%}
ssl_ca_file = {{ rabbit_ssl_ca }}
{% endif -%}
{% if rabbit_heartbeat_timeout_threshold -%}
heartbeat_timeout_threshold = {{ rabbit_heartbeat_timeout_threshold }}
{% endif -%}
12 changes: 12 additions & 0 deletions tests/contrib/openstack/test_os_contexts.py
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ def test_amqp_context_with_data(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1309,6 +1310,7 @@ def test_amqp_context_explicit_relation_id(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbitalthost1',
'rabbitmq_password': 'flump',
'rabbitmq_user': 'adam',
Expand All @@ -1328,6 +1330,7 @@ def test_amqp_context_with_data_altname(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1347,6 +1350,7 @@ def test_amqp_context_with_data_ssl(self, _open):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1370,6 +1374,7 @@ def test_amqp_context_with_data_ssl_noca(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1393,6 +1398,7 @@ def test_amqp_context_with_data_clustered(self):
expected = {
'oslo_messaging_driver': 'messagingv2',
'clustered': True,
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': relation_data['vip'],
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1413,6 +1419,7 @@ def test_amqp_context_with_data_active_active(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost1',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand Down Expand Up @@ -1458,6 +1465,7 @@ def test_amqp_context_with_ipv6(self, format_ipv6_addr):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': '[2001:db8:1::1]',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1477,6 +1485,7 @@ def test_amqp_context_with_oslo_messaging(self):
amqp = context.AMQPContext()
result = amqp()
expected = {
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1502,6 +1511,7 @@ def test_amqp_context_with_notification_format(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1522,6 +1532,7 @@ def test_amqp_context_with_notification_topics(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand All @@ -1542,6 +1553,7 @@ def test_amqp_context_with_notifications_to_logs(self):
result = amqp()
expected = {
'oslo_messaging_driver': 'messagingv2',
'rabbit_heartbeat_timeout_threshold': None,
'rabbitmq_host': 'rabbithost',
'rabbitmq_password': 'foobar',
'rabbitmq_user': 'adam',
Expand Down