[augeas-devel] Fwd: Issues with automounter lens

Patrick Spinler spinler.patrick at mayo.edu
Tue Sep 3 13:12:59 UTC 2013


On 9/3/13 2:37 AM, Dominic Cleal wrote:
> On 03/09/13 04:00, Patrick Spinler wrote:
>>
>>
>> The automounter lens appears to be sensitive to the order in which the
>> 'opt' elements are defined.  
> 
> This is true for many lenses, since the order of the nodes in the tree
> is important when writing back the file.
> 
> I'd suggest using the "ins" command, or aug_ins on the API to add a new,
> empty node in the correct position and then set its value.  "set" will
> just append a node to the end of the current siblings if it doesn't
> already exist.  Here's an example:
> 
> augtool> ins opt after /files/etc/auto.shares.nfs/*[. =
> 'tivoli']/opt[last()]
> augtool> set /files/etc/auto.shares.nfs/*[. = 'tivoli']/opt[last()] "ro"
> 

That's unfortunate, since I'd like to use this a puppet recipe, and I
don't know when I invoke this whether or not the option exists when I
invoke it.  I'm not even sure whether the entry exists.  All I know is
that I want this entry, and I want it in this specific form.

Also, this behavior (order dependency) could be better documented.

I'd like to have the behavior: If this entry does not exist, or if this
entry does exist but does not match this specification, then add it
and/or edit it to match.  However, do not modify any other part of the file.

It sounds like I'll have to write this as "remove anything matching this
automount key which may be there, then add this precise entry back."
This also makes writing a correct puppet 'onlyif => ' condition harder.

-- Pat




More information about the augeas-devel mailing list