Commit 0978f42f authored by Łukasz Nowak's avatar Łukasz Nowak

stack/cacuase: Make rerequest updatable

It will generate new csr and key if the template changes, also if beacuse of
some reason key or csr is not present anymore.

This change makes the part resist to cases when it is becoming uninstalled and
installed again, so that it will not shoot its own foot and leaving the macro
user in inconsistent state.
parent 58fee361
......@@ -15,4 +15,4 @@
[caucase-jinja2-library]
filename = caucase.jinja2.library
md5sum = 0c9b50ff49e0ca0e8e2bc70ec0fd9431
md5sum = 5cf324ea1beb593738339f3d20d60a44
......@@ -108,5 +108,15 @@ command-line = '{{ buildout_bin_directory }}/caucase-updater'
{% macro rerequest(prefix, buildout_bin_directory, template, csr, key) -%}
[{{ prefix }}]
recipe = plone.recipe.command
command = '{{ buildout_bin_directory }}/caucase-rerequest' --template '{{ template }}' --csr '{{ csr }}' --key '{{ key }}'
checksum-file = '{{ template }}.md5'
command =
set -e
md5_current=$(${buildout:executable} -c "import hashlib ; hashlib.md5(open('{{ template }}').read()).hexdigest()")
md5_old=$([ -f ${:checksum-file} ] && cat ${:checksum-file} || echo none)
if [ "$md5_current" != "$md5_old" ] || [ ! -f '{{ csr }}' ] || [ ! -f '{{ key }}' ] ; then
'{{ buildout_bin_directory }}/caucase-rerequest' --template '{{ template }}' --csr '{{ csr }}' --key '{{ key }}'
echo $md5_current > ${:checksum-file}
fi
update-command = ${:command}
stop-on-error = True
{%- endmacro %}
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