diff --git a/lib/facter/iptables_persistent_version.rb b/lib/facter/iptables_persistent_version.rb index ff66f0d0d..c67659df6 100644 --- a/lib/facter/iptables_persistent_version.rb +++ b/lib/facter/iptables_persistent_version.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true Facter.add(:iptables_persistent_version) do - confine operatingsystem: ['Debian', 'Ubuntu'] + confine 'os.name': ['Debian', 'Ubuntu'] setcode do # Throw away STDERR because dpkg >= 1.16.7 will make some noise if the # package isn't currently installed. diff --git a/spec/unit/facter/iptables_persistent_version_spec.rb b/spec/unit/facter/iptables_persistent_version_spec.rb index 835137af0..471460b92 100644 --- a/spec/unit/facter/iptables_persistent_version_spec.rb +++ b/spec/unit/facter/iptables_persistent_version_spec.rb @@ -15,8 +15,8 @@ describe "#{os} package installed" do before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value).and_return(os) - allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release) + allow(Facter.fact(:'os.name')).to receive(:value).and_return(os) + allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release) allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil }) .and_return(ver) end @@ -27,8 +27,8 @@ describe 'Ubuntu package not installed' do before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu') - allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return('20.04') + allow(Facter.fact(:'os.name')).to receive(:value).and_return('Ubuntu') + allow(Facter.fact(:'os.release.full')).to receive(:value).and_return('20.04') allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil }) .and_return(nil) end @@ -38,7 +38,7 @@ describe 'CentOS not supported' do before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value) + allow(Facter.fact(:'os.name')).to receive(:value) .and_return('CentOS') end @@ -63,8 +63,8 @@ describe "#{os} package installed" do before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value).and_return(os) - allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release) + allow(Facter.fact(:'os.name')).to receive(:value).and_return(os) + allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release) allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil }) .and_return(ver) end @@ -76,8 +76,8 @@ describe 'Ubuntu package not installed' do os_release = '14.10' before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value).and_return('Ubuntu') - allow(Facter.fact(:operatingsystemrelease)).to receive(:value).and_return(os_release) + allow(Facter.fact(:'os.name')).to receive(:value).and_return('Ubuntu') + allow(Facter.fact(:'os.release.full')).to receive(:value).and_return(os_release) allow(Facter::Core::Execution).to receive(:execute).with(dpkg_cmd, { on_fail: nil }) .and_return(nil) end @@ -87,7 +87,7 @@ describe 'CentOS not supported' do before(:each) do - allow(Facter.fact(:operatingsystem)).to receive(:value) + allow(Facter.fact(:'os.name')).to receive(:value) .and_return('CentOS') end