Commit 51f45430 authored by Nicolas Wavrant's avatar Nicolas Wavrant

resilient: promises to check backup integrity shouldn't fail if proofs do no exist

parent 9aa1d2a6
......@@ -50,7 +50,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-import.cfg.in
output = ${buildout:directory}/pbsready-import.cfg
md5sum = cdebc491a50a61fecc3391a5eb311bdb
md5sum = 89619b0d8626c76402a11bb08e7ba8a1
mode = 0644
[pbsready-export]
......@@ -66,7 +66,7 @@ mode = 0644
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pull-backup.cfg.in
output = ${buildout:directory}/instance-pull-backup.cfg
md5sum = 232fcad0892e56d62f45e79ec01c7c3e
md5sum = fba98fd740d564525fc3f236662f5d64
mode = 0644
[template-replicated]
......
......@@ -269,8 +269,16 @@ monitor-username = $${htpasswd:username}
recipe = slapos.recipe.template:jinja2
template = inline:
#!${dash:location}/bin/dash
# Raise an error if signatures are different
# Error cannot be deduced if files do not exist
cd $${directory:pbs-backup}
diff proof.signature $(find . -name backup.signature -maxdepth 2)
if [ ! -f "proof.signature" ]; then exit 0; fi
backup_signature=$(find . -maxdepth 2 -name backup.signature)
if [ -z "$backup_signature" ]; then
exit 0;
else
diff "proof.signature" "$backup_signature";
fi
rendered = $${basedirectory:promises}/backup-transfer-integrity-promise
mode = 700
......
......@@ -82,7 +82,17 @@ callback = $${post-notification-run:output}
recipe = slapos.recipe.template:jinja2
template = inline:
#!/${bash:location}/bin/bash
if [ "$(wc -l $${post-notification-run:diff-file} | cut -d \ -f1)" -eq 0 ]; then exit 0; else exit 1; fi
backup_diff_file=$${post-notification-run:diff-file}
if [ -f "$backup_diff_file" ]; then
if [ $(wc -l "$backup_diff_file" | cut -d \ -f1) -eq 0 ]; then
exit 0;
else
exit 1;
fi
else
# If file doesn't exist, promise should raise false positive
exit 0;
fi
rendered = $${basedirectory:promises}/backup-transfer-integrity-promise
mode = 700
......
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