Tune heartbeat

This commit is contained in:
James Page 2014-05-21 17:12:49 +01:00
parent 229473b571
commit 50f760610b
3 changed files with 40 additions and 31 deletions

View File

@ -281,9 +281,7 @@ def enable_ssl(ssl_key, ssl_cert, ssl_port,
if ssl_ca:
data["ssl_ca_file"] = ssl_ca_file
with open(RABBITMQ_CONF, 'w') as rmq_conf:
rmq_conf.write(render_template(
os.path.basename(RABBITMQ_CONF), data))
return data
def execute(cmd, die=False, echo=False):

View File

@ -475,12 +475,13 @@ def configure_rabbit_ssl():
"""
ssl_mode, external_ca = _get_ssl_mode()
data = {}
if ssl_mode == 'off':
if os.path.exists(rabbit.RABBITMQ_CONF):
os.remove(rabbit.RABBITMQ_CONF)
close_port(config('ssl_port'))
reconfigure_client_ssl()
return
else:
ssl_key = _convert_from_base64(config('ssl_key'))
ssl_cert = _convert_from_base64(config('ssl_cert'))
ssl_ca = _convert_from_base64(config('ssl_ca'))
@ -496,12 +497,16 @@ def configure_rabbit_ssl():
if not external_ca:
ssl_cert, ssl_key, ssl_ca = ServiceCA.get_service_cert()
rabbit.enable_ssl(
ssl_key, ssl_cert, ssl_port, ssl_ca,
ssl_only=(ssl_mode == "only"), ssl_client=False)
data.update(rabbit.enable_ssl(ssl_key, ssl_cert, ssl_port, ssl_ca,
ssl_only=(ssl_mode == "only"),
ssl_client=False))
reconfigure_client_ssl(True)
open_port(ssl_port)
with open(rabbit.RABBITMQ_CONF, 'w') as rmq_conf:
rmq_conf.write(rabbit.render_template(
os.path.basename(rabbit.RABBITMQ_CONF), data))
@hooks.hook('config-changed')
def config_changed():

View File

@ -1,5 +1,6 @@
[
{rabbit, [
{% if ssl_key_file %}
{% if ssl_only %}
{tcp_listeners, []},
{% else %}
@ -12,10 +13,15 @@
{fail_if_no_peer_cert, true},
{% else %}
{fail_if_no_peer_cert, false},
{% endif %}{% if ssl_ca_file %}
{cacertfile, "{{ ssl_ca_file }}"}, {% endif %}
{% endif %}
{% if ssl_ca_file %}
{cacertfile, "{{ ssl_ca_file }}"},
{% endif %}
{certfile, "{{ ssl_cert_file }}"},
{keyfile, "{{ ssl_key_file }}"}
]}
]},
{% endif %}
{heartbeat, 60}
]}
].