[augeas-devel] Prefix for IniFile entries

Free Ekanayaka free at 64studio.com
Tue Aug 26 17:23:59 UTC 2008


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?

I've tried to define an entry as:

let entry = del / */ "" . IniFile.entry setting sep comment

But it does not work, I get:

Test run encountered exception:
lenses/tests/test_samba.aug:12.8-.26:exception: Get did not match entire input
    Error encountered here (143 characters into string)
    <t of\n workgroup = WORKGROUP\n|=|>

    Tree generated so far:
    /(none)

Hints? Below you find my complete samba.aug and test_samba.aug

Thanks,

Free

=========================== samba.aug ============================
(* Samba module for Augeas 
   Author: Free Ekanayaka <free at 64studio.com>

   Reference: man smb.conf(5)

*)


module Samba =
  autoload xfm


(************************************************************************
 * INI File settings
 *************************************************************************)
let comment  = IniFile.comment IniFile.comment_re IniFile.comment_default

let sep      = IniFile.sep IniFile.sep_re IniFile.sep_default


let setting = "workgroup"

let entry = del / */ "" . IniFile.entry setting sep comment

let title   = IniFile.title_label "target" IniFile.record_label_re
let record  = IniFile.record title entry 

let lns    = IniFile.lns record comment

let filter = (incl "/etc/samba/smb.conf")
           . Util.stdexcl

let xfm = transform lns filter

=========================== test_samba.aug ============================
module Test_samba =

   let conf = "
[global]

## Browsing/Identification ###

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP
"

   test Samba.lns get conf = 
      {}
      { "target" = "global"
         {}
         { "#comment" = "# Browsing/Identification ###" }
         {}
         { "#comment" = "Change this to the workgroup/NT-domain name your Samba server will part of" }
         { "workgroup"  = "WORKGROUP" } }




More information about the augeas-devel mailing list