From 5381cb7b617a78b75b593a21fe9e0e8356013f6a Mon Sep 17 00:00:00 2001 From: varac Date: Mon, 7 Dec 2015 16:51:20 +0100 Subject: [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. --- lib/facter/debian_nextcodename.rb | 9 ++++----- lib/facter/util/ubuntu.rb | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/facter/debian_nextcodename.rb b/lib/facter/debian_nextcodename.rb index 6e994a4..c4c569b 100644 --- a/lib/facter/debian_nextcodename.rb +++ b/lib/facter/debian_nextcodename.rb @@ -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 diff --git a/lib/facter/util/ubuntu.rb b/lib/facter/util/ubuntu.rb index 1b2411a..52c15e8 100644 --- a/lib/facter/util/ubuntu.rb +++ b/lib/facter/util/ubuntu.rb @@ -14,6 +14,7 @@ module Facter "utopic", "vivid", "wily", + "xenial" ] end end -- cgit v1.2.3