]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Add group to policy management
authorEmilien Macchi <emilien@redhat.com>
Wed, 10 Jan 2018 22:07:50 +0000 (14:07 -0800)
committerEmilien Macchi <emilien@redhat.com>
Thu, 11 Jan 2018 15:55:12 +0000 (15:55 +0000)
The move of policy.json into code means the file may not exist. We've
added support to ensure that the file exists in the openstacklib but we
need to make sure the permissions are right for each service. This adds
the group information to the policies so it works right.

Depends-On: I26e8b1384f4f69712da9d06a4c565dfd1f17c9ed
Change-Id: I3b4d162e4ba79f1dcc9e98e7a600b3b3203018f3
Co-Authored-By: Alex Schultz <aschultz@redhat.com>
manifests/params.pp
manifests/policy.pp
spec/classes/ceilometer_policy_spec.rb

index 5fe7e628977469d51593e2a1c7f896b797a99a4a..ed150ea859218a80a3bc177b2425d61e34ac0250 100644 (file)
@@ -12,6 +12,7 @@ class ceilometer::params {
   $event_pipeline      = '/etc/ceilometer/event_pipeline.yaml'
   $pipeline            = '/etc/ceilometer/pipeline.yaml'
   $polling             = '/etc/ceilometer/polling.yaml'
+  $group               = 'ceilometer'
 
   case $::osfamily {
     'RedHat': {
index 3756715c0da26c75141a9ba3ed60f994405f6eca..3c4977f6ef4e63960e28c6f8a7a273c2f317dc16 100644 (file)
@@ -2,18 +2,25 @@
 #
 # Configure the ceilometer policies
 #
-# === Parameters:
+# === Parameters
 #
 # [*policies*]
-#   (Optional) Set of policies to configure for ceilometer
-#   Example : {
-#               'ceilometer-context_is_admin' => {'context_is_admin' => 'true'},
-#               'ceilometer-default' => {'default' => 'rule:admin_or_owner'}
-#             }
+#   (optional) Set of policies to configure for ceilometer
+#   Example :
+#     {
+#       'ceilometer-context_is_admin' => {
+#         'key' => 'context_is_admin',
+#         'value' => 'true'
+#       },
+#       'ceilometer-default' => {
+#         'key' => 'default',
+#         'value' => 'rule:admin_or_owner'
+#       }
+#     }
 #   Defaults to empty hash.
 #
 # [*policy_path*]
-#   (Optional) Path to the ceilometer policy.json file
+#   (optional) Path to the ceilometer policy.json file
 #   Defaults to /etc/ceilometer/policy.json
 #
 class ceilometer::policy (
@@ -22,11 +29,14 @@ class ceilometer::policy (
 ) {
 
   include ::ceilometer::deps
+  include ::ceilometer::params
 
   validate_hash($policies)
 
   Openstacklib::Policy::Base {
-    file_path => $policy_path,
+    file_path  => $policy_path,
+    file_user  => 'root',
+    file_group => $::ceilometer::params::group,
   }
 
   create_resources('openstacklib::policy::base', $policies)
index f4f98ee74b480579d675351ee809c0f5cb7eee2d..d49c922cb2070db3370b42abc538dcd6dfc5d3c6 100644 (file)
@@ -17,8 +17,10 @@ describe 'ceilometer::policy' do
 
     it 'set up the policies' do
       is_expected.to contain_openstacklib__policy__base('context_is_admin').with({
-        :key   => 'context_is_admin',
-        :value => 'foo:bar'
+        :key        => 'context_is_admin',
+        :value      => 'foo:bar',
+        :file_user  => 'root',
+        :file_group => 'ceilometer',
       })
       is_expected.to contain_oslo__policy('ceilometer_config').with(
         :policy_file => '/etc/ceilometer/policy.json',
@@ -34,8 +36,7 @@ describe 'ceilometer::policy' do
         facts.merge!(OSDefaults.get_facts())
       end
 
-      it_behaves_like 'ceilometer policies'
+      it_configures 'ceilometer policies'
     end
   end
-
 end