From 8411b8c6ad4ce9517310c482d86b092daded81bc Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 25 Jun 2024 10:04:16 +0200 Subject: [PATCH] facterdb_string_keys: switch to strings --- .sync.yml | 1 + spec/classes/ca_cert_spec.rb | 2 +- spec/defines/ca_spec.rb | 10 +++++----- spec/spec_helper.rb | 1 + 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.sync.yml b/.sync.yml index 9abfa45..43aaad1 100644 --- a/.sync.yml +++ b/.sync.yml @@ -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 diff --git a/spec/classes/ca_cert_spec.rb b/spec/classes/ca_cert_spec.rb index bb54d64..e1e899a 100644 --- a/spec/classes/ca_cert_spec.rb +++ b/spec/classes/ca_cert_spec.rb @@ -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' diff --git a/spec/defines/ca_spec.rb b/spec/defines/ca_spec.rb index 974726c..ae7a409 100644 --- a/spec/defines/ca_spec.rb +++ b/spec/defines/ca_spec.rb @@ -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' @@ -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}") } @@ -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}") } @@ -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}") } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 78acf17..e2ad22a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -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