[bug] Fix debian_nextcodename on wheezy hosts

I noticed this behaviour because $::debian_nextcodename was
"squeeze" on a wheezy host.
For debugging, i inserted a "puts codenames" in
lib/facter/debian_nextcodename.rb, and it turned out that it
was sorted differently on wheezy and jessie hosts:

On wheezy:

    buster
    stretch
    jessie
    wheezy
    squeeze
    lenny

On jessie:

    lenny
    squeeze
    wheezy
    jessie
    stretch
    buster

So i decided to rewrite this so this doesn't happen again.
This commit is contained in:
varac 2015-12-07 16:51:20 +01:00
parent bf4daa73b1
commit 5381cb7b61
2 changed files with 5 additions and 5 deletions

View file

@ -8,11 +8,10 @@ def debian_codename_to_next(codename)
if codename == "sid"
return "experimental"
else
codenames = Facter::Util::Debian::CODENAMES.values
i = codenames.index(codename)
if i and i+1 < codenames.count
return codenames[i+1]
end
codenames = Facter::Util::Debian::CODENAMES
versions = Facter::Util::Debian::CODENAMES.invert
current_version = versions[codename]
return codenames[(current_version.to_i + 1).to_s]
end
end

View file

@ -14,6 +14,7 @@ module Facter
"utopic",
"vivid",
"wily",
"xenial"
]
end
end