[augeas-devel] Re: [PATCH] Add samba.aug and associated test
Free Ekanayaka
free at 64studio.com
Sat Aug 30 08:54:28 UTC 2008
Note that this patch depends on the
[PATCH] Accept empty comment (still requires ticket #4) to be fixed
submitted by Raphaël.
Ciao,
Free
|--==> On Sat, 30 Aug 2008 10:45:47 +0200, Free Ekanayaka <free at 64studio.com> said:
FE> # HG changeset patch
FE> # User Free Ekanayaka <free at 64studio.com>
FE> # Date 1220085837 -7200
FE> # Node ID ca635716ee992fa0fe23067833655842dfb1532f
FE> # Parent 0c72867cbd685f2dcf6b3a548129e5cffc698250
FE> Add samba.aug and associated test
FE> diff -r 0c72867cbd68 -r ca635716ee99 lenses/samba.aug
FE> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
FE> +++ b/lenses/samba.aug Sat Aug 30 10:43:57 2008 +0200
FE> @@ -0,0 +1,56 @@
FE> +(* Samba module for Augeas
FE> + Author: Free Ekanayaka <free at 64studio.com>
FE> +
FE> + Reference: man smb.conf(5)
FE> +
FE> +*)
FE> +
FE> +
FE> +module Samba =
FE> + autoload xfm
FE> +
FE> +(************************************************************************
FE> + * INI File settings
FE> + *************************************************************************)
FE> +
FE> +let comment = IniFile.comment IniFile.comment_re IniFile.comment_default
FE> +let sep = IniFile.sep IniFile.sep_re IniFile.sep_default
FE> +
FE> +
FE> +(* Import useful INI File primitives *)
FE> +let eol = IniFile.eol
FE> +let empty = IniFile.empty
FE> +let sto_to_comment
FE> + = IniFile.sto_to_comment
FE> +
FE> +(************************************************************************
FE> + * ENTRY
FE> + * smb.conf allows indented entries
FE> + *************************************************************************)
FE> +
FE> +let entry_re = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/
FE> +let entry = let kw = entry_re in
FE> + [ Util.indent
FE> + . key kw
FE> + . sep
FE> + . sto_to_comment?
FE> + . (comment|eol) ]
FE> + | comment
FE> +
FE> +(************************************************************************
FE> + * TITLE
FE> + *************************************************************************)
FE> +
FE> +let title = IniFile.title_label "target" IniFile.record_label_re
FE> +let record = IniFile.record title entry
FE> +
FE> +(************************************************************************
FE> + * LENS & FILTER
FE> + *************************************************************************)
FE> +
FE> +let lns = IniFile.lns record comment
FE> +
FE> +let filter = (incl "/etc/samba/smb.conf")
FE> + . Util.stdexcl
FE> +
FE> +let xfm = transform lns filter
FE> diff -r 0c72867cbd68 -r ca635716ee99 lenses/tests/test_samba.aug
FE> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
FE> +++ b/lenses/tests/test_samba.aug Sat Aug 30 10:43:57 2008 +0200
FE> @@ -0,0 +1,83 @@
FE> +module Test_samba =
FE> +
FE> + let conf = "#
FE> +# Sample configuration file for the Samba suite for Debian GNU/Linux.
FE> +#
FE> +#
FE> +# This is the main Samba configuration file. You should read the
FE> +# smb.conf(5) manual page in order to understand the options listed
FE> +# here. Samba has a huge number of configurable options most of which
FE> +# are not shown in this example
FE> +#
FE> +
FE> +#======================= Global Settings =======================
FE> +
FE> +[global]
FE> +
FE> +## Browsing/Identification ###
FE> +
FE> +# Change this to the workgroup/NT-domain name your Samba server will part of
FE> + workgroup = WORKGROUP
FE> +
FE> +# server string is the equivalent of the NT Description field
FE> + server string = %h server (Samba, Ubuntu)
FE> +
FE> +# Windows Internet Name Serving Support Section:
FE> +# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
FE> +; wins support = no
FE> +
FE> +# Windows clients look for this share name as a source of downloadable
FE> +# printer drivers
FE> +[print$]
FE> + comment = All Printers
FE> + browseable = no
FE> + path = /tmp
FE> + printable = yes
FE> + public = yes
FE> + writable = no
FE> + create mode = 0700
FE> + printcap name = /etc/printcap
FE> + print command = /usr/bin/lpr -P%p -r %s
FE> + printing = cups
FE> +"
FE> +
FE> + test Samba.lns get conf =
FE> + { "#comment" }
FE> + { "#comment" = "Sample configuration file for the Samba suite for Debian GNU/Linux." }
FE> + { "#comment" }
FE> + { "#comment" }
FE> + { "#comment" = "This is the main Samba configuration file. You should read the" }
FE> + { "#comment" = "smb.conf(5) manual page in order to understand the options listed" }
FE> + { "#comment" = "here. Samba has a huge number of configurable options most of which" }
FE> + { "#comment" = "are not shown in this example" }
FE> + { "#comment" }
FE> + {}
FE> + { "#comment" = "======================= Global Settings =======================" }
FE> + {}
FE> + { "target" = "global"
FE> + {}
FE> + { "#comment" = "# Browsing/Identification ###" }
FE> + {}
FE> + { "#comment" = "Change this to the workgroup/NT-domain name your Samba server will part of" }
FE> + { "workgroup" = "WORKGROUP" }
FE> + {}
FE> + { "#comment" = "server string is the equivalent of the NT Description field" }
FE> + { "server string" = "%h server (Samba, Ubuntu)" }
FE> + {}
FE> + { "#comment" = "Windows Internet Name Serving Support Section:" }
FE> + { "#comment" = "WINS Support - Tells the NMBD component of Samba to enable its WINS Server" }
FE> + { "#comment" = "wins support = no" }
FE> + {}
FE> + { "#comment" = "Windows clients look for this share name as a source of downloadable" }
FE> + { "#comment" = "printer drivers" } }
FE> + { "target" = "print$"
FE> + { "comment" = "All Printers" }
FE> + { "browseable" = "no" }
FE> + { "path" = "/tmp" }
FE> + { "printable" = "yes" }
FE> + { "public" = "yes" }
FE> + { "writable" = "no" }
FE> + { "create mode" = "0700" }
FE> + { "printcap name" = "/etc/printcap" }
FE> + { "print command" = "/usr/bin/lpr -P%p -r %s" }
FE> + { "printing" = "cups" } }
FE> _______________________________________________
FE> augeas-devel mailing list
FE> augeas-devel at redhat.com
FE> https://www.redhat.com/mailman/listinfo/augeas-devel
More information about the augeas-devel
mailing list