Skip to content

Commit

Permalink
Get rid of legacy facts
Browse files Browse the repository at this point in the history
  • Loading branch information
smortex committed Aug 13, 2024
1 parent eda9ab0 commit 43df1d3
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 54 deletions.
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_access/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_database/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_dbindex/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_global_conf/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_module/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_overlay/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/provider/openldap_schema/olc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
provide(:olc, parent: Puppet::Provider::Openldap) do
# TODO: Use ruby bindings (can't find one that support IPC)

defaultfor osfamily: %i[debian freebsd redhat suse]
defaultfor 'os.family' => %i[debian freebsd redhat suse]

mk_resource_methods

Expand Down
12 changes: 6 additions & 6 deletions lib/puppet/type/openldap_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,17 @@
desc 'The name of the backend.'
newvalues('bdb', 'hdb', 'mdb', 'monitor', 'config', 'relay', 'ldap')
defaultto do
case Facter.value(:osfamily)
case Facter.value('os.family')
when 'Debian'
case Facter.value(:operatingsystem)
case Facter.value('os.name')
when 'Debian'
if Facter.value(:operatingsystemmajrelease).to_i <= 7
if Facter.value('os.release.major').to_i <= 7
'hdb'
else
'mdb'
end
when 'Ubuntu'
if Facter.value(:operatingsystemmajrelease).to_i <= 15
if Facter.value('os.release.major').to_i <= 15
'hdb'
else
'mdb'
Expand All @@ -48,9 +48,9 @@
'hdb'
end
when 'RedHat'
if Facter.value(:operatingsystemmajrelease).to_i <= 6
if Facter.value('os.release.major') <= 6
'bdb'
elsif Facter.value(:os).dig('release', 'major').to_i >= 9
elsif Facter.value('os.release.major') >= 9
'mdb'
else
'hdb'
Expand Down
66 changes: 33 additions & 33 deletions spec/classes/openldap_client_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -51,7 +51,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -74,7 +74,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -97,7 +97,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -120,7 +120,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -143,7 +143,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -166,7 +166,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -189,7 +189,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -212,7 +212,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -235,7 +235,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -258,7 +258,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -281,7 +281,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -304,7 +304,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -327,7 +327,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -350,7 +350,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -373,7 +373,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -396,7 +396,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -419,7 +419,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -442,7 +442,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -465,7 +465,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with({
Expand All @@ -492,7 +492,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -515,7 +515,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -538,7 +538,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -561,7 +561,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -583,7 +583,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('openldap::client::config') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -606,7 +606,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -629,7 +629,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -652,7 +652,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -675,7 +675,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -698,7 +698,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand Down Expand Up @@ -727,7 +727,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand Down Expand Up @@ -762,7 +762,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand All @@ -789,7 +789,7 @@
it { is_expected.to contain_class('openldap::client::config') }
it { is_expected.to contain_augeas('ldap.conf') }

case facts[:osfamily]
case facts[:os]['family']
when 'Debian'
it {
is_expected.to contain_augeas('ldap.conf').with(incl: '/etc/ldap/ldap.conf',
Expand Down
Loading

0 comments on commit 43df1d3

Please sign in to comment.