Hiya,
There are a few camps of thought for this - ex-users of cfengine often
look for such behavior.
We have a lightweight file editing Mixin in production, and I have
been evaluating Augeas on supported platforms for similar tasks.
On 31/07/2009, at 11:42 AM, Thomas Hartman wrote:
I have this scenario where I have a my.cnf ini file, and I want to
make sure it has a certain value in a certain section. (Can’t just
append to the end of the file.)
I solved this using the perl file, attached. Obviously this isn’t a
perfect solution though. If the value is already set, but set wrong,
it won’t work.
The right way to do this would be to parse the ini file and do
something smart.
You could possibly try the parseconfig Gem, and do so in-template-
parse-and-re-render magic, but down this path surely lies madness.
Most times this can be solved by a ‘smart’ template for my.cnf which
reads in snippets from another directory, or programatically builds up
the entire configuration file. This is the other main camp of thought
- everything you are managing on your system should be managed (entire
files) instead of a line in a file, which has the potential to
conflict or be broken by earlier configuration (in that same file)
I am just wondering if this kind of tweak is a solved problem, in
chef, puppet, cfengine, or anywhere else.
Thanks in advance for any advice!
–
Thomas Hartman
Darcs hosting: patch-tag.com
Build a webapp with haskell: happstack.com
<insert_after_line.pl>
–
AJ Christensen, Software Engineer
Opscode, Inc.
E: aj@opscode.com