~iheino+ub/+junk/nut-upsconf-docfix

« back to all changes in this revision

Viewing changes to scripts/augeas/nuthostsconf.aug.in

  • Committer: Tuomas Heino
  • Author(s): Laurent Bigonville
  • Date: 2014-04-22 20:46:12 UTC
  • Revision ID: iheino+ub@cc.hut.fi-20140422204612-1x2gh3nkezfsdao4
Tags: upstream-2.7.2
ImportĀ upstreamĀ versionĀ 2.7.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(*
 
2
Module: NutHostsConf
 
3
 Parses @CONFPATH@/hosts.conf
 
4
 
 
5
Author: Frederic Bohe  <fredericbohe@eaton.com>
 
6
 
 
7
About: License
 
8
  This file is licensed under the GPL.
 
9
 
 
10
About: Lens Usage
 
11
  Sample usage of this lens in augtool
 
12
 
 
13
    * Print all monitored upsd
 
14
        > print /files@CONFPATH@/hosts.conf/MONITOR
 
15
 
 
16
About: Configuration files
 
17
  This lens applies to @CONFPATH@/hosts.conf. See <filter>.
 
18
*)
 
19
 
 
20
module NutHostsConf =
 
21
  autoload hosts_xfm
 
22
 
 
23
(************************************************************************
 
24
 * Group:                 HOSTS.CONF
 
25
 *************************************************************************)
 
26
 
 
27
(* general *)
 
28
let del_spc  = Util.del_opt_ws ""
 
29
let sep_spc  = Util.del_ws_spc
 
30
let eol      = Util.eol
 
31
let word     = /[^"#; \t\n]+/
 
32
let empty    = Util.empty
 
33
let comment  = Util.comment
 
34
let quoted_string = del "\"" "\"" . store /[^"\n]+/ . del "\"" "\""
 
35
 
 
36
let hosts_notify = [ del_spc . key "MONITOR" . sep_spc
 
37
                         . [ label "system" . store word . sep_spc ]
 
38
                         . [ label "description" . quoted_string ] . eol ]
 
39
 
 
40
let hosts_lns    = (hosts_notify|comment|empty)*
 
41
 
 
42
let hosts_filter = ( incl "@CONFPATH@/hosts.conf" )
 
43
                        . Util.stdexcl
 
44
 
 
45
let hosts_xfm    = transform hosts_lns hosts_filter