Skip to content

Instantly share code, notes, and snippets.

@jorgepenacotarelo
Last active December 27, 2015 18:39
Show Gist options
  • Save jorgepenacotarelo/7371179 to your computer and use it in GitHub Desktop.
Save jorgepenacotarelo/7371179 to your computer and use it in GitHub Desktop.
Filebucket rollback with Puppet
#!/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