From: Alex Schultz <aschultz@mirantis.com>
Date: Thu, 30 Jun 2016 17:09:01 +0000 (-0600)
Subject: Add memcached_servers for keystone authtoken
X-Git-Tag: 8.3.0~2
X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F48%2F29448%2F2;p=puppet-modules%2Fpuppet-ceilometer.git

Add memcached_servers for keystone authtoken

This change adds the abiltity to manage the memcached servers for the
keystone authtoken configuration in ceilometer::api

Change-Id: I5fe1ec35630a67fe08b5c7b475593c34044110e8
(cherry picked from commit 1ae57a6e789b0bb2f4abe01c8d2314cca776edb9)
---

diff --git a/manifests/api.pp b/manifests/api.pp
index 5f43e4b..646cdc6 100644
--- a/manifests/api.pp
+++ b/manifests/api.pp
@@ -27,6 +27,11 @@
 # [*keystone_password*]
 #   (Required) Password to authenticate with.
 #
+# [*memcached_servers*]
+#   (optinal) a list of memcached server(s) to use for caching. If left
+#   undefined, tokens will instead be cached in-process.
+#   Defaults to $::os_service_default.
+#
 # [*auth_uri*]
 #   (Optional) Public Identity API endpoint.
 #   Defaults to 'http://127.0.0.1:5000/'.
@@ -77,6 +82,7 @@ class ceilometer::api (
   $keystone_user              = 'ceilometer',
   $keystone_tenant            = 'services',
   $keystone_password          = false,
+  $memcached_servers          = $::os_service_default,
   $auth_uri                   = 'http://127.0.0.1:5000/',
   $identity_uri               = 'http://127.0.0.1:35357/',
   $host                       = '0.0.0.0',
@@ -145,6 +151,7 @@ class ceilometer::api (
     'keystone_authtoken/admin_tenant_name' : value => $keystone_tenant;
     'keystone_authtoken/admin_user'        : value => $keystone_user;
     'keystone_authtoken/admin_password'    : value => $keystone_password, secret => true;
+    'keystone_authtoken/memcached_servers' : value => join(any2array($memcached_servers), ',');
     'api/host'                             : value => $host;
     'api/port'                             : value => $port;
   }
diff --git a/releasenotes/notes/keystone-authtoken-memcached-ab13c488a438804d.yaml b/releasenotes/notes/keystone-authtoken-memcached-ab13c488a438804d.yaml
new file mode 100644
index 0000000..a136f7d
--- /dev/null
+++ b/releasenotes/notes/keystone-authtoken-memcached-ab13c488a438804d.yaml
@@ -0,0 +1,4 @@
+---
+fixes:
+  - Added the ability to manage the memcached servers
+    for keystone_authtoken in ceilometer::api
diff --git a/spec/classes/ceilometer_api_spec.rb b/spec/classes/ceilometer_api_spec.rb
index 145787d..a0cf33c 100644
--- a/spec/classes/ceilometer_api_spec.rb
+++ b/spec/classes/ceilometer_api_spec.rb
@@ -44,6 +44,7 @@ describe 'ceilometer::api' do
       is_expected.to contain_ceilometer_config('keystone_authtoken/admin_password').with_value( params[:keystone_password] ).with_secret(true)
       is_expected.to contain_ceilometer_config('keystone_authtoken/auth_uri').with_value("http://127.0.0.1:5000/")
       is_expected.to contain_ceilometer_config('keystone_authtoken/identity_uri').with_value("http://127.0.0.1:35357/")
+      is_expected.to contain_ceilometer_config('keystone_authtoken/memcached_servers').with_value('<SERVICE DEFAULT>')
       is_expected.to contain_ceilometer_config('api/host').with_value( params[:host] )
       is_expected.to contain_ceilometer_config('api/port').with_value( params[:port] )
       is_expected.to contain_ceilometer_config('api/workers').with_value('<SERVICE DEFAULT>')
@@ -69,6 +70,16 @@ describe 'ceilometer::api' do
       end
     end
 
+    context 'with memcached servers' do
+      before do
+        params.merge!({ :memcached_servers => '1.1.1.1:11211', })
+      end
+
+      it 'configures ceilometer-api service' do
+        is_expected.to contain_ceilometer_config('keystone_authtoken/memcached_servers').with_value('1.1.1.1:11211')
+      end
+    end
+
     context 'with disabled service managing' do
       before do
         params.merge!({