Merge "Cassandra: Initial commit" into J.1.3.0
This commit is contained in:
@@ -74,6 +74,9 @@ mod 'cloud',
|
|||||||
mod 'common',
|
mod 'common',
|
||||||
:git => 'git://github.com/enovance/puppet-module-common.git',
|
:git => 'git://github.com/enovance/puppet-module-common.git',
|
||||||
:ref => '2d0606fce1078222dd483e731ec32807f5b4ca53'
|
:ref => '2d0606fce1078222dd483e731ec32807f5b4ca53'
|
||||||
|
mod 'cassandra',
|
||||||
|
:git => 'git://github.com/enovance/cassandra.git',
|
||||||
|
:ref => '124f472128d178f52e2233d6aa8a0f1285f73c49'
|
||||||
mod 'concat',
|
mod 'concat',
|
||||||
:git => 'git://github.com/enovance/puppet-concat.git',
|
:git => 'git://github.com/enovance/puppet-concat.git',
|
||||||
:ref => 'ab06c2b8c09d9da82b53a62a5389427720519cd5'
|
:ref => 'ab06c2b8c09d9da82b53a62a5389427720519cd5'
|
||||||
|
40
manifests/database/nosql/cassandra.pp
Normal file
40
manifests/database/nosql/cassandra.pp
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
# == Class: cloud::database::nosql::cassandra
|
||||||
|
#
|
||||||
|
# Install a Cassandra node
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*firewall_settings*]
|
||||||
|
# (optional) Allow to add custom parameters to firewall rules
|
||||||
|
# Should be an hash.
|
||||||
|
# Default to {}
|
||||||
|
#
|
||||||
|
class cloud::database::nosql::cassandra (
|
||||||
|
$firewall_settings = {},
|
||||||
|
){
|
||||||
|
|
||||||
|
include ::cassandra
|
||||||
|
|
||||||
|
if $::cloud::manage_firewall {
|
||||||
|
cloud::firewall::rule{ '100 allow cassandra access':
|
||||||
|
port => '7000',
|
||||||
|
extras => $firewall_settings,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
79
spec/classes/cloud_database_nosql_cassandra_spec.rb
Normal file
79
spec/classes/cloud_database_nosql_cassandra_spec.rb
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2015 eNovance SAS <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
# Unit tests for cloud::cache::cassandra
|
||||||
|
#
|
||||||
|
|
||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'cloud::database::nosql::cassandra' do
|
||||||
|
|
||||||
|
shared_examples_for 'cassandra server' do
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{ }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'configure cassandra with some params' do
|
||||||
|
is_expected.to contain_class('cassandra')
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with default firewall enabled' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { 'cloud': manage_firewall => true }"
|
||||||
|
end
|
||||||
|
it 'configure cassandra firewall rules' do
|
||||||
|
is_expected.to contain_firewall('100 allow cassandra access').with(
|
||||||
|
:port => '7000',
|
||||||
|
:proto => 'tcp',
|
||||||
|
:action => 'accept',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with custom firewall enabled' do
|
||||||
|
let :pre_condition do
|
||||||
|
"class { 'cloud': manage_firewall => true }"
|
||||||
|
end
|
||||||
|
before :each do
|
||||||
|
params.merge!(:firewall_settings => { 'limit' => '50/sec' } )
|
||||||
|
end
|
||||||
|
it 'configure cassandra firewall rules with custom parameter' do
|
||||||
|
is_expected.to contain_firewall('100 allow cassandra access').with(
|
||||||
|
:port => '7000',
|
||||||
|
:proto => 'tcp',
|
||||||
|
:action => 'accept',
|
||||||
|
:limit => '50/sec',
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on Debian platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'Debian' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on RedHat platforms' do
|
||||||
|
let :facts do
|
||||||
|
{ :osfamily => 'RedHat' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it_configures 'cassandra server'
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
Reference in New Issue
Block a user