module-apt/lib/facter/ubuntu_nextcodename.rb
Jerome Charaoui d007a40333 Replace debian_*() parser functions with facts
* Removes dependency on lsb-release and/or Facter >1.7
    (values are based on $::lsbdistcodename, when available)
* Simplifies maintenance: only lib/facter/util/* require updates as new
  releases are made

Caveats:
* apt::codename is removed; to override debian_* facts, set the
  FACTER_debian_codename environment variable for puppet
* If tracking unstable, make sure lsb-release is installed, as other
  methods can't tell between testing and unstable
2015-05-11 12:01:35 -04:00

18 lines
387 B
Ruby

begin
require 'facter/util/ubuntu'
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