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

resilient: makes promises more understandable

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