Augeas and custom lenses?

1,217 views
Skip to first unread message

Jakov Sosic

unread,
Nov 6, 2012, 5:31:10 PM11/6/12
to puppet...@googlegroups.com
Hi

I want to modify one of the existing lenses to better suit my needs, but
I don't know where to put it on the filesystem?

It seems wrong to overwrite file in /usr/share/augeas/lenses/dist or to
rebuild augeas-libs, is there any other way to distribute modifications
of existing lenses or completely new lenses?




Ian Mortimer

unread,
Nov 6, 2012, 10:48:56 PM11/6/12
to puppet...@googlegroups.com
On 07/11/12 08:31, Jakov Sosic wrote:

> I want to modify one of the existing lenses to better suit my needs, but
> I don't know where to put it on the filesystem?

I build an rpm which installs custom lenses in /usr/share/augeas/lenses

> It seems wrong to overwrite file in /usr/share/augeas/lenses/dist or to
> rebuild augeas-libs, is there any other way to distribute modifications
> of existing lenses or completely new lenses?

It would be nicer to put them in /usr/share/augeas/lenses/local but
that doesn't work (or didn't the last time I tried).


--
Ian
i.mor...@uq.edu.au Ian Mortimer
Tel: +61 7 3346 8528 Science IT
University of Queensland

Dominic Cleal

unread,
Nov 7, 2012, 11:03:24 AM11/7/12
to puppet...@googlegroups.com
You can deploy them as file resources or packages (as Ian suggested)
into /usr/share/augeas/lenses, which takes precedence over the dist
subdirectory.

If you are using 2.7.18 or higher, you can also pluginsync lenses in the
same way as facts etc. This should take precedence over dist lenses
too. Store the lens at:

modulename/lib/augeas/lenses/custom.aug

(http://docs.puppetlabs.com/guides/plugins_in_modules.html)

--
Dominic Cleal
Red Hat Engineering

otheus uibk

unread,
Feb 15, 2017, 5:38:37 AM2/15/17
to Puppet Users, dcl...@redhat.com
Hi Dom,

The puppet documentation you references is just slight on details (well, that could be said about lots of projects these days). 
Does puppet put such lenses in its own directory? Does puppet ensure such lenses override the "default" ones mentioned in the augtool page? All that is mentioned is "Facts and Augeas lenses are used solely by Puppet agent."  But that's not really true of facts, as their visibility, once installed, are global.

Dominic Cleal

unread,
Feb 15, 2017, 7:59:49 AM2/15/17
to puppet...@googlegroups.com
On 15/02/17 10:38, otheus uibk wrote:
> Hi Dom,
>
> The puppet documentation you references is just slight on details (well,
> that could be said about lots of projects these days).

If you're replying to a five year old thread(!), some context would be
handy. For reference:
https://docs.puppet.com/puppet/latest/plugins_in_modules.html

> Does puppet put such lenses in its own directory?

Yes, in the agent's libdir, under augeas/lenses/.

> Does puppet ensure such lenses override the "default" ones mentioned in the augtool
> page?

Yes. The agent directory is specified as an include directory to Augeas,
which always has precedence over Augeas' default directories.

> All that is mentioned is "Facts and Augeas lenses are used solely
> by Puppet agent." But that's not really true of facts, as their
> visibility, once installed, are global.

Custom facts from Puppet are read only when the additional agent
directory is included (i.e. with Facter's -p flag). Lenses work in a
very similar way - they are not installed globally.

--
Dominic Cleal
dom...@cleal.org

otheus uibk

unread,
Feb 16, 2017, 2:49:22 PM2/16/17
to puppet...@googlegroups.com
Dom, Sorry about resurrecting the old thread. About facts:  `facter -p` (2.4.6) shows puppet facts, but not the ones loaded via puppet modules in /var/lib/puppet/facts.d (unless --external-dir is specified). For that reason, perhaps, we started putting ours in /etc/facter. 

otheus uibk

unread,
Feb 16, 2017, 2:50:49 PM2/16/17
to puppet...@googlegroups.com

On Thu, Feb 16, 2017 at 8:48 PM, otheus uibk <otheu...@gmail.com> wrote:
Dom, Sorry about resurrecting the old thread. About facts:  `facter -p` (2.4.6) shows puppet facts, but not the ones loaded via puppet modules in /var/lib/puppet/facts.d (unless --external-dir is specified). For that reason, perhaps, we started putting ours in /etc/facter. 



Reply all
Reply to author
Forward
0 new messages