From 7ea6587b439a027106eab8c420beb650d2246972 Mon Sep 17 00:00:00 2001 From: brajjan Date: Thu, 7 Nov 2024 10:58:51 +0100 Subject: [PATCH] make sure facts for windows server 2025 is discovered as 2025 --- lib/facter/util/facts/windows_release_finder.rb | 8 +++++--- spec/facter/util/facts/windows_release_finder_spec.rb | 11 +++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/lib/facter/util/facts/windows_release_finder.rb b/lib/facter/util/facts/windows_release_finder.rb index de285fde6b..41e596a836 100644 --- a/lib/facter/util/facts/windows_release_finder.rb +++ b/lib/facter/util/facts/windows_release_finder.rb @@ -25,10 +25,12 @@ def find_release(input) def check_version_10_11(consumerrel, kernel_version) build_number = kernel_version[/([^.]*)$/].to_i - return '11' if build_number >= 22_000 - return '10' if consumerrel + return '11' if consumerrel && build_number >= 22_000 + return '10' if consumerrel && build_number >= 20_348 - if build_number >= 20_348 + if build_number >= 26_100 + '2025' + elsif build_number >= 20_348 '2022' elsif build_number >= 17_623 '2019' diff --git a/spec/facter/util/facts/windows_release_finder_spec.rb b/spec/facter/util/facts/windows_release_finder_spec.rb index a6a81d4d22..4740bcde08 100644 --- a/spec/facter/util/facts/windows_release_finder_spec.rb +++ b/spec/facter/util/facts/windows_release_finder_spec.rb @@ -36,6 +36,17 @@ end end + describe '#find windows release when version is 2025' do + let(:cons) { false } + let(:desc) {} + let(:k_version) { '10.0.26100' } + let(:version) { '10.0' } + + it 'returns 2025' do + expect(Facter::Util::Facts::WindowsReleaseFinder.find_release(input)).to eql('2025') + end + end + describe '#find windows release when version is 2022' do let(:cons) { false } let(:desc) {}