[augeas-devel] Re: Prefix for IniFile entries

Free Ekanayaka free at 64studio.com
Wed Aug 27 08:49:07 UTC 2008


Hi Raphaël,

|--==> On Tue, 26 Aug 2008 21:19:51 +0200, "Raphaël Pinson" <raphink at gmail.com> said:

  RP> On Tue, Aug 26, 2008 at 7:23 PM, Free Ekanayaka <free at 64studio.com> wrote:
  >>Hi,
  >>
  >>the /etc/samba/smb.conf is basically a INI file, but it allows entries
  >>to be prefixed by spaces and tabs, like:
  >>
  >>[global]
  >>
  >># Change this to the workgroup/NT-domain name your Samba server will part
  >>of
  >>workgroup = WORKGROUP
  >>
  >>Is there are way to set this as a parameter in inifile.aug?
  >>

  RP> I have considered adding indentation support to inifile.aug but it does not
  RP> seem to be standard INI file syntax, and adding it optionally would make the
  RP> interface heavier.


  >>
  >>I've tried to define an entry as:
  >>
  >>let entry = del / */ "" . IniFile.entry setting sep comment
  >>

  RP> You could probably use Util.indent instead of this.

I've tried some more combinations and discovered that if I prepend del / */ ""
or Util.indent to the entry definition in samba.aug, then I get:

lenses/samba.aug:28.13-.60:exception: ambiguous concatenation
      ' #A\n' can be split into
      '|=| #A\n'

     and
      ' |=|#A\n'

    First lens: lenses/util.aug:12.15-.30
    Second lens: lenses/inifile.aug:47.25-.85

but if I prepend it in the entry definition of inifile.aug:

diff -r 6b66d3426ef2 lenses/inifile.aug
--- a/lenses/inifile.aug        Tue Aug 26 01:59:55 2008 +0200
+++ b/lenses/inifile.aug        Wed Aug 27 10:45:47 2008 +0200
@@ -44,7 +44,7 @@ let comment_default    = ";"
 (* entry includes comments *)
 
 let entry (kw:regexp) (sep:lens) (comment:lens)
-                       = [ key kw . sep . sto_to_comment? . (comment|eol) ] | comment
+                       = [ Util.indent . key kw . sep . sto_to_comment? . (comment|eol) ] | comment
 let entry_re           = ( /[A-Za-z][A-Za-z0-9\._-]+/ - /#comment/ )
 

then everything runs smoothly. I don't understand exactly why..

I've run the puppet dput and php tests, and it turns out that
prepending Util.ident does not seem to break any of the. So I wonder
if it would be possible to include this change in inifile.aug.

Thanks,

Free




More information about the augeas-devel mailing list