Skip to content

Commit 41d216b

Browse files
committed
(CAT-2215) Update legacy facts
1 parent f1a8166 commit 41d216b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Diff for: lib/facter/iptables_persistent_version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
Facter.add(:iptables_persistent_version) do
4-
confine operatingsystem: ['Debian', 'Ubuntu']
4+
confine 'os.name': ['Debian', 'Ubuntu']
55
setcode do
66
# Throw away STDERR because dpkg >= 1.16.7 will make some noise if the
77
# package isn't currently installed.

Diff for: spec/unit/facter/iptables_persistent_version_spec.rb

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515

1616
describe "#{os} package installed" do
1717
before(:each) do
18-
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return(os)
19-
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release)
18+
allow(Facter.fact(:'os.name')).to receive(:value).and_return(os)
19+
allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release)
2020
allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil })
2121
.and_return(ver)
2222
end
@@ -27,8 +27,8 @@
2727

2828
describe 'Ubuntu package not installed' do
2929
before(:each) do
30-
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu')
31-
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('20.04')
30+
allow(Facter.fact(:'os.name')).to receive(:value).and_return('Ubuntu')
31+
allow(Facter.fact(:'os.release.full')).to receive(:value).and_return('20.04')
3232
allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil })
3333
.and_return(nil)
3434
end
@@ -38,7 +38,7 @@
3838

3939
describe 'CentOS not supported' do
4040
before(:each) do
41-
allow(Facter.fact(:operatingsystem)).to receive(:value)
41+
allow(Facter.fact(:'os.name')).to receive(:value)
4242
.and_return('CentOS')
4343
end
4444

@@ -63,8 +63,8 @@
6363

6464
describe "#{os} package installed" do
6565
before(:each) do
66-
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return(os)
67-
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release)
66+
allow(Facter.fact(:'os.name')).to receive(:value).and_return(os)
67+
allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release)
6868
allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil })
6969
.and_return(ver)
7070
end
@@ -76,8 +76,8 @@
7676
describe 'Ubuntu package not installed' do
7777
os_release = '14.10'
7878
before(:each) do
79-
allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu')
80-
allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release)
79+
allow(Facter.fact(:'os.name')).to receive(:value).and_return('Ubuntu')
80+
allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release)
8181
allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil })
8282
.and_return(nil)
8383
end
@@ -87,7 +87,7 @@
8787

8888
describe 'CentOS not supported' do
8989
before(:each) do
90-
allow(Facter.fact(:operatingsystem)).to receive(:value)
90+
allow(Facter.fact(:'os.name')).to receive(:value)
9191
.and_return('CentOS')
9292
end
9393

0 commit comments

Comments
 (0)