]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
policy.pp : Fix duplicate ressource issue openstacklib::policy
authorYanis Guenane <yanis.guenane@enovance.com>
Mon, 10 Nov 2014 19:45:07 +0000 (14:45 -0500)
committerYanis Guenane <yanis.guenane@enovance.com>
Mon, 10 Nov 2014 19:45:07 +0000 (14:45 -0500)
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
spec/classes/ceilometer_policy_spec.rb

index 31e93923577f330e0499cef1d6c892251aecac9e..41df0a1a42856458d3eefda970f44a53993392f7 100644 (file)
@@ -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)
 
 }
index ea223a96f22d79373f4d66fdb44d3d9d7a535174..79338dc3691626057da26b565f7220047d8a482e 100644 (file)
@@ -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