Skip to content

Commit ee0c524

Browse files
authored
Merge pull request #159 from bastelfreak/facts
switch from legacy to structured facts
2 parents 88b4e9c + d877511 commit ee0c524

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

lib/puppet/provider/alternative_entry/chkconfig.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
Puppet::Type.type(:alternative_entry).provide(:chkconfig) do
4-
confine osfamily: :redhat
5-
defaultfor osfamily: :redhat
4+
confine 'os.family' => :redhat
5+
defaultfor 'os.family' => :redhat
66

77
commands update: '/usr/sbin/alternatives'
88

lib/puppet/provider/alternative_entry/dpkg.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
Puppet::Type.type(:alternative_entry).provide(:dpkg) do
4-
confine osfamily: %i[debian suse]
5-
defaultfor [operatingsystem: %i[debian ubuntu], osfamily: :suse]
4+
confine 'os.family' => %i[debian suse]
5+
defaultfor ['os.name' => %i[debian ubuntu], 'os.family' => :suse]
66

77
commands update: 'update-alternatives'
88

lib/puppet/provider/alternatives/chkconfig.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
Puppet::Type.type(:alternatives).provide(:chkconfig) do
4-
confine osfamily: :redhat
5-
defaultfor osfamily: :redhat
4+
confine 'os.family' => :redhat
5+
defaultfor 'os.family' => :redhat
66

77
commands update: 'alternatives'
88

lib/puppet/provider/alternatives/dpkg.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# frozen_string_literal: true
22

33
Puppet::Type.type(:alternatives).provide(:dpkg) do
4-
confine osfamily: %i[debian suse]
5-
defaultfor [operatingsystem: %i[debian ubuntu], osfamily: :suse]
4+
confine 'os.family' => %i[debian suse]
5+
defaultfor ['os.name' => %i[debian ubuntu], 'os.family' => :suse]
66
commands update: 'update-alternatives'
77

88
has_feature :mode

lib/puppet/type/alternatives.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def insync?(is)
1919
end
2020

2121
validate do |path|
22-
raise ArgumentError, 'path must be a fully qualified path' unless (absolute_path? path) || (Facter.value(:osfamily) == 'RedHat')
22+
raise ArgumentError, 'path must be a fully qualified path' unless (absolute_path? path) || (Facter.value('os.family') == 'RedHat')
2323
end
2424
end
2525

spec/unit/type/alternatives_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
describe 'property `path`' do
77
context 'on Debian systems' do
88
before do
9-
Facter.stubs(:value).with(:osfamily).returns('Debian')
9+
Facter.stubs(:value).with('os.family').returns('Debian')
1010
end
1111

1212
it 'passes validation with an absolute path' do
@@ -20,7 +20,7 @@
2020

2121
context 'on RedHat systems' do
2222
before do
23-
Facter.stubs(:value).with(:osfamily).returns('RedHat')
23+
Facter.stubs(:value).with('os.family').returns('RedHat')
2424
end
2525

2626
it 'passes validation with an absolute path' do

0 commit comments

Comments
 (0)