Commit 9b6a631a authored by Nicolas Wavrant's avatar Nicolas Wavrant

resilient: makes promises more understandable

parent a1b5e0ca
......@@ -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 = a13be3bd76d6a52b6527c7035ba33a06
md5sum = 10264fe1cfb7ebe567d50ebabbd93a43
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 = 3892f86fcf850511dc0e6e4983b1961a
md5sum = 3ef8f98ff013f06fcd81bba18872e561
mode = 0644
[template-replicated]
......
......@@ -8,7 +8,7 @@ parts =
cron-entry-logrotate
pbs-sshkeys-authority
sshkeys-openssh
backup-transfer-integrity-promise
backup-checksum-integrity-promise
resilient-genstatrss-wrapper
pbs-push-history-log
backup-signature-link
......@@ -264,7 +264,7 @@ monitor-username = $${htpasswd:username}
#--
#-- Resiliency promises.
[backup-transfer-integrity-promise]
[backup-checksum-integrity-promise]
recipe = slapos.recipe.template:jinja2
template = inline:
#!${dash:location}/bin/dash
......@@ -276,9 +276,15 @@ template = inline:
if [ -z "$backup_signature" ]; then
exit 0;
else
diff "proof.signature" "$backup_signature";
diff -q "proof.signature" "$backup_signature";
if [ "$?" -eq 0 ]; then
exit 0;
else
echo "Signature file is not the same before and after transfer"
exit 1
fi
fi
rendered = $${basedirectory:promises}/backup-transfer-integrity-promise
rendered = $${basedirectory:promises}/backup-checksum-integrity
mode = 700
[resilient-genstatrss-wrapper]
......
......@@ -26,7 +26,7 @@ parts =
check-backup-integrity-on-notification
import-on-notification
backup-transfer-integrity-promise
backup-checksum-integrity-promise
resilient-publish-connection-parameter
backup-signature-link
......@@ -78,7 +78,7 @@ recipe = slapos.cookbook:notifier.callback
on-notification-id = $${slap-parameter:on-notification}
callback = $${post-notification-run:output}
[backup-transfer-integrity-promise]
[backup-checksum-integrity-promise]
recipe = slapos.recipe.template:jinja2
template = inline:
#!/${bash:location}/bin/bash
......@@ -90,10 +90,10 @@ template = inline:
exit 1;
fi
else
# If file doesn't exist, promise should raise false positive
# If file doesn't exist, promise shouldnt raise false positive
exit 0;
fi
rendered = $${basedirectory:promises}/backup-transfer-integrity-promise
rendered = $${basedirectory:promises}/backup-checksum-integrity
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