voxpupuli / puppet-augeasproviders_grub

Augeas-based grub type and providers
Apache License 2.0
9 stars 33 forks source link

Modify `GRUB_CMDLINE_LINUX` and `GRUB_CMDLINE_LINUX_DEFAULT` #23

Open w3ttr3y opened 8 years ago

w3ttr3y commented 8 years ago

If I want to clear a setting (e.g. selinux=0), then I can clear it from GRUB_CMDLINE_LINUX or GRUB_CMDLINE_LINUX_DEFAULT but not both:

Clears GRUB_CMDLINE_LINUX but not GRUB_CMDLINE_LINUX_DEFAULT

    kernel_parameter{'selinux':
      ensure   => absent,
      provider => 'grub2',
      bootmode => 'normal',
    } 

Also clears GRUB_CMDLINE_LINUX but not GRUB_CMDLINE_LINUX_DEFAULT

    kernel_parameter{'selinux':
      ensure   => absent,
      provider => 'grub2',
      bootmode => 'all',
    } 

While this will clear GRUB_CMDLINE_LINUX_DEFAULT

kernel_parameter{'selinux-default':
      name     => 'selinux',
      ensure   => absent,
      provider => 'grub2',
      bootmode => 'default'
    }

You can't combine it with either of the above:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Puppet::Parser::AST::Resource failed with error ArgumentError: Cannot alias Kernel_parameter[selinux-default] to ["selinux"] at test.pp:55; resource ["Kernel_parameter", "selinux"] already declared at test.pp:49 at test.pp:55 on node test.example.com

Thus there doesn't appear to be a way to clear both GRUB_CMDLINE_LINUX and GRUB_CMDLINE_LINUX_DEFAULT

raphink commented 8 years ago

It seems like what you want is to manage the same kernel parameter in different boot modes.

What is missing for that is to make bootmode a namevar of the type, and set up composite namevar for it.