summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2015-12-07 16:51:20 +0100
committervarac <varacanero@zeromail.org>2015-12-07 19:43:31 +0100
commit5381cb7b617a78b75b593a21fe9e0e8356013f6a (patch)
tree6349dd35adf7a2254c60ca42e79099bb6a74842c /lib
parentbf4daa73b11fe7d7db49a6f863d8e850288c57e8 (diff)
[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.
Diffstat (limited to 'lib')
-rw-r--r--lib/facter/debian_nextcodename.rb9
-rw-r--r--lib/facter/util/ubuntu.rb1
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