rabbitmq ssl support for ceilometer
This commit is contained in:
parent
0aa534759e
commit
ec80c5f6ea
|
@ -1,3 +1,6 @@
|
|||
import base64
|
||||
import os
|
||||
|
||||
from charmhelpers.core.hookenv import (
|
||||
relation_ids,
|
||||
relation_get,
|
||||
|
@ -28,13 +31,30 @@ class CeilometerServiceContext(OSContextGenerator):
|
|||
'metering_secret'
|
||||
]
|
||||
|
||||
optional_keys = [
|
||||
'rabbitmq_ssl_port',
|
||||
'rabbitmq_ssl_ca'
|
||||
]
|
||||
|
||||
def __init__(self, ssl_dir):
|
||||
self.ssl_dir = ssl_dir
|
||||
|
||||
def __call__(self):
|
||||
for relid in relation_ids('ceilometer-service'):
|
||||
for unit in related_units(relid):
|
||||
conf = {}
|
||||
for attr in self.keys:
|
||||
conf[attr] = relation_get(attr,
|
||||
unit=unit, rid=relid)
|
||||
conf[attr] = relation_get(
|
||||
attr, unit=unit, rid=relid)
|
||||
if context_complete(conf):
|
||||
for attr in self.optional_keys:
|
||||
conf[attr] = relation_get(
|
||||
attr, unit=unit, rid=relid)
|
||||
if 'rabbit_ssl_ca' in conf:
|
||||
ca_path = os.path.join(
|
||||
self.ssl_dir, 'rabbit-client-ca.pem')
|
||||
with open(ca_path, 'w') as fh:
|
||||
fh.write(base64.b64decode(conf['rabbit_ssl_ca']))
|
||||
conf['rabbit_ssl_ca'] = ca_path
|
||||
return conf
|
||||
return {}
|
||||
|
|
|
@ -8,7 +8,8 @@ from charmhelpers.contrib.openstack.utils import (
|
|||
get_os_codename_package
|
||||
)
|
||||
|
||||
CEILOMETER_CONF = "/etc/ceilometer/ceilometer.conf"
|
||||
CEILOMETER_CONF_DIR = "/etc/ceilometer"
|
||||
CEILOMETER_CONF = "%s/ceilometer.conf" % CEILOMETER_CONF_DIR
|
||||
|
||||
CEILOMETER_AGENT_SERVICES = ['ceilometer-agent-compute']
|
||||
|
||||
|
@ -39,7 +40,8 @@ NOVA_SETTINGS = {
|
|||
|
||||
CONFIG_FILES = {
|
||||
CEILOMETER_CONF: {
|
||||
'hook_contexts': [CeilometerServiceContext()],
|
||||
'hook_contexts': [
|
||||
CeilometerServiceContext(ssl_dir=CEILOMETER_CONF_DIR)],
|
||||
'services': CEILOMETER_AGENT_SERVICES
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,14 @@ rabbit_host = {{ rabbitmq_host }}
|
|||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
|
||||
{% if auth_host -%}
|
||||
os_auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}/v2.0
|
||||
|
|
|
@ -13,7 +13,14 @@ rabbit_host = {{ rabbitmq_host }}
|
|||
rabbit_userid = {{ rabbitmq_user }}
|
||||
rabbit_password = {{ rabbitmq_password }}
|
||||
rabbit_virtual_host = {{ rabbitmq_virtual_host }}
|
||||
{% endif -%}
|
||||
{% if rabbit_ssl_port %}
|
||||
rabbit_use_ssl=True
|
||||
rabbit_port={{ rabbit_ssl_port }}
|
||||
{% if rabbit_ssl_ca %}
|
||||
kombu_ssl_ca_certs={{rabbit_ssl_ca}}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{%- endif -%}
|
||||
|
||||
logdir = /var/log/ceilometer
|
||||
|
||||
|
|
Loading…
Reference in New Issue