Theresa Arzadon-Labajo | ||||
Menu:
Powered by Website Baker |
I needed to edit a custom desktop file that had a typo in it on all my workstations. I used Augeas to edit the file and Puppet to automate it for me. My file was /usr/share/applications/mathematica-10.0.desktop. The Icon line was wrong and I didn't want to wait for recompiling the RPM package and adding it to my repo and then run yum update on all my machines. I figured I could use augeas and puppet to make the changes. First, I needed to know if there was an existing lens in augeas. It is in /usr/share/augeas/lenses/dist/desktop.aug. The module name is called Desktop. To reference the module, you would use Desktop.lns. I first tried it using the command line augtool to make sure it worked. # augtool augtool> set /augeas/load/desktop/lens "Desktop.lns" augtool> set /augeas/load/desktop/incl "/usr/share/applications/mathematica-10.0.desktop augtool> load augtool> print "/files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry/Categories" /files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry/Categories = "Application;Mathematics" augtool> set "/files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry/Categories" "Application;X-Red-Hat-Base;Mathematics" augtool> print "/files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry/Categories" /files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry/Categories = "Application;X-Red-Hat-Base;Mathematics" augtool> save Saved 1 file(s)Once, I verified this worked, I added it to a puppet manifest file: augeas{"mathematica-desktop": lens => "Desktop.lns", incl => "/usr/share/applications/mathematica-10.0.desktop", context => "/files/usr/share/applications/mathematica-10.0.desktop/Desktop Entry", changes => [ 'set Icon "/usr/share/icons/wolfram-mathematica"', 'set Categories "Application;X-Red-Hat-Base;Mathematics"', ] }Resources: http://projects.puppetlabs.com/projects/1/wiki/puppet_augeas Last changed: Feb 27 2020 at 3:31 PM Back |
|||