summaryrefslogtreecommitdiff
path: root/puppet/modules/apt/lib/facter/ubuntu_nextcodename.rb
blob: dcd1d426942fa59743bc40203d1156c02a788a99 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
begin
  require 'facter/util/ubuntu'
rescue LoadError
  require "#{File.dirname(__FILE__)}/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