Template Resource - backup file before replace


#1

Is there a way with the “template” resource to control where to backup the old file the template is replacing? It would only create this backup in the specified location if the file was replaced.

I didn’t want to have to do a lot of coding around this if I don’t have to…

Thanks
Randy


#2

The template does do backups like this, yes; they are in
/var/chef/backup on my system. Files are postfixed with -DATESTAMP.

All providers built off the ‘file’ provider have this behavior.

https://github.com/opscode/chef/blob/master/chef/lib/chef/provider/file.rb#L108

You can control the path with Chef::Config[:file_backup_path]

–AJ

On 3 March 2012 10:51, Van Fossan,Randy vanfossr@oclc.org wrote:

Is there a way with the “template” resource to control where to backup the old file the template is replacing? It would only create this backup in the specified location if the file was replaced.

I didn’t want to have to do a lot of coding around this if I don’t have to…

Thanks
Randy