Skip to content

Commit 59f2741

Browse files
authored
Merge pull request #70 from tvpartytonight/PA-5966
Stop using legacy facts
2 parents 429eecf + e5d808a commit 59f2741

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/puppet/provider/cron/crontab.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
text_line :environment, match: %r{^\s*\w+\s*=}
1414

1515
def self.filetype
16-
tabname = case Facter.value(:osfamily)
16+
tabname = case Facter.value('os.family')
1717
when 'Solaris'
1818
:suntab
1919
when 'AIX'
@@ -261,7 +261,7 @@ def user
261261
@property_hash[:user] || @property_hash[:target]
262262
end
263263

264-
CRONTAB_DIR = case Facter.value('osfamily')
264+
CRONTAB_DIR = case Facter.value('os.family')
265265
when 'Debian', 'HP-UX', 'Solaris'
266266
'/var/spool/cron/crontabs'
267267
when %r{BSD}

lib/puppet/provider/cron/filetype.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def read
6767
# Remove a specific @path's cron tab.
6868
def remove
6969
cmd = "#{cmdbase} -r"
70-
if ['Darwin', 'FreeBSD', 'DragonFly'].include?(Facter.value('operatingsystem'))
70+
if ['Darwin', 'FreeBSD', 'DragonFly'].include?(Facter.value('os.name'))
7171
cmd = "/bin/echo yes | #{cmd}"
7272
end
7373

@@ -96,7 +96,7 @@ def write(text)
9696
# Only add the -u flag when the @path is different. Fedora apparently
9797
# does not think I should be allowed to set the @path to my own user name
9898
def cmdbase
99-
return 'crontab' if @uid == Puppet::Util::SUIDManager.uid || Facter.value(:operatingsystem) == 'HP-UX'
99+
return 'crontab' if @uid == Puppet::Util::SUIDManager.uid || Facter.value('os.name') == 'HP-UX'
100100

101101
"crontab -u #{@path}"
102102
end

spec/unit/provider/cron/parsed_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@
6363

6464
describe 'when determining the correct filetype' do
6565
it 'uses the suntab filetype on Solaris' do
66-
allow(Facter).to receive(:value).with(:osfamily).and_return 'Solaris'
66+
allow(Facter).to receive(:value).with('os.family').and_return 'Solaris'
6767
expect(described_class.filetype).to eq(Puppet::Provider::Cron::FileType::FileTypeSuntab)
6868
end
6969

7070
it 'uses the aixtab filetype on AIX' do
71-
allow(Facter).to receive(:value).with(:osfamily).and_return 'AIX'
71+
allow(Facter).to receive(:value).with('os.family').and_return 'AIX'
7272
expect(described_class.filetype).to eq(Puppet::Provider::Cron::FileType::FileTypeAixtab)
7373
end
7474

7575
it 'uses the crontab filetype on other platforms' do
76-
allow(Facter).to receive(:value).with(:osfamily).and_return 'Not a real operating system family'
76+
allow(Facter).to receive(:value).with('os.family').and_return 'Not a real operating system family'
7777
expect(described_class.filetype).to eq(Puppet::Provider::Cron::FileType::FileTypeCrontab)
7878
end
7979
end
@@ -187,8 +187,8 @@
187187

188188
describe 'on linux' do
189189
before(:each) do
190-
allow(Facter).to receive(:value).with(:osfamily).and_return 'Linux'
191-
allow(Facter).to receive(:value).with(:operatingsystem)
190+
allow(Facter).to receive(:value).with('os.family').and_return 'Linux'
191+
allow(Facter).to receive(:value).with('os.name')
192192
end
193193

194194
it 'contains no resources for a user who has no crontab' do

0 commit comments

Comments
 (0)