Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
iv
slapos
Commits
10e156c9
Commit
10e156c9
authored
Sep 18, 2014
by
Rafael Monnerat
Committed by
Marco Mariani
Oct 15, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slaprunner: Add a backup signature using sha256sum
parent
b16f2ae1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
slapos/recipe/pbs.py
slapos/recipe/pbs.py
+12
-4
software/slaprunner/common.cfg
software/slaprunner/common.cfg
+1
-1
software/slaprunner/template/runner-export.sh.jinja2
software/slaprunner/template/runner-export.sh.jinja2
+1
-1
software/slaprunner/template/runner-import.sh.jinja2
software/slaprunner/template/runner-import.sh.jinja2
+10
-0
No files found.
slapos/recipe/pbs.py
View file @
10e156c9
...
@@ -146,21 +146,29 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
...
@@ -146,21 +146,29 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
# Here, two possiblities:
# Here, two possiblities:
# * The first backup failed. It is safe to remove it since there is nothing valuable there.
# * The first backup failed. It is safe to remove it since there is nothing valuable there.
# * The backup has been complete, but is now in a really weird state. Not safe to remove it.
# * The backup has been complete, but is now in a really weird state. Not safe to remove it.
echo "Impossible to check backup: we move it to a safe place."
# XXX We may need to publish the failure and ask the the equeue, re-run this script again,
# XXX: bang
# instead do a push to the clone.
mv %(local_directory)s %(local_directory)s.$(date +%%s)
fi
fi
else
else
# Everything's okay, cleaning up...
# Everything's okay, cleaning up...
$RDIFF_BACKUP --remove-older-than %(remove_backup_older_than)s --force %(local_directory)s
$RDIFF_BACKUP --remove-older-than %(remove_backup_older_than)s --force %(local_directory)s
fi
fi
if [ -e /srv/slapgrid/slappart17/srv/backup/pbs/COMP-1867-slappart6-runner-2/backup.signature ]; them
cd %(local_directory)s
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | sort > ../proof.signature
diff -ruw backup.signature ../proof.signature > ../backup.diff
# XXX If there is a difference on the backup, we should publish the
# failure and ask the equeue, re-run this script again,
# instead do a push it to the clone.
fi
"""
)
"""
)
rdiff_wrapper_content
=
rdiff_wrapper_template
%
{
rdiff_wrapper_content
=
rdiff_wrapper_template
%
{
'comment'
:
''
.
join
((
'# %s
\
n
'
%
comment_line
)
for
comment_line
in
comments
),
'comment'
:
''
.
join
((
'# %s
\
n
'
%
comment_line
)
for
comment_line
in
comments
),
'rdiffbackup_binary'
:
self
.
options
[
'rdiffbackup-binary'
],
'rdiffbackup_binary'
:
self
.
options
[
'rdiffbackup-binary'
],
'local_directory'
:
local_directory
,
'local_directory'
:
local_directory
,
'rdiffbackup_parameter'
:
'
\
\
\
n
'
.
join
(
rdiffbackup_parameter_list
),
'rdiffbackup_parameter'
:
'
\
\
\
n
'
.
join
(
rdiffbackup_parameter_list
),
# XXX: only
10
increments is not enough by default.
# XXX: only
3
increments is not enough by default.
'remove_backup_older_than'
:
entry
.
get
(
'remove-backup-older-than'
,
'3B'
)
'remove_backup_older_than'
:
entry
.
get
(
'remove-backup-older-than'
,
'3B'
)
}
}
rdiff_wrapper
=
self
.
createFile
(
rdiff_wrapper
=
self
.
createFile
(
...
...
software/slaprunner/common.cfg
View file @
10e156c9
...
@@ -68,7 +68,7 @@ mode = 0644
...
@@ -68,7 +68,7 @@ mode = 0644
recipe = hexagonit.recipe.download
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/runner-export.sh.jinja2
url = ${:_profile_base_location_}/template/runner-export.sh.jinja2
download-only = true
download-only = true
md5sum = 8
27aca46c22017aa9ecfd8fedcad1fd0
md5sum = 8
6e42a6d37fde9b3b5ad1036ae25aa5c
filename = runner-export.sh.jinja2
filename = runner-export.sh.jinja2
mode = 0644
mode = 0644
...
...
software/slaprunner/template/runner-export.sh.jinja2
View file @
10e156c9
...
@@ -24,4 +24,4 @@ if [ -d {{ directory['backup'] }}/runner/software ]; then
...
@@ -24,4 +24,4 @@ if [ -d {{ directory['backup'] }}/runner/software ]; then
rm {{ directory['backup'] }}/runner/software/*
rm {{ directory['backup'] }}/runner/software/*
fi
fi
cd {{ directory['backup'] }} && find -type f ! -name backup.signature -
exec sha256sum {} +
> backup.signature
cd {{ directory['backup'] }} && find -type f ! -name backup.signature -
print0 | xargs -0 sha256sum | sort
> backup.signature
software/slaprunner/template/runner-import.sh.jinja2
View file @
10e156c9
...
@@ -13,6 +13,16 @@ restore_element () {
...
@@ -13,6 +13,16 @@ restore_element () {
fi
fi
done
done
}
}
write_backup_proof () {
cd {{ directory['backup'] }}
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | sort > {{ directory['srv'] }}/proof.signature
diff -ruw {{ directory['backup'] }} {{ directory['srv'] }}/proof.signature > {{ directory['srv'] }}/backup.diff
}
# For now we just make the diff before
write_backup_proof
restore_element {{ directory['backup'] }}/runner/ {{ directory['srv'] }}/runner instance project proxy.db
restore_element {{ directory['backup'] }}/runner/ {{ directory['srv'] }}/runner instance project proxy.db
restore_element {{ directory['backup'] }}/etc/ {{ directory['etc'] }} config.json ssh
restore_element {{ directory['backup'] }}/etc/ {{ directory['etc'] }} config.json ssh
cp -r {{ directory['backup'] }}/etc/.??* {{ directory['etc'] }};
cp -r {{ directory['backup'] }}/etc/.??* {{ directory['etc'] }};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment