[augeas-devel] [PATCH] Add samba.aug and associated test

Free Ekanayaka free at 64studio.com
Sat Aug 30 08:45:47 UTC 2008


# HG changeset patch
# User Free Ekanayaka <free at 64studio.com>
# Date 1220085837 -7200
# Node ID ca635716ee992fa0fe23067833655842dfb1532f
# Parent  0c72867cbd685f2dcf6b3a548129e5cffc698250
Add samba.aug and associated test

diff -r 0c72867cbd68 -r ca635716ee99 lenses/samba.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/samba.aug	Sat Aug 30 10:43:57 2008 +0200
@@ -0,0 +1,56 @@
+(* 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
+
+
+(* Import useful INI File primitives *)
+let eol      = IniFile.eol
+let empty    = IniFile.empty
+let sto_to_comment
+             = IniFile.sto_to_comment
+
+(************************************************************************
+ *                        ENTRY
+ * smb.conf allows indented entries
+ *************************************************************************)
+
+let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/
+let entry    = let kw = entry_re in
+             [ Util.indent
+             . key kw
+             . sep
+             . sto_to_comment?
+             . (comment|eol) ]
+             | comment
+
+(************************************************************************
+ *                         TITLE
+ *************************************************************************)
+
+let title    = IniFile.title_label "target" IniFile.record_label_re
+let record   = IniFile.record title entry 
+
+(************************************************************************
+ *                         LENS & FILTER
+ *************************************************************************)
+
+let lns      = IniFile.lns record comment
+
+let filter   = (incl "/etc/samba/smb.conf")
+             . Util.stdexcl
+
+let xfm = transform lns filter
diff -r 0c72867cbd68 -r ca635716ee99 lenses/tests/test_samba.aug
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lenses/tests/test_samba.aug	Sat Aug 30 10:43:57 2008 +0200
@@ -0,0 +1,83 @@
+module Test_samba =
+
+   let conf = "#
+# Sample configuration file for the Samba suite for Debian GNU/Linux.
+#
+#
+# This is the main Samba configuration file. You should read the
+# smb.conf(5) manual page in order to understand the options listed
+# here. Samba has a huge number of configurable options most of which 
+# are not shown in this example
+#
+
+#======================= Global Settings =======================
+
+[global]
+
+## Browsing/Identification ###
+
+# Change this to the workgroup/NT-domain name your Samba server will part of
+   workgroup = WORKGROUP
+
+# server string is the equivalent of the NT Description field
+   server string = %h server (Samba, Ubuntu)
+
+# Windows Internet Name Serving Support Section:
+# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
+;   wins support = no
+
+# Windows clients look for this share name as a source of downloadable
+# printer drivers
+[print$]
+   comment = All Printers
+   browseable = no
+   path = /tmp
+   printable = yes
+   public = yes
+   writable = no
+   create mode = 0700
+   printcap name = /etc/printcap
+   print command = /usr/bin/lpr -P%p -r %s
+   printing = cups
+"
+
+   test Samba.lns get conf = 
+      { "#comment" }
+      { "#comment" = "Sample configuration file for the Samba suite for Debian GNU/Linux." }
+      { "#comment" }
+      { "#comment" }
+      { "#comment" = "This is the main Samba configuration file. You should read the" }
+      { "#comment" = "smb.conf(5) manual page in order to understand the options listed" }
+      { "#comment" = "here. Samba has a huge number of configurable options most of which" }
+      { "#comment" = "are not shown in this example" }
+      { "#comment" }
+      {}
+      { "#comment" = "======================= Global Settings =======================" }
+      {}
+      { "target" = "global"
+         {}
+         { "#comment" = "# Browsing/Identification ###" }
+         {}
+         { "#comment" = "Change this to the workgroup/NT-domain name your Samba server will part of" }
+         { "workgroup"  = "WORKGROUP" }
+         {}
+         { "#comment" = "server string is the equivalent of the NT Description field" }
+         { "server string" = "%h server (Samba, Ubuntu)" }
+         {}
+         { "#comment" = "Windows Internet Name Serving Support Section:" }
+         { "#comment" = "WINS Support - Tells the NMBD component of Samba to enable its WINS Server" }
+         { "#comment" = "wins support = no" }
+         {}
+         { "#comment" = "Windows clients look for this share name as a source of downloadable" }
+         { "#comment" = "printer drivers" } }
+      { "target" = "print$"
+         { "comment" = "All Printers" }
+         { "browseable" = "no" }
+         { "path" = "/tmp" }
+         { "printable" = "yes" }
+         { "public" = "yes" }
+         { "writable" = "no" }
+         { "create mode" = "0700" }
+         { "printcap name" = "/etc/printcap" }
+         { "print command" = "/usr/bin/lpr -P%p -r %s" }
+         { "printing" = "cups" } }




More information about the augeas-devel mailing list