Commit 1cc80dd4 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

stack/caucase: Improve library

Improvements:

 * support CSR as a file
   Allow to pass template_csr as a file, as it is useful for some cases.

 * use dumps where needed, as it is available

 * fix rerequest internal call
parent 07d64efb
...@@ -15,4 +15,4 @@ ...@@ -15,4 +15,4 @@
[caucase-jinja2-library] [caucase-jinja2-library]
filename = caucase.jinja2.library filename = caucase.jinja2.library
md5sum = da082c12f547eee3a33e98c535dcbc14 md5sum = 0c9b50ff49e0ca0e8e2bc70ec0fd9431
...@@ -49,6 +49,7 @@ command-line = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc }} ...@@ -49,6 +49,7 @@ command-line = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc }}
on_renew=None, on_renew=None,
max_sleep=None, max_sleep=None,
mode='service', mode='service',
template_csr=None,
template_csr_pem=None, template_csr_pem=None,
openssl=None openssl=None
) -%} ) -%}
...@@ -56,21 +57,28 @@ command-line = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc }} ...@@ -56,21 +57,28 @@ command-line = '{{ buildout_bin_directory }}/caucase-probe' 'http://{{ netloc }}
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
data-dir = {{ data_dir }} data-dir = {{ data_dir }}
{% if template_csr_pem -%} {% if template_csr_pem or template_csr -%}
[{{ prefix }}-provided-csr-content] [{{ prefix }}-provided-csr-content]
{% if template_csr_pem %}
content = {{ dumps(template_csr_pem) }} content = {{ dumps(template_csr_pem) }}
{% elif template_csr %}
content = {{ template_csr }}
{% endif %}
[{{ prefix }}-provided-csr] [{{ prefix }}-provided-csr]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
mode = 644 mode = 644
{% if template_csr_pem %}
template = inline:{{ '{{ content }}' }} template = inline:{{ '{{ content }}' }}
rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem
context = key content {{ prefix }}-provided-csr-content:content context = key content {{ prefix }}-provided-csr-content:content
{% elif template_csr %}
template = {{ '${' + prefix }}-provided-csr-content:content}
rendered = ${ {{- prefix }}-directory:data-dir}/provided.csr.pem
{% endif %}
{{ rerequest( {{ rerequest(
prefix=prefix ~ '-csr', prefix=prefix ~ '-csr',
buildout_bin_directory='{{ buildout_bin_directory }}', buildout_bin_directory=buildout_bin_directory,
template='{{ "\'$" + prefix }}-provided-csr:rendered}', template='${' ~ prefix ~ '-provided-csr:rendered}',
csr='${:csr}', csr='${:csr}',
key=key_path, key=key_path,
)}} )}}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment