From 1d78470e5023e2ca6adef47c904d14d046dd87d1 Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Mon, 10 Nov 2014 14:45:07 -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: Ia384a42365056317ca14031081f8c6e134f266aa --- manifests/policy.pp | 7 ++++--- spec/classes/ceilometer_policy_spec.rb | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/manifests/policy.pp b/manifests/policy.pp index 31e93923..41df0a1a 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -18,11 +18,12 @@ class ceilometer::policy ( $policy_path = '/etc/ceilometer/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/ceilometer_policy_spec.rb b/spec/classes/ceilometer_policy_spec.rb index ea223a96..79338dc3 100644 --- a/spec/classes/ceilometer_policy_spec.rb +++ b/spec/classes/ceilometer_policy_spec.rb @@ -16,8 +16,9 @@ describe 'ceilometer::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