Pass base64-encoded CA certificate to cloud-init script

Change-Id: I90d7ad55b446888eb15de2d1d37e6ca50a31a621
This commit is contained in:
Stan Lagun 2013-10-04 16:31:05 +04:00
parent d9c84894aa
commit a829d295e6
1 changed files with 12 additions and 0 deletions

View File

@ -110,6 +110,10 @@ def prepare_user_data(context, hostname, service, unit,
'%MURANO_SERVER_ADDRESS%',
config.CONF.file_server or settings.host)
init_script = init_script.replace(
'%CA_ROOT_CERT_BASE64%',
get_ca_certificate())
return init_script
@ -119,6 +123,14 @@ def set_config_params(template_data, replacements):
return template_data
def get_ca_certificate():
ca_file = (config.CONF.rabbitmq.ca_file or '').strip()
if not ca_file:
return ''
with open(ca_file) as stream:
return stream.read().encode('base64')
counters = {}