[augeas-devel] Parsing YAML files in Augeas

Raphaël Pinson raphael.pinson at camptocamp.com
Sun Dec 23 19:19:24 UTC 2012


Hi Tom,


On Sun, Dec 23, 2012 at 7:59 PM, Tom Limoncelli <tal at whatexit.org> wrote:

> Has anyone made a lens for YAML files?
>
> I noticed that cobbersettings.aug is a YAML-like file format.
> However, it doesn't handle 2 levels of indenting.
>
>

This subject has been mentioned to me this week actually, as Marc Fournier
asked me if it would be possible to support ElasticSearch, which uses YAML
for its conffiles.

While it is possible to support a subtract of YAML, like it is already done
for CobblerSettings and JSON, the full syntax could no be possible. In
particular, YAML has several syntaxes for arrays and hashes. The one-line
syntax is pretty much like JSON, but the multi-line syntax requires to have
an identical indentation for every entry, something Augeas cannot do
currently.

So,

    key: [ { key2: [ valA, valB ] } ]

could be supported, but

    key:
      - key2:
        - valA
        - valB

could not (again, currently).


Raphaël


I tried to extend cobblersettings.aug to handle something simple like this:
>
> key:
>  - key2:
>    - valA
>    - valB
>
> However, coding that is beyond my level of expertise.
>
> Ultimately I need to add the "{ key: val, key2: val2}" notation
> because the files that I need to manipulate look like:
>
> key:
>  - key2:
>    - {key3: val3, key4: val4}
>    - {key5: val5, key6: val6}
>    - {key6: val6, key7: val7}
>    key8: val8
>  - key9:
>    - {key10: val10, key11: val11}
>    - {key12: val12, key12: val12}
>    key13: val13
>
> However first I need to get through the issue of handling multiple
> levels of indentation.  Suggestions?
>
> Tom
>
> --
> http://EverythingSysadmin.com  -- my blog
> http://www.TomOnTime.com -- my videos
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20121223/4cc6a51b/attachment.htm>


More information about the augeas-devel mailing list