voxpupuli / puppet-augeasproviders_grub

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

Confine GRUB providers to presence of menus, prefer GRUB 2 #1

Closed domcleal closed 8 years ago

domcleal commented 10 years ago

On a GRUB 2 system, the GRUB 1 provider will always match as it's only confined on the presence of Augeas and so the behaviour is often random, it might choose the older provider:

Warning: Found multiple default providers for kernel_parameter: grub,
grub2; using grub

Since we'll never create GRUB configurations from scratch, it makes sense to confine these providers to their files, and prefer GRUB 2 over GRUB 1.

coveralls commented 10 years ago

Coverage Status

Coverage remained the same when pulling fe07f5f7cfb8b8a8294818ede4d803576740b916 on domcleal:confine into a40c2dffec38d4b9b96c1bee55f6d80bfb9ab246 on hercules-team:master.

raphink commented 10 years ago

This PR fails with Puppet 3.4+, saying the grub provider is not functional.

domcleal commented 10 years ago

Yeah, I haven't had chance to revisit, I think the file existence tests are broken.

raphink commented 9 years ago

OK.

genebean commented 9 years ago

I am working on some CentOS 7.0 and RHEL 7.0 systems and am getting the Found multiple default providers for kernel_parameter warning. Is there a fix for this in the works or should I start hunting around in the code to try and fix it?

domcleal commented 9 years ago

I'm pretty sure this fixes it, but I haven't got the tests fixed to merge it - sorry.

m4ce commented 9 years ago

Hi,

I actually created a custom fact called 'grubversion' and then I just use that in the grub/grub2 provider to confine:

Facter.add(:grubversion) do
  if File.exists?("/boot/grub")
    version = 1
  elsif File.exists?("/boot/grub2")
    version = 2
  else
    fail("Failed to evaluate grub version")
  end

  setcode { version }
end

grub legacy provider:

confine :grubversion => 1

grub2 provider:

confine :grubversion => 2

I quite like this as I can also re-use the grubversion fact in my manifests etc.

Cheers, Matteo