[augeas-devel] cobbersettings lense

Dominic Cleal dcleal at redhat.com
Fri Apr 6 21:31:31 UTC 2012


On 06/04/12 18:32, James Cammarata wrote:
> Is there a way to force augeas to rewrite entries that may already
> exist, especially where whitespace is concerned? The issue is when
> adding on to an existing list or hash, I still get this:
> 
> cheetah_import_whitelist:
>    - random
>    - re
>    - time
>  -foo
> 
> Which gets interpreted as invalid YAML due to the inconsistent
> spacing. Our settings file has grown organically over the years, and
> since it's usually only hand-edited rather than machine generated it
> has inconsistent whitespaces as Greg noted before.

Hm, that's a big stumbling block with editing YAML through Augeas.
Augeas doesn't have a way to copy formatting from one block to another,
so it can't ensure indentation is identical.  The only way would be to
change the string in "indent" that's used when nodes are created so it's
the same as existing entries upfront, which is tricky/imposssible.

The only thing that comes to mind is using aug_to_xml or augtool's
dump-xml to write it out to XML and back to ensure consistency, but
we're missing the reverse function (Raphael was talking about this in
the Puppet thread earlier today).

-- 
Dominic Cleal
Red Hat Consulting
m: +44 (0)7817 878113




More information about the augeas-devel mailing list