0

I have an application in which configuration file itself changes from one release to another. Maintaining multiple templates based on release version is becoming difficult.

Is there a way to handle such a usecase apart from doing an inline/inplace FILE editing operation for configuration files.

user3540835
  • 453
  • 4
  • 15
  • check this http://michaelkueller.wordpress.com/2012/09/27/chef-how-to-insert-or-append-a-line-to-a-file/ or this http://stackoverflow.com/questions/16879469/using-a-chef-recipe-to-append-multiple-lines-to-a-config-file – Psyreactor Nov 05 '14 at 14:48

1 Answers1

0

The line cookbook is probably the "best" option, better than using FileEdit directly. This is with copious air quotes though, it is generally a brittle style, and you can end up with stuff like two copies of the modified line too easily if your regexes aren't very good. If the software supports some kind of file include, that can be an option. Otherwise I still recommend keeping the whole template managed via Chef.

coderanger
  • 52,400
  • 4
  • 52
  • 75