chickadee » augeas » aug-load!

aug-load! aprocedure

Loads files into the tree. This is done by default in aug-init unless you provide it the no-load flag.

Raises an error on failure, or returns an unspecified value on success. Note that "success" includes the case where some files could not be loaded due to parse error etc. Details of such files can be found in the nodeset /augeas//error.

Which files to load and what lenses to use on them is specified under /augeas/load in the tree; each entry /augeas/load/NAME specifies a transform, by having itself exactly one child lens and any number of children labelled incl and excl. The value of NAME has no meaning.

The lens grandchild of /augeas/load specifies which lens to use, and can either be the fully qualified name of a lens Module.lens or @Module. The latter form means that the lens from the transform marked for autoloading in MODULE should be used.

The 'incl' and 'excl' grandchildren of /augeas/load indicate which files to transform. Their value are used as glob patterns. Any file that matches at least one 'incl' pattern and no 'excl' pattern is transformed. The order of 'incl' and 'excl' entries is irrelevant.

When aug-load! is first called, it populates /augeas/load with the transforms marked for autoloading in all the modules it finds. Before loading any files, aug-load! will remove everything underneath /augeas/files (file metadata) and /files (file data), regardless of whether any entries have been modified or not.

Note: despite the fact that file metadata under /augeas/files is cleared on load, a previously-loaded file will only be reloaded if its data in /files has been modified in memory, or if its modification time on disk (mtime) has changed. The mtime has a granularity of one second. Therefore, if the file changes within one second after it was loaded or saved, it won't be re-read. If necessary, you can force a reload by clearing the mtime with something similar to:

(aug-set! a "/augeas/files/etc/hosts/mtime" #f)