Skip to content

Commit 22ed5fb

Browse files
authored
Merge pull request #80 from tvpartytonight/PA-5966
Stop using legacy facts
2 parents 9285277 + 64a8e23 commit 22ed5fb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/puppet/provider/sshkey/parsed.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ def title
3333
end
3434

3535
def self.default_target
36-
case Facter.value(:operatingsystem)
36+
case Facter.value('os.name')
3737
when 'Darwin'
3838
# Versions 10.11 and up use /etc/ssh/ssh_known_hosts
39-
version = Facter.value(:macosx_productversion_major)
39+
version = Facter.value('os.macosx.version.major')
4040
if version
4141
if Puppet::Util::Package.versioncmp(version, '10.11') >= 0
4242
'/etc/ssh/ssh_known_hosts'

spec/unit/provider/sshkey/parsed_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,22 @@ def key
7272
context 'default ssh_known_hosts target path' do
7373
['9.10', '9.11', '10.10'].each do |version|
7474
it 'is `/etc/ssh_known_hosts` when OSX version 10.10 or older`' do
75-
expect(Facter).to receive(:value).with(:operatingsystem).and_return('Darwin')
76-
expect(Facter).to receive(:value).with(:macosx_productversion_major).and_return(version)
75+
expect(Facter).to receive(:value).with('os.name').and_return('Darwin')
76+
expect(Facter).to receive(:value).with('os.macosx.version.major').and_return(version)
7777
expect(subject.default_target).to eq('/etc/ssh_known_hosts')
7878
end
7979
end
8080

8181
['10.11', '10.13', '11.0', '11.11'].each do |version|
8282
it 'is `/etc/ssh/ssh_known_hosts` when OSX version 10.11 or newer`' do
83-
expect(Facter).to receive(:value).with(:operatingsystem).and_return('Darwin')
84-
expect(Facter).to receive(:value).with(:macosx_productversion_major).and_return(version)
83+
expect(Facter).to receive(:value).with('os.name').and_return('Darwin')
84+
expect(Facter).to receive(:value).with('os.macosx.version.major').and_return(version)
8585
expect(subject.default_target).to eq('/etc/ssh/ssh_known_hosts')
8686
end
8787
end
8888

8989
it 'is `/etc/ssh/ssh_known_hosts` on other operating systems' do
90-
expect(Facter).to receive(:value).with(:operatingsystem).and_return('RedHat')
90+
expect(Facter).to receive(:value).with('os.name').and_return('RedHat')
9191
expect(subject.default_target).to eq('/etc/ssh/ssh_known_hosts')
9292
end
9393
end

0 commit comments

Comments
 (0)