From b4e7b594ed95227b1040efd1848451f135f873fe Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 16 Mar 2021 22:27:28 +0900 Subject: [PATCH] Accept a list value for p11_crypto_plugin_token_labels The p11_crypto_plugin_token_labels parameter takes a list value, thus it would be useful if a list value is accepted at puppet layer as well. Change-Id: I52e08326079619049e2d436cc468829f8721257f --- manifests/plugins/p11_crypto.pp | 2 +- spec/classes/barbican_plugins_p11_crypto_spec.rb | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/manifests/plugins/p11_crypto.pp b/manifests/plugins/p11_crypto.pp index 8ded166f..684d67cf 100644 --- a/manifests/plugins/p11_crypto.pp +++ b/manifests/plugins/p11_crypto.pp @@ -110,7 +110,7 @@ Use the p11_crypto_plugin_token_labels parameter instead') 'p11_crypto_plugin/hmac_label': value => $p11_crypto_plugin_hmac_label; 'p11_crypto_plugin/token_serial_number': value => $p11_crypto_plugin_token_serial_number; 'p11_crypto_plugin/token_label': value => $p11_crypto_plugin_token_label_real; - 'p11_crypto_plugin/token_labels': value => $p11_crypto_plugin_token_labels; + 'p11_crypto_plugin/token_labels': value => join(any2array($p11_crypto_plugin_token_labels), ','); 'p11_crypto_plugin/slot_id': value => $p11_crypto_plugin_slot_id; 'p11_crypto_plugin/encryption_mechanism': value => $p11_crypto_plugin_encryption_mechanism; 'p11_crypto_plugin/hmac_key_type': value => $p11_crypto_plugin_hmac_key_type; diff --git a/spec/classes/barbican_plugins_p11_crypto_spec.rb b/spec/classes/barbican_plugins_p11_crypto_spec.rb index 3b002eeb..e20567e8 100644 --- a/spec/classes/barbican_plugins_p11_crypto_spec.rb +++ b/spec/classes/barbican_plugins_p11_crypto_spec.rb @@ -82,6 +82,17 @@ describe 'barbican::plugins::p11_crypto' do 'secretstore:pkcs11/global_default') \ .with_value('true') end + + context 'when p11_crypto_plugin_token_labels is a list' do + before do + params.merge!( :p11_crypto_plugin_token_labels => ['token_label1', 'token_label2'] ) + end + + it 'is_expected.to set p11 parameters' do + is_expected.to contain_barbican_config('p11_crypto_plugin/token_labels') \ + .with_value('token_label1,token_label2') + end + end end end