[augeas-devel] grub lens doesn't match /boot/grub/grub.conf

Nathan Huff Nathan.Huff at ndsu.edu
Tue Jan 10 15:51:08 UTC 2012


On 01/10/2012 09:39 AM, Greg Swift wrote:
>
>
> On Tue, Jan 10, 2012 at 09:32, Nathan Huff <Nathan.Huff at ndsu.edu
> <mailto:Nathan.Huff at ndsu.edu>> wrote:
>
>     On 01/09/2012 06:17 PM, David Lutterkort wrote:
>
>         On Fri, 2011-12-30 at 13:46 -0600, Nathan Huff wrote:
>
>             Since that is the actual file that RedHat uses I think it
>             should.  I
>             believe the one line change below would fix it.
>
>             diff -ur augeas-0.10.0.orig/lenses/__grub.aug
>             augeas-0.10.0/lenses/grub.aug
>             --- augeas-0.10.0.orig/lenses/__grub.aug  2011-11-28
>             17:51:05.000000000 -0600
>             +++ augeas-0.10.0/lenses/grub.aug       2011-12-30
>             13:27:13.651145502 -0600
>             @@ -276,5 +276,6 @@
>                    (* View: filter *)
>                    let filter = incl "/boot/grub/menu.lst"
>                               . incl "/etc/grub.conf"
>             +               . incl "/boot/grub/grub.conf"
>
>
>         We have /etc/grub.conf in there; that should be a symlink
>         to /boot/grub/grub.conf. Does that not work for you ?
>
>         (I hesitate to make that change because we'll have the same file
>         show up
>         twice in the tree, opening the door to all kinds of interesting
>         conflicts)
>
>         David
>
>
>
>
>     The problem that I am running into is actually a combination of
>     augeas and puppet.  The way puppet seems to work with augeas is that
>     it runs the augeas commands against the existing file and creates a
>     copy.  It then checks if the copy and the original are the same if
>     they are it removes the copy and does nothing.  If they aren't it
>     replaces the original with the copy.  In the /etc/grub.conf case
>     this causes the symlink to be replaced by a regular file.  Obviously
>     this is a problem because grub doesn't actually look at /etc/grub.conf.
>
>     I can work around this by telling puppet explicitly which lens to
>     use. I just thought it was weird that the lens matches several files
>     non of which grub actually reads directly on at least RedHat and I
>     assume any other recent linux distro.
>
>
> Nathan,
>
> Very timely, I'm about to attempt to control grub with puppet+augeas on
> RHEL systems.  can you post your final that deals with this issue please?
>
> thanks

You have to set the incl and lens parameters rather than the context 
parameter.  See below for an example.

   #
   # remove "rhgb" and "quiet" from every kernel title line, if present
   #
   augeas { 'grub.conf/no_rhgb':
     incl    => '/boot/grub/grub.conf',
     lens    => 'grub.lns',
     changes => [
       'rm title[*]/kernel/rhgb',
       'rm title[*]/kernel/quiet'
     ],
   }

-- 
Nathan Huff                               Nathan.Huff at ndsu.edu
Enterprise Computing and Infrastructure   (701) 231-6145
Room 242 J2, IACC Building
North Dakota State University, Fargo, ND 58105-5164




More information about the augeas-devel mailing list