Skip to content

Commit 625c58d

Browse files
Stop using legacy facts
1 parent e4b1a8e commit 625c58d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/puppet/type/yumrepo.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@
324324
newvalues(%r{.*}, :absent)
325325
validate do |value|
326326
next if %r{^(absent|_none_)$}.match?(value.to_s)
327-
next if value.to_s.empty? && Facter.value(:operatingsystemmajrelease).to_i >= 8
327+
next if value.to_s.empty? && Facter.value('os.distro.release.major').to_i >= 8
328328

329329
parsed = URI.parse(value)
330330
unless VALID_SCHEMES.include?(parsed.scheme)
@@ -333,7 +333,7 @@
333333
end
334334

335335
munge do |value|
336-
return '' if Facter.value(:operatingsystemmajrelease).to_i >= 8 && value.to_s == '_none_'
336+
return '' if Facter.value('os.distro.release.major').to_i >= 8 && value.to_s == '_none_'
337337
super(value)
338338
end
339339
end

spec/unit/type/yumrepo_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -327,13 +327,13 @@
327327
end
328328

329329
it "munges '_none_' to empty string for EL >= 8" do
330-
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('8')
330+
allow(Facter).to receive(:value).with('os.distro.release.major').and_return('8')
331331
instance = described_class.new(name: 'puppetlabs', proxy: '_none_')
332332
expect(instance[:proxy]).to eq ''
333333
end
334334

335335
it "does not munge '_none_' to empty string for EL < 8" do
336-
allow(Facter).to receive(:value).with(:operatingsystemmajrelease).and_return('7')
336+
allow(Facter).to receive(:value).with('os.distro.release.major').and_return('7')
337337
instance = described_class.new(name: 'puppetlabs', proxy: '_none_')
338338
expect(instance[:proxy]).to eq '_none_'
339339
end

0 commit comments

Comments
 (0)