From ce7c1852246057faa737e9987c42ab227598868e Mon Sep 17 00:00:00 2001 From: Mark McKinstry Date: Thu, 13 Oct 2016 16:17:13 -0400 Subject: [PATCH] make eyaml be the first backend older versions of this module had eyaml listed as the first backend. people who use eyaml need eyaml as the first back end, otherwise the encrypted valued will be read in as plain yaml and never decrypted. closes https://github.com/voxpupuli/puppet-hiera/issues/161 --- manifests/init.pp | 4 ++-- spec/classes/hiera_spec.rb | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c3b7862..bc9ffbd 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -142,9 +142,9 @@ true => $datadir, } # the requested_backends has a side affect in that the eyaml will always be - # last for backend lookups. This can be fixed by specifing the order in + # first for backend lookups. This can be fixed by specifing the order in # the backends parameter ie. ['yaml', 'eyaml', 'redis'] - $requested_backends = unique(concat($backends, 'eyaml')) + $requested_backends = unique(concat(['eyaml'], $backends)) } else { $requested_backends = $backends $eyaml_real_datadir = undef diff --git a/spec/classes/hiera_spec.rb b/spec/classes/hiera_spec.rb index 2f429c4..c520a07 100644 --- a/spec/classes/hiera_spec.rb +++ b/spec/classes/hiera_spec.rb @@ -130,7 +130,7 @@ it 'include backends' do backends = YAML.load(content)[:backends] - expect(backends).to eq(%w(yaml eyaml json yamll)) + expect(backends).to eq(%w(eyaml yaml json yamll)) end it 'include json backend' do backend = YAML.load(content)[:json] @@ -190,7 +190,7 @@ end it 'include eyaml-gpg backend with eyaml unspecified' do backends = YAML.load(content)[:backends] - expect(backends).to eq(%w(yaml eyaml)) + expect(backends).to eq(%w(eyaml yaml)) eyaml_backend = YAML.load(content)[:eyaml] expect(eyaml_backend[:datadir]).to eq('/etc/puppetlabs/code/environments/%{::environment}/hieradata') expect(eyaml_backend[:encrypt_method]).to eq('gpg') @@ -320,7 +320,7 @@ it 'include backends' do backends = YAML.load(content)[:backends] - expect(backends).to eq(%w(yaml eyaml json yamll)) + expect(backends).to eq(%w(eyaml yaml json yamll)) end it 'include json backend' do backend = YAML.load(content)[:json] @@ -380,7 +380,7 @@ end it 'include eyaml-gpg backend with eyaml unspecified' do backends = YAML.load(content)[:backends] - expect(backends).to eq(%w(yaml eyaml)) + expect(backends).to eq(%w(eyaml yaml)) eyaml_backend = YAML.load(content)[:eyaml] expect(eyaml_backend[:datadir]).to eq('/etc/puppetlabs/code/environments/%{::environment}/hieradata') expect(eyaml_backend[:encrypt_method]).to eq('gpg')