From fd34b59ba5f7648fc6952aa930beca955776e829 Mon Sep 17 00:00:00 2001 From: Yanis Guenane Date: Mon, 10 Nov 2014 13:58:30 -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: I96df810db8c14e564baca508b7d2eec71c6573c3 --- manifests/policy.pp | 7 ++++--- spec/classes/heat_policy_spec.rb | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/manifests/policy.pp b/manifests/policy.pp index 342f60809..8414cdb52 100644 --- a/manifests/policy.pp +++ b/manifests/policy.pp @@ -18,11 +18,12 @@ $policy_path = '/etc/heat/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/heat_policy_spec.rb b/spec/classes/heat_policy_spec.rb index b556d2139..d0c974dbb 100644 --- a/spec/classes/heat_policy_spec.rb +++ b/spec/classes/heat_policy_spec.rb @@ -16,8 +16,9 @@ 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