diff --git a/lib/facter/yum_reboot_required.rb b/lib/facter/yum_reboot_required.rb index 198f99d3..724d8f01 100644 --- a/lib/facter/yum_reboot_required.rb +++ b/lib/facter/yum_reboot_required.rb @@ -3,7 +3,7 @@ require 'English' Facter.add(:yum_reboot_required) do - confine osfamily: 'RedHat' + confine 'os.family': 'RedHat' setcode do if File.exist?('/usr/bin/needs-restarting') Facter::Core::Execution.execute('/usr/bin/needs-restarting --reboothint') diff --git a/lib/facter/yum_updates.rb b/lib/facter/yum_updates.rb index 565f3329..9b12257e 100644 --- a/lib/facter/yum_updates.rb +++ b/lib/facter/yum_updates.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true Facter.add('yum_package_updates') do - confine osfamily: 'RedHat' + confine 'os.family': 'RedHat' setcode do yum_updates = [] @@ -18,14 +18,14 @@ end Facter.add('yum_has_updates') do - confine osfamily: 'RedHat' + confine 'os.family': 'RedHat' setcode do Facter.value(:yum_package_updates).any? end end Facter.add('yum_updates') do - confine osfamily: 'RedHat' + confine 'os.family': 'RedHat' setcode do Facter.value(:yum_package_updates).length end diff --git a/spec/unit/facter/yum_package_updates_spec.rb b/spec/unit/facter/yum_package_updates_spec.rb index e95a2e92..ada055a9 100644 --- a/spec/unit/facter/yum_package_updates_spec.rb +++ b/spec/unit/facter/yum_package_updates_spec.rb @@ -9,7 +9,7 @@ describe 'on non-Redhat distro' do before do - allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Debian') + allow(Facter.fact('os.family')).to receive(:value).and_return('Debian') end it { is_expected.to be_nil } @@ -17,7 +17,7 @@ describe 'on Redhat distro' do before do - allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Redhat') + allow(Facter.fact('os.family')).to receive(:value).and_return('Redhat') allow(File).to receive(:executable?) # Stub all other calls allow(File).to receive(:executable?).with('/usr/bin/yum').and_return(true) allow(Facter::Util::Resolution).to receive(:exec).with('/usr/bin/yum --assumeyes --quiet --cacheonly list updates').and_return(yum_list_updates_result)