[augeas-devel] var_action with multiple variables in shellvars.aug

Raphaël Pinson raphael.pinson at camptocamp.com
Fri Jul 27 22:16:31 UTC 2012


Hello,

In shellvars.aug, the var_action entry manages "unset" and bare "export"
entries, such as:

unset SOMEVAR
export SOMEVAR

It currently does not support multiple variables per entry, and maps them
as:

{ "@unset" = "SOMEVAR" }
{ "@export" = "SOMEVAR" }

We need to support multiple variables for this lens, and there are several
solutions to implement it:

* One possibility would be to map them as an array using seq:
    { "@unset" { "1" = "SOMEVAR" } { "2" = "OTHERVAR" } }
While this is the most obvious and cleanest option, it breaks compatibility
with the current schema, which we want to avoid if possible;
* Another possibility is to simply accept spaces in values, and map them as:
    { "@unset" = "SOMEVAR OTHERVAR" }
I find this quite ugly and not practical as the variables are not properly
parsed by the lens;
* David also suggested the possibility of starting an array only at the
second variable, like:
    { "@unset" = "SOMEVAR" { "1" = "OTHERVAR" } }
It combines the advantages of not breaking the current scheme, while
providing an array. However, it is the only lens that would behave this
way, and it makes it a bit clumsy I find that all variables are not treated
the same way in the tree.


What would you choose? Would you consider it problematic to break
compatibility in order to support this functionality?


-- 
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/20120728/df8f53eb/attachment.htm>


More information about the augeas-devel mailing list