[augeas-devel] Setting list values in the tree
Raphaël Pinson
raphael.pinson at camptocamp.com
Wed Nov 21 13:27:15 UTC 2012
Hello,
In order to easily manage list entries in the tree, it would be useful to
have a `setlist` API entry, which would manage both named nodes as well as
`seq` ones. It could look like this:
setlist <path> <label|seq> <replace|add|merge> <value> [value [value
[…]]]
For example, having `/files/etc/ssh/sshd_config/AcceptEnv` as:
{ "AcceptEnv"
{ "1" = "LC_*" } }
The following call:
setlist /files/etc/ssh/sshd_config/AcceptEnv seq replace LANG LC_*
would produce:
{ "AcceptEnv"
{ "1" = "LANG" }
{ "2" = "LC_*" } }
while
setlist /files/etc/ssh/sshd_config/AcceptEnv seq add LANG FOO
would result in:
{ "AcceptEnv"
{ "1" = "LC_*" }
{ "2" = "LANG" }
{ "3" = "FOO" } }
and
setlist /files/etc/ssh/sshd_config/AcceptEnv seq merge LANG LC_*
in
{ "AcceptEnv"
{ "1" = "LANG" }
{ "2" = "LC_*" } }
For non-`seq` entries, we could specify the label. For example, having
`/files/etc/group/audio` set to:
{ "audio"
{ "password" = "x" }
{ "gid" = "29" }
{ "user" = "pulse" }
{ "user" = "rpinson" } }
we could do:
setlist /files/etc/group/audio user add foo bar
resulting in:
{ "audio"
{ "password" = "x" }
{ "gid" = "29" }
{ "user" = "pulse" }
{ "user" = "rpinson" }
{ "user" = "foo" }
{ "user" = "bar" } }
If the nodes need to be created on sublevels, you would use a slash in the
label:
setlist /path/to/node entry/user replace foo bar
What are your thoughts? What could the C API call look like?
--
Raphaël Pinson
Administrateur Systèmes & Réseaux
Camptocamp France
Savoie Technolac
BP 352
48, avenue du Lac du Bourget
73372 Le Bourget du Lac, Cedex
www.camptocamp.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20121121/ab68e8c5/attachment.htm>
More information about the augeas-devel
mailing list