Skip to content

Commit a2a872d

Browse files
committed
(CAT-2134) Removing legacy facts
1 parent 5e34dcb commit a2a872d

18 files changed

+27
-27
lines changed

hiera.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ defaults: # Used for any hierarchy level that omits these keys.
66
data_hash: yaml_data # Use the built-in YAML backend.
77

88
hierarchy:
9-
- name: "osfamily/major release"
9+
- name: "os.family/major release"
1010
paths:
1111
# Used to distinguish between Debian and Ubuntu
1212
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
1313
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
1414
# Used for Solaris
1515
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml"
16-
- name: "osfamily"
16+
- name: "os.family"
1717
paths:
1818
- "os/%{facts.os.name}.yaml"
1919
- "os/%{facts.os.family}.yaml"

lib/facter/apt_reboot_required.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# apt_reboot_required.rb
44
Facter.add(:apt_reboot_required) do
5-
confine osfamily: 'Debian'
5+
confine 'os.family': 'Debian'
66
setcode do
77
File.file?('/var/run/reboot-required')
88
end

lib/facter/apt_sources.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# This fact lists the .list filenames that are used by apt.
44
Facter.add(:apt_sources) do
5-
confine osfamily: 'Debian'
5+
confine 'os.family': 'Debian'
66
setcode do
77
sources = ['sources.list']
88
Dir.glob('/etc/apt/sources.list.d/*.{list,sources}').each do |file|

lib/facter/apt_update_last_success.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# This is generated upon a successful apt-get update run natively in ubuntu.
77
# the Puppetlabs-apt module deploys this same functionality for other debian-ish OSes
88
Facter.add('apt_update_last_success') do
9-
confine osfamily: 'Debian'
9+
confine 'os.family': 'Debian'
1010
setcode do
1111
if File.exist?('/var/lib/apt/periodic/update-success-stamp')
1212
# get epoch time

lib/facter/apt_updates.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ def get_updates(upgrade_option)
3131
end
3232

3333
Facter.add('apt_has_updates') do
34-
confine osfamily: 'Debian'
34+
confine 'os.family': 'Debian'
3535
setcode do
3636
apt_package_updates = get_updates('upgrade')
3737
apt_package_updates != [[], []] if !apt_package_updates.nil? && apt_package_updates.length == 2
3838
end
3939
end
4040

4141
Facter.add('apt_has_dist_updates') do
42-
confine osfamily: 'Debian'
42+
confine 'os.family': 'Debian'
4343
setcode do
4444
apt_dist_updates = get_updates('dist-upgrade')
4545
apt_dist_updates != [[], []] if !apt_dist_updates.nil? && apt_dist_updates.length == 2

lib/puppet/provider/apt_key/apt_key.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
Puppet::Type.type(:apt_key).provide(:apt_key) do
1212
desc 'apt-key provider for apt_key resource'
1313

14-
confine osfamily: :debian
15-
defaultfor osfamily: :debian
14+
confine 'os.family': :debian
15+
defaultfor 'os.family': :debian
1616
commands apt_key: 'apt-key'
1717
commands gpg: '/usr/bin/gpg'
1818

spec/unit/facter/apt_dist_has_updates_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
describe 'on non-Debian distro' do
1111
before(:each) do
12-
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Redhat')
12+
allow(Facter.fact(:'os.family')).to receive(:value).once.and_return('Redhat')
1313
end
1414

1515
it { is_expected.to be_nil }
1616
end
1717

1818
describe 'on Debian based distro missing apt-get' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).once.and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(false)
2323
end
@@ -27,7 +27,7 @@
2727

2828
describe 'on Debian based distro' do
2929
before(:each) do
30-
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Debian')
30+
allow(Facter.fact(:'os.family')).to receive(:value).once.and_return('Debian')
3131
allow(File).to receive(:executable?) # Stub all other calls
3232
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
3333
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_dist_package_security_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_dist_package_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_dist_security_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has security updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_dist_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_has_updates_spec.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
describe 'on non-Debian distro' do
1111
before(:each) do
12-
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Redhat')
12+
allow(Facter.fact(:'os.family')).to receive(:value).once.and_return('Redhat')
1313
end
1414

1515
it { is_expected.to be_nil }
1616
end
1717

1818
describe 'on Debian based distro missing apt-get' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).once.and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).once.and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(false)
2323
end
@@ -27,7 +27,7 @@
2727

2828
describe 'on Debian based distro' do
2929
before(:each) do
30-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
30+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
3131
allow(File).to receive(:executable?) # Stub all other calls
3232
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
3333
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_package_security_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_package_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_reboot_required_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
describe 'if a reboot is required' do
1111
before(:each) do
12-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
12+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
1313
allow(File).to receive(:file?).and_return(true)
1414
allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(true)
1515
end
@@ -19,7 +19,7 @@
1919

2020
describe 'if a reboot is not required' do
2121
before(:each) do
22-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
22+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2323
allow(File).to receive(:file?).and_return(true)
2424
allow(File).to receive(:file?).once.with('/var/run/reboot-required').and_return(false)
2525
end

spec/unit/facter/apt_security_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has security updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

spec/unit/facter/apt_update_last_success_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99

1010
describe 'on Debian based distro which has not yet created the update-success-stamp file' do
1111
it 'has a value of -1' do
12-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
12+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
1313
allow(File).to receive(:exist?).with('/var/lib/apt/periodic/update-success-stamp').and_return(false)
1414
expect(subject).to eq(-1)
1515
end
1616
end
1717

1818
describe 'on Debian based distro which has created the update-success-stamp' do
1919
it 'has the value of the mtime of the file' do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:exist?).and_return(true)
2222
allow(File).to receive(:mtime).and_return(1_407_660_561)
2323
expect(subject).to eq(1_407_660_561)

spec/unit/facter/apt_updates_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
describe 'when apt has updates' do
1919
before(:each) do
20-
allow(Facter.fact(:osfamily)).to receive(:value).and_return('Debian')
20+
allow(Facter.fact(:'os.family')).to receive(:value).and_return('Debian')
2121
allow(File).to receive(:executable?) # Stub all other calls
2222
allow(Facter::Core::Execution).to receive(:execute) # Catch all other calls
2323
allow(File).to receive(:executable?).with('/usr/bin/apt-get').and_return(true)

0 commit comments

Comments
 (0)