Add support for Elasticsearch storage backend
Change-Id: I9b3b74f3c32a43ae982f0c429c95819dc387bf80
This commit is contained in:
parent
021f77ca19
commit
2072b01aac
|
@ -0,0 +1,35 @@
|
|||
#
|
||||
# Class to configure elasticsearch storage
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*host*]
|
||||
# Elasticsearch host, along with port and protocol. (string value)
|
||||
# [*index_name*]
|
||||
# Elasticsearch index to use. (string value)
|
||||
# [*insecure*]
|
||||
# Set to true to authorize insecure HTTPS connections to elasticsearch.
|
||||
# [*cafile*]
|
||||
# Path of the CA certificate to trust for HTTPS connections (string value).
|
||||
# [*scroll_duration*]
|
||||
# Duration (in seconds) for which the ES scroll contexts should be kept
|
||||
# alive. (interer value)
|
||||
#
|
||||
class cloudkitty::storage::elasticsearch(
|
||||
String $host = $::os_service_default,
|
||||
String $index_name = $::os_service_default,
|
||||
Variant[String[0],Boolean] $insecure = $::os_service_default,
|
||||
String $cafile = $::os_service_default,
|
||||
Variant[String[0],Integer] $scroll_duration = $::os_service_default,
|
||||
){
|
||||
|
||||
include cloudkitty::deps
|
||||
|
||||
cloudkitty_config {
|
||||
'storage_elasticsearch/host': value => $host;
|
||||
'storage_elasticsearch/index_name': value => $index_name;
|
||||
'storage_elasticsearch/insecure': value => $insecure;
|
||||
'storage_elasticsearch/cafile': value => $cafile;
|
||||
'storage_elasticsearch/scroll_duration': value => $scroll_duration;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The new ``cloudkitty::storage::elasticsearch`` class has been added. This
|
||||
class can be used to set up the Elasticsearch storage backend.
|
|
@ -0,0 +1,52 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'cloudkitty::storage::elasticsearch' do
|
||||
|
||||
let :params do
|
||||
{
|
||||
:host => '<SERVICE DEFAULT>',
|
||||
:index_name => '<SERVICE DEFAULT>',
|
||||
:insecure => '<SERVICE DEFAULT>',
|
||||
:cafile => '<SERVICE DEFAULT>',
|
||||
:scroll_duration => '<SERVICE DEFAULT>',
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
shared_examples_for 'cloudkitty::storage::elasticsearch' do
|
||||
it { should contain_class('cloudkitty::deps') }
|
||||
|
||||
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/host').with_value( params[:host])}
|
||||
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/index_name').with_value( params[:index_name])}
|
||||
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/insecure').with_value( params[:insecure])}
|
||||
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/cafile').with_value( params[:cafile])}
|
||||
it { is_expected.to contain_cloudkitty_config('storage_elasticsearch/scroll_duration').with_value( params[:scroll_duration])}
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
context 'with default parameters' do
|
||||
it_behaves_like 'cloudkitty::storage::elasticsearch'
|
||||
end
|
||||
|
||||
context 'when overriding parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:host => 'http://localhost:9200',
|
||||
:index_name => 'cloudkitty',
|
||||
:insecure => true,
|
||||
:cafile => '/tmp/cafile.crt',
|
||||
:scroll_duration => 30,
|
||||
})
|
||||
end
|
||||
it_behaves_like 'cloudkitty::storage::elasticsearch'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue