[augeas-devel] Proposed changes in IniFile

Raphaël Pinson raphael.pinson at camptocamp.com
Thu Jan 10 23:31:27 UTC 2013


Last update for the day:

I've made new changes to support other features by default:

* IniFile now supports doseol by default, because there's often (sadly)
IniFiles can use \r\n as eol. The IniFile-based lenses have been fixed
accordingly;
* There are now entry_generic and entry_multiline_generic definitions
allowing to avoid redefining too much in lenses, when # and ; are allowed
in values for example.

Again, these changes require a few adaptions in existing IniFile-based
lenses. The diff in the patch series [1] demonstrates the kind of changes
that are necessary to make, essentially:

* Excluding \r as well as \n from values because of the doseol support;
* Fixing definitions using deprecated IniFile definitions (such as
sto_to_eol or sto_to_comment). I could optionally keep these in inifile.aug
for compatibility purpose, even though they are not used anymore;
* Changing { "#comment" } into {} in test files since empty comments are
mapped as empty nodes;
* Fixing double quoted values in tests (and code) since smart quotes are
used.

All these are not huge changes but they do require editing/debugging,
although I believe the benefits are well worth it (more standard lenses,
support for smart quotes, simple to use "loose" lenses, doseol support).


Raphaël


On Thu, Jan 10, 2013 at 5:24 PM, Raphaël Pinson <
raphael.pinson at camptocamp.com> wrote:

> Some news:
>
> I fixed both avahi.aug and yum.aug (although I didn't manage to explain
> the segfault), so all the tests pass now.
>
> Other people using the IniFile generic lens might have to adjust their
> lenses (and tests) though if we keep these changes.
>
> The branch is up-to-date with these changes.
>
>
> Raphaël
>
>
>
> On Thu, Jan 10, 2013 at 4:56 PM, Raphaël Pinson <
> raphael.pinson at camptocamp.com> wrote:
>
>> Hello,
>>
>>
>> The IniFile module is probably the first generic module we introduced
>> after Util, and it's been there for quite some time.
>>
>> As Dominic and I were considering providing an Augeas-based Puppet
>> provider for generic inifiles (similar to Chris Prices' [0]), I tried
>> to write loose lenses that could be used out-of-the-box for most
>> cases, and I ended up making quite a few changes.
>>
>> Here are the proposed changes and their issues:
>>
>> * Supporting smart quotes (ala Quote.quote_spaces) by default. This
>> has caused problems with IniFile lenses that only support one kind of
>> comment type (# or ;) and use either # or ; as valid unquoted
>> characters in their values;
>> * Using Util.comment_generic. This has been quite smooth change, but
>> it means we must manage empty comments in the empty definition (like
>> everywhere else);
>> * Using Util.empty instead of [ eol ] to be in tune with the rest of
>> the lenses. This has mostly caused issues with multiline lenses and
>> empty comments, since comment must not be indented in multiline
>> IniFile lenses.
>>
>> The current changes are available in a branch on github [1]. The yum
>> lens is still broken and the avahi lens segfaults (and I haven't been
>> able to reproduce with a simpler case).
>>
>> Please let me know which changes you think might be worth keeping.
>>
>>
>> Raphaël
>>
>>
>>
>> [0] https://github.com/cprice-puppet/puppetlabs-inifile
>> [1] https://github.com/raphink/augeas/compare/dev;inifile
>>
>> _______________________________________________
>> augeas-devel mailing list
>> augeas-devel at redhat.com
>> https://www.redhat.com/mailman/listinfo/augeas-devel
>>
>
>
>
> --
> 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
>



-- 
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/20130111/3e6d6d1c/attachment.htm>


More information about the augeas-devel mailing list