[augeas-devel] Remove a value from an array with augtool?

Graham Leggett minfrin at sharp.fm
Sat Nov 24 14:29:47 UTC 2012


On 24 Nov 2012, at 3:08 PM, Graham Leggett <minfrin at sharp.fm> wrote:

> I don't want to remove the last value, I want to remove a specific value "my-map", which may appear anywhere in the array (the removal in my case will take place way after the addition, and other additions may have been made in the mean time).
> 
> Is there a way to reference the index of the array that contains that specific value, like this?
> 
> rm /files/etc/postfix/main.cf/virtual_alias_maps[(index-of-the-value-my-map)]

What turned out to be the syntax was the following:

rm /files/etc/postfix/main.cf/virtual_alias_maps[.='my-map']

However, I've discovered that the postfix main.cf lens doesn't seem to explicitly model the "array" nature of postfix main.cf parameters like the following:

inet_interfaces = $myhostname, localhost
virtual_alias_maps = map1, map2, my-map, map3

Does augeas have any syntax to make modifications to a comma separated list, or is this a shortcoming of the postfix lens itself? Looking at the postfix lens, it seems to treat main.cf values as simple strings in their own right.

To explain what I am trying to do, the setting of the map happens in an RPM postinstall script, and the removing of the map happens in a preremove script, and I'm really really trying to avoid butchering the config files with various text processing tools.

Regards,
Graham
--

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20121124/fdceff55/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4365 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20121124/fdceff55/attachment.p7s>


More information about the augeas-devel mailing list