From b5dce39754ed6857d6dc87b3ae29ed38057a487e Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Mon, 10 Nov 2014 14:27:42 -0500 Subject: [PATCH] policy.pp : Fix duplicate ressource issue openstacklib::policy Currently, in the policy.pp file the class openstacklib::policy is called. The same apply for all components resulting in a Duplicate Ressource issue. Using directly the underlying ressource openstacklib::policy::base we prevent this issue. Change-Id: Ida23a774158f3275bc874d1b52a3424afeeb6fb2 --- manifests/policy.pp | 7 ++++--- spec/classes/cinder_policy_spec.rb | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/manifests/policy.pp b/manifests/policy.pp index 8907e8fe..322dd0da 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -18,11 +18,12 @@ class cinder::policy ( $policy_path = '/etc/cinder/policy.json', ) { + validate_hash($policies) + Openstacklib::Policy::Base { file_path => $policy_path, } - class { 'openstacklib::policy' : - policies => $policies, - } + + create_resources('openstacklib::policy::base', $policies) } diff --git a/spec/classes/cinder_policy_spec.rb b/spec/classes/cinder_policy_spec.rb index 409a7279..e9b6d46d 100644 --- a/spec/classes/cinder_policy_spec.rb +++ b/spec/classes/cinder_policy_spec.rb @@ -16,8 +16,9 @@ describe 'cinder::policy' do end it 'set up the policies' do - should contain_class('openstacklib::policy').with({ - :policies => params[:policies] + should contain_openstacklib__policy__base('context_is_admin').with({ + :key => 'context_is_admin', + :value => 'foo:bar' }) end end