Skip to content

Commit

Permalink
switch from legacy to structured facts
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Sep 18, 2024
1 parent 88b4e9c commit d877511
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/puppet/provider/alternative_entry/chkconfig.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

Puppet::Type.type(:alternative_entry).provide(:chkconfig) do
confine osfamily: :redhat
defaultfor osfamily: :redhat
confine 'os.family' => :redhat
defaultfor 'os.family' => :redhat

commands update: '/usr/sbin/alternatives'

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/alternative_entry/dpkg.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

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

commands update: 'update-alternatives'

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/alternatives/chkconfig.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

Puppet::Type.type(:alternatives).provide(:chkconfig) do
confine osfamily: :redhat
defaultfor osfamily: :redhat
confine 'os.family' => :redhat
defaultfor 'os.family' => :redhat

commands update: 'alternatives'

Expand Down
4 changes: 2 additions & 2 deletions lib/puppet/provider/alternatives/dpkg.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

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

has_feature :mode
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/type/alternatives.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def insync?(is)
end

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

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/type/alternatives_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
describe 'property `path`' do
context 'on Debian systems' do
before do
Facter.stubs(:value).with(:osfamily).returns('Debian')
Facter.stubs(:value).with('os.family').returns('Debian')
end

it 'passes validation with an absolute path' do
Expand All @@ -20,7 +20,7 @@

context 'on RedHat systems' do
before do
Facter.stubs(:value).with(:osfamily).returns('RedHat')
Facter.stubs(:value).with('os.family').returns('RedHat')
end

it 'passes validation with an absolute path' do
Expand Down

0 comments on commit d877511

Please sign in to comment.