diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2012-01-03 18:56:40 -0200 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2012-01-03 18:56:40 -0200 |
commit | 64ddbbf5068148be63c5f049a08ce8371613e349 (patch) | |
tree | b6bdd91566340175240ff00d1faaf9bc0f2b8dad /files | |
parent | b2868c44deae73c0a963de2cb3b44f3f1b5c64ce (diff) | |
download | puppet-backup-64ddbbf5068148be63c5f049a08ce8371613e349.tar.gz puppet-backup-64ddbbf5068148be63c5f049a08ce8371613e349.tar.bz2 |
Cleanup orphaned metadata on rsync handler (upstream #3727)
Diffstat (limited to 'files')
-rw-r--r-- | files/handlers/rsync | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/files/handlers/rsync b/files/handlers/rsync index 471c8ba..b3f0782 100644 --- a/files/handlers/rsync +++ b/files/handlers/rsync @@ -323,6 +323,14 @@ function rotate_short { $nice $cp -alf /$folder.1/. /$folder.0 fi + # Cleanup orphaned metadata + for file in `ls $metadata`; do + if [ ! -d "`dirname $folder`/$file" ]; then + debug "removing orphaned metadata $file" + rm -rf $metadata/$file + fi + done + } function rotate_short_remote { @@ -361,6 +369,14 @@ function rotate_short_remote { if [ -d $folder.1 ]; then $nice $cp -alf /$folder.1/. /$folder.0 fi + + # Cleanup orphaned metadata + for file in `ls $metadata`; do + if [ ! -d "`dirname $folder`/\$file" ]; then + debug "removing orphaned metadata \$file" + rm -rf $metadata/\$file + fi + done ##### END REMOTE SCRIPT ####### EOF ) | (while read a; do passthru $a; done) @@ -472,6 +488,14 @@ function rotate_long { done done + # Cleanup orphaned metadata + for file in `ls $backuproot/metadata`; do + if [ ! -d "$backuproot/$file" ]; then + debug "removing orphaned metadata $file" + rm -rf $backuproot/metadata/$file + fi + done + } function rotate_long_remote { @@ -581,6 +605,14 @@ function rotate_long_remote { fi done done + + # Cleanup orphaned metadata + for file in `ls $backuproot/metadata`; do + if [ ! -d "$backuproot/\$file" ]; then + debug "removing orphaned metadata \$file" + rm -rf $backuproot/metadata/\$file + fi + done ##### END REMOTE SCRIPT ####### EOF ) | (while read a; do passthru $a; done) |