summaryrefslogtreecommitdiff
path: root/lib/facter/ubuntu_nextcodename.rb
blob: 38b64ade938148d08abfb975223a0ef8929ecf3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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