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. Is there anything I can do here? I'd like > to be able to e.g. add missing options to a automounter entry without > that blowing up in my face. > > Observe: > > (Here, adding an '/opt[]' item) > augtool> set /files/etc/auto.shares.nfs/*[. = 'tivoli']/opt[4] "ro" > > augtool> print /files/etc/auto.shares.nfs/4 > /files/etc/auto.shares.nfs/4 = "tivoli" > /files/etc/auto.shares.nfs/4/opt[1] = "squash_root" > /files/etc/auto.shares.nfs/4/opt[2] = "nodev" > /files/etc/auto.shares.nfs/4/opt[3] = "intr" > /files/etc/auto.shares.nfs/4/location > /files/etc/auto.shares.nfs/4/location/1 > /files/etc/auto.shares.nfs/4/location/1/host = "syspzl01.mayo.edu" > /files/etc/auto.shares.nfs/4/location/1/path = "/appdata/tivoli" > /files/etc/auto.shares.nfs/4/opt[4] = "ro" > > (fails to save)
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" -- Dominic Cleal Red Hat Engineering _______________________________________________ augeas-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/augeas-devel
