[augeas-devel] [PATCH 1 of 2] Add puppet.aug and associated test

Raphaël Pinson raphink at gmail.com
Thu Aug 14 07:34:03 UTC 2008


On Wed, Aug 13, 2008 at 10:41 PM, Raphaël Pinson <raphink at gmail.com> wrote:

>
>
> On Wed, Aug 13, 2008 at 8:41 PM, David Lutterkort <dlutter at redhat.com>wrote:
>
>> On Wed, 2008-08-13 at 18:54 +0200, Raphael Pinson wrote:
>> > # HG changeset patch
>> > # User Raphael Pinson <raphink at gmail.com>
>> > # Date 1218646423 -7200
>> > # Node ID 6f492eaaa453856246c5ffa79ffd1c8e06939261
>> > # Parent  98e1bdd4af843caab45a32d0120c6c5497260f2d
>> > Add puppet.aug and associated test
>>
>> Nice :) ACK, committed.
>>
>> One only slightly related thing about Inifile:
>>
>> > --- /dev/null Thu Jan 01 00:00:00 1970 +0000
>> > +++ b/lenses/tests/test_puppet.aug    Wed Aug 13 18:53:43 2008 +0200
>> > @@ -0,0 +1,31 @@
>> > +module Test_puppet =
>> > +
>> > +   let conf = "
>> > +[main]
>> > +logdir=/var/log/puppet
>> > +
>> > +[puppetd]
>> > +server=misspiggy.network.com
>> > +"
>> > +
>> > +   test Puppet.lns get conf =
>> > +      {}
>> > +      { "section" = "main"
>> > +         { "logdir" = "/var/log/puppet" }
>> > +         {} }
>> > +      { "section" = "puppetd"
>> > +         { "server" = "misspiggy.network.com" } }
>>
>> Wouldn't it be nicer to use the titles of sections as their key instead
>> of calling everything section ? That would make navigating the tree
>> easier ... for cases where section names are too horrendous (Php ?) the
>> way things are right now are preferrable.
>>
>
>
> That's funny! I thought about that just today when I was making this lens,
> and then I thought that I would look at it later because of the php.aug
> mess, and how some other INI Files like dput have unpredictable section
> titles, too, except for [DEFAULT].
>
> I'll have a look at that, it definitely shouldn't be too hard.
>


Actually, looking at your comments about how PHP can have entries outside of
sections makes me think that this shouldn't be the default behaviour for INI
Files imo, or if it is, then it shouldn't be this way for PHP at least. We
cannot predict the keys for php.ini, and there might be key/value pairs
outside of sections, which means that there will be ambiguities on put
between entries outside of sections and sections themselves if we map the
sections with keys.

"
field=value
[section]
field2=value2
"

would turn into

{ "field" = "value" }
{ "section"
    { "field2" = "value2" } }


So put won't know whether field is a section of an entry.

Of course, having entries outside of sections is not a normal behaviour for
an INI File, so maybe I should find a trick in php.aug instead.


Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080814/896a745d/attachment.htm>


More information about the augeas-devel mailing list