Created
May 24, 2017 01:40
-
-
Save hbombonato/785624331d8cbc0072691e68b88fa028 to your computer and use it in GitHub Desktop.
Filebucket rollback with Puppet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| repofilebucket="$1" | |
| file=$2 | |
| echo "Filebucket repo: $1"; | |
| echo "File to restore: $2"; | |
| files=$(find $repofilebucket -iname "paths" | xargs -i ls {}) | |
| for i in $files | |
| do | |
| hash=$(echo $i | cut -d'/' -f 13); | |
| filerestore=$(cat $i); | |
| lsrt=$(ls $filerestore); | |
| echo "$lsrt $hash" | |
| if [ $2 = $lsrt ] | |
| then | |
| echo "Found" | |
| puppet filebucket restore -b $1 $2 $hash | |
| echo "Filebucket directory: $1" | |
| echo "Restored file: $2 con hash: $hash" | |
| fi | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment