module-apt/lib/facter/ubuntu_nextcodename.rb
varac a70c52c1d4 Fix loading of util/debian.rb for custom facts
requirering the facter/util/debian.rb module causes
puppet warnings on wheezy hosts, and custom facts like
`$::debian_codename` cannot be evaluated.

    warning: Could not load fact file
      /srv/dev/projects/puppet/shared-modules//apt/lib/facter/debian_nextcodename.rb:
      no such file to load -- facter/util/debian

Removing the require line solves this.
2015-12-07 14:27:04 +01:00

20 lines
454 B
Ruby

begin
require 'facter/util/ubuntu'
rescue LoadError
require "#{File.dirname(__FILE__)}/util/debian"
end
def ubuntu_codename_to_next(codename)
codenames = Facter::Util::Ubuntu::CODENAMES
i = codenames.index(codename)
if i and i+1 < codenames.count
return codenames[i+1]
end
end
Facter.add(:ubuntu_nextcodename) do
confine :operatingsystem => 'Ubuntu'
setcode do
ubuntu_codename_to_next(Facter.value('ubuntu_codename'))
end
end