Search code examples
linuxbashpuppetaugeas

How to use augtool without a lense?


augtool Augeas seams to be a popular program for Puppet to modify config files, but how do I modify a config file where augtool doesn't have a lense for? E.g.:

[Desktop Entry]
Type=Application
Encoding=UTF-8
Name=Compiz
Exec=compiz
NoDisplay=false
# name of loadable control center module
X-GNOME-WMSettingsModule=metacity

In this particular example would I like to change NoDisplay to true.

Question

Is it possible to modify config files without a lense? Can augtool try to guess the tree structure of a config file?


Solution

  • Augeas cannot guess which lens to use. For example, in the case of a Desktop file (your example), many lenses could be used (MySQL.lns, PHP.lns, etc.) but each of them would introduce restrictions that would not be compatible with the Desktop format.

    In your case, you want to use the Desktop.lns lens:

    $ augtool --autosave --noautoload --transform "Desktop.lns incl /path/to/your/example.desktop" set "/files/path/to/your/example.desktop/Desktop Entry/NoDisplay" true