[augeas-devel] cobbersettings lense

Greg Swift gregswift at gmail.com
Wed Apr 4 13:14:57 UTC 2012


I was just working with jimi_c over in cobbler about him using augeas
to manage the cobbler settings file from the webui.  We ran into some
parsing and consistency issues.  When he was trying to edit a value
that had multilines with indents he would end up with a tab indent
instead of the existing space.  I looked in the lens and this is
fairly obvious.  indent is defined as /[ \t]+/ being replaced with \t.
 The problem with this is two fold:

1) generally the file is using spaces by default, so unless someone
changed it there wouldn't be tabs and augeas doesn't rewrite the whole
file with this change for consistency

2) Apparently YAML or pyYAML doesn't like the tabs anyway.

So I looked in the file and found that by default there are two sets of indents.

cheetah_import_whitelist:
   - "random"
   - "re"
   - "time"

3 spaces and a - + value, the default file has quotes, augeas doesn't
write quotes... it appears to work both ways.

kernel_options:
    ksdevice: bootif
    lang: ' '
    text: ~

4 spaces with a k: v pair.

Changing the indent expression to replace with a set of spaces works,
although you do end up with misalignment for one type or the other.

I'm also slightly confused by the fact that these two expressions
seems to overlap, but augeas doesn't complain, and if I change the ws
one to not use a *, it blows up.

   let indent = del /^[ \t]+/ "    "
   let ws = del /[ \t]*/ " "

thoughts?

-greg




More information about the augeas-devel mailing list