Skip to content

Commit

Permalink
facterdb_string_keys: switch to strings
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jun 25, 2024
1 parent 16e351e commit 8411b8c
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
spec/spec_helper.rb:
hiera_config: "'spec/fixtures/hiera.yaml'"
facterdb_string_keys: true
spec/spec_helper_acceptance.rb:
unmanaged: false
2 changes: 1 addition & 1 deletion spec/classes/ca_cert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'ca_cert' do
on_supported_os.each do |os, os_facts|
case os_facts[:os]['family']
case os_facts['os']['family']
when 'Debian'
trusted_cert_dir = '/usr/local/share/ca-certificates'
update_cmd = 'update-ca-certificates'
Expand Down
10 changes: 5 additions & 5 deletions spec/defines/ca_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

on_supported_os.sort.each do |os, os_facts|
# define os specific defaults
case os_facts[:os]['family']
case os_facts['os']['family']
when 'Debian'
trusted_cert_dir = '/usr/local/share/ca-certificates'
when 'RedHat'
trusted_cert_dir = '/etc/pki/ca-trust/source/anchors'
distrusted_cert_dir = if os_facts[:os]['release']['major'] < '9'
distrusted_cert_dir = if os_facts['os']['release']['major'] < '9'
'/etc/pki/ca-trust/source/blacklist'
else
'/etc/pki/ca-trust/source/blocklist'
Expand Down Expand Up @@ -101,7 +101,7 @@

it { is_expected.not_to contain_archive("#{distrusted_cert_dir}/#{title}.#{ca_file_extension}") }

case os_facts[:os]['family']
case os_facts['os']['family']
when 'Debian'
it { is_expected.to contain_exec("trust ca #{title}.#{ca_file_extension}") }
it { is_expected.not_to contain_file("#{distrusted_cert_dir}/#{title}.#{ca_file_extension}") }
Expand All @@ -122,7 +122,7 @@
context 'with ensure set to "distrusted" and no source or content' do
let(:params) { { ensure: 'distrusted' } }

case os_facts[:os]['family']
case os_facts['os']['family']
when 'Debian'
it { is_expected.to contain_exec("distrust ca #{title}.#{ca_file_extension}") }
it { is_expected.not_to contain_archive("#{distrusted_cert_dir}/#{title}.#{ca_file_extension}") }
Expand All @@ -135,7 +135,7 @@
context 'with ensure set to "distrusted" and valid source' do
let(:params) { { ensure: 'distrusted', source: 'puppet:///testing.crt' } }

case os_facts[:os]['family']
case os_facts['os']['family']
when 'Debian'
it { is_expected.to contain_exec("distrust ca #{title}.#{ca_file_extension}") }
it { is_expected.not_to contain_archive("#{distrusted_cert_dir}/#{title}.#{ca_file_extension}") }
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
require 'voxpupuli/test/spec_helper'

RSpec.configure do |c|
c.facterdb_string_keys = true
c.hiera_config = 'spec/fixtures/hiera.yaml'
end

Expand Down

0 comments on commit 8411b8c

Please sign in to comment.