Commit 165f64df authored by Alain Takoudjou's avatar Alain Takoudjou

resilient: check backup consistency promise when pull is not running

If pull is running, files can be changed and promise will raise. Wait when backup pull
is not running before check signature diff.
parent 9b12d378
......@@ -26,7 +26,7 @@ md5sum = c6c11db5372150019debb1ce519b907d
[template-pull-backup]
filename = instance-pull-backup.cfg.in
md5sum = 85e777bd349a5c881d36e747882aee8a
md5sum = 9b87abf464abac03801e8c670a09c5d7
[template-replicated]
filename = template-replicated.cfg.in
......
......@@ -277,6 +277,14 @@ monitor-username = admin
recipe = slapos.recipe.template:jinja2
template = inline:
#!${dash:location}/bin/dash
# only check integrity if pull is not running
latest_item=$(ls -t $${pbs:status-item-directory} | head -n1)
if [ ! -z "$latest_item" ]; then
pbs_result=$(cat "$${pbs:status-item-directory}/$latest_item" | python -c "import sys, json; print json.load(sys.stdin)['title']" 2>/dev/null)
if [ "$?" -eq 0 ]; then
(echo $pbs_result | egrep "pull_raw\s*:\s*STARTED" > /dev/null) && (echo "Skipped, PBS pull is running."; exit 0)
fi
fi
# Raise an error if signatures are different
# Error cannot be deduced if files do not exist
cd $${directory:pbs-backup}
......
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