]> review.fuel-infra Code Review - puppet-modules/puppet-ceilometer.git/commitdiff
Add ability to specify ttl and timeout parameters
authoriberezovskiy <iberezovskiy@mirantis.com>
Fri, 31 Jul 2015 13:18:36 +0000 (16:18 +0300)
committeriberezovskiy <iberezovskiy@mirantis.com>
Tue, 4 Aug 2015 13:48:10 +0000 (16:48 +0300)
Allow to override following ceilometer parameters:
 * time to live for events
 * time to live for meters
 * timeout for HTTP requests

Change-Id: I083ac1ed90db96e69e2287acc9ec62956be0ae58

manifests/init.pp
spec/classes/ceilometer_init_spec.rb

index c4a84140b31a3f0e2d511b08201c4caa2b8a7439..c44c18c96697e21f6242356e483802d9ee440cae 100644 (file)
@@ -4,6 +4,17 @@
 #
 # == parameters
 #
+#  [*http_timeout*]
+#    timeout seconds for HTTP requests
+#     Defaults to 600
+#  [*event_time_to_live*]
+#    number of seconds that events are kept in the database for
+#    (<= 0 means forever)
+#    Defaults to -1
+#  [*metering_time_to_live*]
+#    number of seconds that samples are kept in the database for
+#    (<= 0 means forever)
+#    Defaults to -1
 #  [*metering_secret*]
 #    secret key for signing messages. Mandatory.
 #  [*notification_topics*]
 # (optional) various QPID options
 #
 class ceilometer(
+  $http_timeout                       = '600',
+  $event_time_to_live                 = '-1',
+  $metering_time_to_live              = '-1',
   $metering_secret                    = false,
   $notification_topics                = ['notifications'],
   $package_ensure                     = 'present',
@@ -278,11 +292,14 @@ class ceilometer(
 
   # Once we got here, we can act as an honey badger on the rpc used.
   ceilometer_config {
+    'DEFAULT/http_timeout'           : value => $http_timeout;
     'DEFAULT/rpc_backend'            : value => $rpc_backend;
     'publisher/metering_secret'      : value => $metering_secret, secret => true;
     'DEFAULT/debug'                  : value => $debug;
     'DEFAULT/verbose'                : value => $verbose;
     'DEFAULT/notification_topics'    : value => join($notification_topics, ',');
+    'database/event_time_to_live'    : value => $event_time_to_live;
+    'database/metering_time_to_live' : value => $metering_time_to_live;
   }
 
   # Log configuration
index c582fa13fb6c959cd67b96ea8a4a4e9febd3f93f..60fd3f03674636c89b8ca834aba5276121518d66 100644 (file)
@@ -4,11 +4,14 @@ describe 'ceilometer' do
 
   let :params do
     {
-      :metering_secret    => 'metering-s3cr3t',
-      :package_ensure     => 'present',
-      :debug              => 'False',
-      :log_dir            => '/var/log/ceilometer',
-      :verbose            => 'False',
+      :http_timeout          => '600',
+      :event_time_to_live    => '604800',
+      :metering_time_to_live => '604800',
+      :metering_secret       => 'metering-s3cr3t',
+      :package_ensure        => 'present',
+      :debug                 => 'False',
+      :log_dir               => '/var/log/ceilometer',
+      :verbose               => 'False',
     }
   end
 
@@ -34,6 +37,15 @@ describe 'ceilometer' do
 
   shared_examples_for 'ceilometer' do
 
+    it 'configures time to live for events and meters' do
+      is_expected.to contain_ceilometer_config('database/event_time_to_live').with_value( params[:event_time_to_live] )
+      is_expected.to contain_ceilometer_config('database/metering_time_to_live').with_value( params[:metering_time_to_live] )
+    end
+
+    it 'configures timeout for HTTP requests' do
+      is_expected.to contain_ceilometer_config('DEFAULT/http_timeout').with_value(params[:http_timeout])
+    end
+
     context 'with rabbit_host parameter' do
       before { params.merge!( rabbit_params ) }
       it_configures 'a ceilometer base installation'