MongoDB: move to dedicated class and add version param

* Allow to use another MongoDB version
* Move MongoDB code to cloud::database::nosql::mongodb for general
  consistency.

Change-Id: Iddf5d43af26291f8239b1dfe9d70986aabc6c662
This commit is contained in:
Emilien Macchi
2015-01-22 08:35:04 -05:00
parent 436f56b4ef
commit 2b99d85db1
2 changed files with 13 additions and 7 deletions

View File

@@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
# == Class: cloud::database::nosql # == Class: cloud::database::nosql::mongodb
# #
# Install a nosql server (MongoDB) # Install a nosql server (MongoDB)
# #
@@ -40,11 +40,16 @@
# Should be an hash. # Should be an hash.
# Default to {} # Default to {}
# #
class cloud::database::nosql( # [*mongodb_version*]
# (optional) Specify MongoDB version
# Default to '2.4.0'
#
class cloud::database::nosql::mongodb(
$bind_ip = '127.0.0.1', $bind_ip = '127.0.0.1',
$nojournal = false, $nojournal = false,
$replset_members = $::hostname, $replset_members = $::hostname,
$firewall_settings = {}, $firewall_settings = {},
$mongodb_version = '2.4.0',
) { ) {
# should be an array # should be an array
@@ -60,11 +65,11 @@ class cloud::database::nosql(
$manage_package_repo = true $manage_package_repo = true
} }
class { 'mongodb::globals': class { '::mongodb::globals':
manage_package_repo => $manage_package_repo, manage_package_repo => $manage_package_repo,
version => '2.4.0', version => $mongodb_version,
}-> }->
class { 'mongodb': class { '::mongodb':
bind_ip => $array_bind_ip, bind_ip => $array_bind_ip,
nojournal => $nojournal, nojournal => $nojournal,
replset => 'ceilometer', replset => 'ceilometer',

View File

@@ -13,18 +13,19 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
# #
# Unit tests for cloud::database:nosql class # Unit tests for cloud::database:nosql::mongodb class
# #
require 'spec_helper' require 'spec_helper'
describe 'cloud::database::nosql' do describe 'cloud::database::nosql::mongodb' do
shared_examples_for 'openstack database nosql' do shared_examples_for 'openstack database nosql' do
let :params do let :params do
{ :bind_ip => '10.0.0.1', { :bind_ip => '10.0.0.1',
:nojournal => false, :nojournal => false,
:mongodb_version => '2.4.0',
:replset_members => ['node1', 'node2', 'node3'] } :replset_members => ['node1', 'node2', 'node3'] }
end end