Search Puppet file bucket for a changed file(s)

When you use Puppet to manage your infrastructure, it’s common to manage several files on a system with a template or something. The default setting when a file is changed, it gets a backup on the client system in a filebucket

You can use to command ‘puppet filebucket’ with a lot of options to hopefully get what you want…. Or…. just search the filesystem 🙂

The location below holds the directory structure were the files are physically stored! with a lot of hashes added 😐

'/opt/puppetlabs/puppet/cache/clientbucket/'

A directory structure could look like this:

f
f/8
f/8/6
f/8/6/3
f/8/6/3/1
f/8/6/3/1/b
f/8/6/3/1/b/a
f/8/6/3/1/b/a/a
f/8/6/3/1/b/a/a/f8631baa8f83d5067af7eedcd7bdf641
f/8/6/3/1/b/a/a/f8631baa8f83d5067af7eedcd7bdf641/contents
f/8/6/3/1/b/a/a/f8631baa8f83d5067af7eedcd7bdf641/paths

The files content and paths hold the magic information about original file and its location. YES!!

Use the following command the search your filebucket to get you’re long lost files back!!

find /opt/puppetlabs/puppet/cache/clientbucket/ -name paths -print -exec grep <file to look for> {} \;

This only works when the file is managed through the ‘file’ resource type.

Files changed by augeas or not to be found here…. Bummer!

Leave a Reply

Your email address will not be published. Required fields are marked *