[augeas-devel] file not being parsed?

Tim Stoop tim.stoop at gmail.com
Thu Feb 18 20:47:45 UTC 2010


Hi all,

I've made a very simple nagios.cfg parser (basically, the puppet
parser) and now I'm trying to test it. But I'm not really sure what
I'm doing wrong here, it seems like augeas cannot load the file? Any
help is appreciated!

puppet-test:~# ls /etc/nagios3/nagios.cfg
/etc/nagios3/nagios.cfg
puppet-test:~# cat /usr/share/augeas/lenses/dist/nagioscfg.aug
(* Nagios.cfg module for Augeas
 Author: Tim Stoop <tim at kumina.nl>
 but mostly based on the puppet lens by Raphael Pinson <raphink at gmail.com>

 nagios.cfg is a standard INI File without headers.
*)


module NagiosCfg =
  autoload xfm

(************************************************************************
 * INI File settings
 *
 * nagios.cfg supports "# as commentary and "=" as separator
 *************************************************************************)
let comment    = IniFile.comment "#" "#"
let sep        = IniFile.sep "=" "="


(************************************************************************
 *                        ENTRY
 * nagios.cfg uses standard INI File entries
 *************************************************************************)
let entry   = IniFile.indented_entry IniFile.entry_re sep comment


(************************************************************************
 *                        RECORD
 * nagios.cfg uses standard INI File records
 *************************************************************************)
let title   = IniFile.indented_title IniFile.record_re
let record  = IniFile.record title entry


(************************************************************************
 *                        LENS & FILTER
 * nagios.cfg uses standard INI File records
 *************************************************************************)
let lns     = IniFile.lns record comment

let filter = (incl "/etc/nagios3/nagios.cfg")

let xfm = transform lns filter
puppet-test:~# augtool
augtool> load
augtool> ls /augeas/load/NagiosCfg/
lens = @NagiosCfg
incl = /etc/nagios3/nagios.cfg
augtool> ls /files/etc/nagios3/nagios.cfg
augtool>

-- 
Gegroet,
Tim




More information about the augeas-devel mailing list