1 (* -*- coding: utf-8 -*-
2 Module: PuppetFileserver
3 Parses /etc/puppet/fileserver.conf used by puppetmasterd daemon.
5 Author: Frédéric Lespez <frederic.lespez@free.fr>
8 This lens tries to keep as close as possible to puppet documentation
10 http://docs.puppetlabs.com/guides/file_serving.html
13 This file is licensed under the LGPL v2+, like the rest of Augeas.
16 Sample usage of this lens in augtool
18 * Create a new mount point
19 > ins test_mount after /files/etc/puppet/fileserver.conf/*[last()]
20 > defvar test_mount /files/etc/puppet/fileserver.conf/test_mount
21 > set $test_mount/path /etc/puppet/files
22 > set $test_mount/allow *.example.com
23 > ins allow after $test_mount/*[last()]
24 > set $test_mount/allow[last()] server.domain.com
25 > set $test_mount/deny dangerous.server.com
26 * List the definition of a mount point
27 > print /files/etc/puppet/fileserver.conf/files
28 * Remove a mount point
29 > rm /files/etc/puppet/fileserver.conf/test_mount
31 About: Configuration files
32 This lens applies to /etc/puppet/fileserver.conf. See <filter>.
36 module PuppetFileserver =
39 (************************************************************************
40 * Group: USEFUL PRIMITIVES
41 *************************************************************************)
43 (* Group: INI File settings *)
49 Only treat one space as the sep, extras are stripped by IniFile *)
50 let sep = Util.del_str " "
54 Only supports "#" as commentary
56 let comment = IniFile.comment "#" "#"
60 Regexp for possible <entry> keyword (path, allow, deny)
62 let entry_re = /path|allow|deny/
65 (************************************************************************
67 *************************************************************************)
71 - It might be indented with an arbitrary amount of whitespace
72 - It does not have any separator between keywords and their values
73 - It can only have keywords with the following values (path, allow, deny)
75 let entry = IniFile.indented_entry entry_re sep comment
78 (************************************************************************
80 *************************************************************************)
82 (* Group: Title definition *)
86 Uses standard INI File title
88 let title = IniFile.indented_title IniFile.record_re
92 Uses standard INI File record
94 let record = IniFile.record title entry
97 (************************************************************************
99 *************************************************************************)
103 Uses standard INI File lens
105 let lns = IniFile.lns record comment
107 (* Variable: filter *)
108 let filter = (incl "/etc/puppet/fileserver.conf"
109 .incl "/usr/local/etc/puppet/fileserver.conf"
110 .incl "/etc/puppetlabs/puppet/fileserver.conf")
112 let xfm = transform lns filter