/usr/share/augeas/lenses/dist/trapperkeeper.aug is in augeas-lenses 1.10.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | (*
Module: Trapperkeeper
Parses Trapperkeeper configuration files
Author: Raphael Pinson <raphael.pinson@camptocamp.com>
About: License
This file is licenced under the LGPL v2+, like the rest of Augeas.
About: Lens Usage
To be documented
About: Configuration files
This lens applies to Trapperkeeper webservice configuration files. See <filter>.
About: Examples
The <Test_Trapperkeeper> file contains various examples and tests.
*)
module Trapperkeeper =
autoload xfm
(************************************************************************
* Group: USEFUL PRIMITIVES
*************************************************************************)
(* View: empty *)
let empty = Util.empty
(* View: comment *)
let comment = Util.comment
(* View: sep *)
let sep = del /[ \t]*[:=]/ ":"
(* View: sep_with_spc *)
let sep_with_spc = sep . Sep.opt_space
(************************************************************************
* Group: BLOCKS (FROM 1.2, FOR 0.10 COMPATIBILITY)
*************************************************************************)
(* Variable: block_ldelim_newlines_re *)
let block_ldelim_newlines_re = /[ \t\n]+\{([ \t\n]*\n)?/
(* Variable: block_rdelim_newlines_re *)
let block_rdelim_newlines_re = /[ \t]*\}/
(* Variable: block_ldelim_newlines_default *)
let block_ldelim_newlines_default = "\n{\n"
(* Variable: block_rdelim_newlines_default *)
let block_rdelim_newlines_default = "}"
(************************************************************************
* View: block_newline
* A block enclosed in brackets, with newlines forced
* and indentation defaulting to a tab.
*
* Parameters:
* entry:lens - the entry to be stored inside the block.
* This entry should not include <Util.empty>,
* <Util.comment> or <Util.comment_noindent>,
* should be indented and finish with an eol.
************************************************************************)
let block_newlines (entry:lens) (comment:lens) =
del block_ldelim_newlines_re block_ldelim_newlines_default
. ((entry | comment) . (Util.empty | entry | comment)*)?
. del block_rdelim_newlines_re block_rdelim_newlines_default
(************************************************************************
* Group: ENTRY TYPES
*************************************************************************)
let opt_dquot (lns:lens) = del /"?/ "" . lns . del /"?/ ""
(* View: simple *)
let simple = [ Util.indent . label "@simple" . opt_dquot (store /[A-Za-z0-9_.\/-]+/) . sep_with_spc
. [ label "@value" . opt_dquot (store /[^,"\[ \t\n]+/) ]
. Util.eol ]
(* View: array *)
let array =
let lbrack = Util.del_str "["
in let rbrack = Util.del_str "]"
in let opt_space = del /[ \t]*/ ""
in let comma = opt_space . Util.del_str "," . opt_space
in let elem = [ seq "elem" . opt_dquot (store /[^,"\[ \t\n]+/) ]
in let elems = counter "elem" . Build.opt_list elem comma
in [ Util.indent . label "@array" . store Rx.word
. sep_with_spc . lbrack . Sep.opt_space
. (elems . Sep.opt_space)?
. rbrack . Util.eol ]
(* View: hash *)
let hash (lns:lens) = [ Util.indent . label "@hash" . store Rx.word . sep
. block_newlines lns Util.comment
. Util.eol ]
(************************************************************************
* Group: ENTRY
*************************************************************************)
(* Just for typechecking *)
let entry_no_rec = hash (simple|array)
(* View: entry *)
let rec entry = hash (entry|simple|array)
(************************************************************************
* Group: LENS AND FILTER
*************************************************************************)
(* View: lns *)
let lns = (empty|comment)* . (entry . (empty|comment)*)*
(* Variable: filter *)
let filter = incl "/etc/puppetserver/conf.d/*"
. incl "/etc/puppetlabs/puppetserver/conf.d/*"
. Util.stdexcl
let xfm = transform lns filter
|