Apoologies for this top posting. Blame Outlook.
I don't disagree at all. And for your specific example of sshd_config I
precisely do have a proper pattern for editing text files to set values
as needed (or not). This works extremely well and I am satisfied with
the results.
I just think having some built-in functions for text patterns would be
lovely. There are many cases where something like addifnosuchline would
be perfectly valid. Just because it won't be the solution in all cases
doesn't mean it should be dismissed.
But perhaps I should shut up and code these sometime.. :>
________________________________
From: [email protected]
[mailto:[email protected]] On Behalf Of Nigel Kersten
Sent: Thursday, June 23, 2011 8:38 AM
To: [email protected]
Subject: Re: [Puppet Users] How to add extra lines in the
existing files?
On Thu, Jun 23, 2011 at 6:37 AM, Kinzel, David
<[email protected]> wrote:
>> this is not directly built into puppet.
>
>Is there any specific reason why this is not built into
puppet?
>
>We've put __addifnosuchline [0] into cdist [1] as one
of
>the most basic features, because it's often needed if
you do not
>care about the existing contents, but just need to add
a line.
>
I second this. This would greatly cut down on things we
do with exec
patterns. And no, I don't want to use augeas as I
typically see people
fighting with it to work in all their environments.
The problem with appendifnosuchline functionality is that it's
often easy at first, but then becomes difficult to maintain.
Say you want to set:
Subsystem sftp /usr/libexec/sftp-server
in your sshd_config.
It's simple enough at first, but what happens when you want to
change the actual setting? You're no longer able to do this within the
semantics of "append if no such line".
You need to know how the relevant service behaves when you have
two values for a setting in a config file. Does the first one win? the
last? Does it complain and not let you do this?
Or you end up changing the condition to check for to include a
regular expression or do partial line matching, which starts to bring
you closer to the Augeas model anyway.
This is why people like being able to use Augeas. You get to
express this in a more natural manner, along the lines of "set the sftp
subsystem to this value".
It is a little difficult to get going with Augeas, it requires a
shift in mindset, and the syntax is a little obscure, but I feel that
the best option is often to create a defined type that expresses what
you're trying to do in a simple manner, and that defined type wraps an
internal Augeas resource.
If you're set on not using Augeas, then do the same defined type
trick with sed/grep/awk/whatever as the internal resource, but whatever
you do, I do think the "append if no such line" semantics aren't really
maintainable over time.
--
You received this message because you are subscribed to the
Google Groups "Puppet Users" group.
To post to this group, send email to
[email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.
This email communication and any files transmitted with it may contain
confidential and or proprietary information and is provided for the use of the
intended recipient only. Any review, retransmission or dissemination of this
information by anyone other than the intended recipient is prohibited. If you
receive this email in error, please contact the sender and delete this
communication and any copies immediately. Thank you.
http://www.encana.com
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en.