5381cb7b61
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.
23 строки
571 Б
Ruby
23 строки
571 Б
Ruby
begin
|
|
require 'facter/util/debian'
|
|
rescue LoadError
|
|
require "#{File.dirname(__FILE__)}/util/debian"
|
|
end
|
|
|
|
def debian_codename_to_next(codename)
|
|
if codename == "sid"
|
|
return "experimental"
|
|
else
|
|
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
|
|
|
|
Facter.add(:debian_nextcodename) do
|
|
confine :operatingsystem => 'Debian'
|
|
setcode do
|
|
debian_codename_to_next(Facter.value('debian_codename'))
|
|
end
|
|
end
|