Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save hbombonato/785624331d8cbc0072691e68b88fa028 to your computer and use it in GitHub Desktop.

Select an option

Save hbombonato/785624331d8cbc0072691e68b88fa028 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