Commit 2355a629 authored by Marco Mariani's avatar Marco Mariani

slaprunner: use LC_ALL=en_US in import/export scripts

pbs: enforce LC_ALL=C (importer/exporter as well) for proper sort collation

to mark the purpose, repeat inside the call to /usr/bin/sort,
but it's also needed for messages (i.e. we don't want /bin/cp
to write unicode chars in the pubsub feed)
parent 7053ac66
...@@ -135,6 +135,8 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -135,6 +135,8 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
rdiff_wrapper_template = textwrap.dedent("""\ rdiff_wrapper_template = textwrap.dedent("""\
#!/bin/sh #!/bin/sh
# %(comment)s # %(comment)s
LC_ALL=C
export LC_ALL
RDIFF_BACKUP="%(rdiffbackup_binary)s" RDIFF_BACKUP="%(rdiffbackup_binary)s"
$RDIFF_BACKUP %(rdiffbackup_parameter)s $RDIFF_BACKUP %(rdiffbackup_parameter)s
if [ ! $? -eq 0 ]; then if [ ! $? -eq 0 ]; then
...@@ -156,7 +158,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -156,7 +158,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
if [ -e /srv/slapgrid/slappart17/srv/backup/pbs/COMP-1867-slappart6-runner-2/backup.signature ]; them if [ -e /srv/slapgrid/slappart17/srv/backup/pbs/COMP-1867-slappart6-runner-2/backup.signature ]; them
cd %(local_directory)s cd %(local_directory)s
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | sort > ../proof.signature find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | LC_ALL=C sort -k 66 > ../proof.signature
diff -ruw backup.signature ../proof.signature > ../backup.diff diff -ruw backup.signature ../proof.signature > ../backup.diff
# XXX If there is a difference on the backup, we should publish the # XXX If there is a difference on the backup, we should publish the
# failure and ask the equeue, re-run this script again, # failure and ask the equeue, re-run this script again,
......
...@@ -53,7 +53,7 @@ mode = 0644 ...@@ -53,7 +53,7 @@ mode = 0644
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/template/runner-import.sh.jinja2 url = ${:_profile_base_location_}/template/runner-import.sh.jinja2
download-only = true download-only = true
md5sum = d64529e263d42b0b56e5fe3a976d18c9 md5sum = 7d3c42b9cc457f41f6be72c765b8aadf
filename = runner-import.sh.jinja2 filename = runner-import.sh.jinja2
mode = 0644 mode = 0644
...@@ -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 = 86e42a6d37fde9b3b5ad1036ae25aa5c md5sum = 072a6a15b17b364e709d89468a6ac180
filename = runner-export.sh.jinja2 filename = runner-export.sh.jinja2
mode = 0644 mode = 0644
......
#!{{ shell_binary }} #!{{ shell_binary }}
LANG=en_US LC_ALL=C
export $LANG export LC_ALL
umask 077 umask 077
sync_element () { sync_element () {
path=$1 path=$1
...@@ -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 -print0 | xargs -0 sha256sum | sort > backup.signature cd {{ directory['backup'] }} && find -type f ! -name backup.signature -print0 | xargs -0 sha256sum | LC_ALL=C sort -k 66 > backup.signature
#!{{ shell_binary }} #!{{ shell_binary }}
LC_ALL=C
export LC_ALL
umask 077 umask 077
restore_element () { restore_element () {
backup_path=$1 backup_path=$1
...@@ -16,7 +18,7 @@ restore_element () { ...@@ -16,7 +18,7 @@ restore_element () {
write_backup_proof () { write_backup_proof () {
cd {{ directory['backup'] }} cd {{ directory['backup'] }}
find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | sort > {{ directory['srv'] }}/proof.signature find -type f ! -name backup.signature ! -wholename "./rdiff-backup-data/*" -print0 | xargs -0 sha256sum | LC_ALL=C sort -k 66 > {{ directory['srv'] }}/proof.signature
diff -ruw {{ directory['backup'] }} {{ directory['srv'] }}/proof.signature > {{ directory['srv'] }}/backup.diff diff -ruw {{ directory['backup'] }} {{ directory['srv'] }}/proof.signature > {{ directory['srv'] }}/backup.diff
} }
......
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