Skip to content

Commit

Permalink
Update mongodb to 1ae7406589e3abf6f65a337005217ca0e0323840
Browse files Browse the repository at this point in the history
1ae7406589e3abf6f65a337005217ca0e0323840 Merge pull request redhat-openstack#183 from xbezdick/master
f6fa7dfe9006d7c5bdeb84aa354e79fa54602bd5 Add support for ipv6
  • Loading branch information
xbezdick committed Mar 23, 2015
1 parent 6f15564 commit c65717f
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod 'module-data',
:git => 'https://github.com/ripienaar/puppet-module-data.git'

mod 'mongodb',
:commit => 'e4c2f0809a7c44c1c940d50f8108d1a448d79dfb',
:commit => '1ae7406589e3abf6f65a337005217ca0e0323840',
:git => 'https://github.com/puppetlabs/puppetlabs-mongodb.git'

mod 'mysql',
Expand Down
8 changes: 8 additions & 0 deletions mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,10 @@ This setting can be used to override the default MongoDB user group to be used
for related files in the file system. If not specified, the module will use
the default for your OS distro.

#####`ipv6`
This setting is used to configure MongoDB to turn on ipv6 support. If not specified
and ipv6 address is passed to MongoDB bind_ip it will just fail.

#####`bind_ip`
This setting can be used to configure MonogDB process to bind to and listen
for connections from applications on this address. If not specified, the
Expand Down Expand Up @@ -217,6 +221,10 @@ Specify the path to a file name for the log file that will hold all diagnostic
logging information. Unless specified, mongod will output all log information
to the standard output.

#####`ipv6`
This setting has to be true to configure MongoDB to turn on ipv6 support. If not specified
and ipv6 address is passed to MongoDB bind_ip it will just fail.

#####`bind_ip`
Set this option to configure the mongod or mongos process to bind to and listen
for connections from applications on this address. If not specified, the module
Expand Down
4 changes: 2 additions & 2 deletions mongodb/lib/puppet/util/mongodb_validator.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'socket'
require 'timeout'

require 'ipaddr'

module Puppet
module Util
Expand All @@ -9,7 +9,7 @@ class MongodbValidator
attr_reader :mongodb_port

def initialize(mongodb_server, mongodb_port)
@mongodb_server = mongodb_server
@mongodb_server = IPAddr.new(mongodb_server).to_s
@mongodb_port = mongodb_port
end

Expand Down
1 change: 1 addition & 0 deletions mongodb/manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

$user = undef,
$group = undef,
$ipv6 = undef,
$bind_ip = undef,

$version = undef,
Expand Down
2 changes: 2 additions & 0 deletions mongodb/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
$slowms = undef,
$keyfile = undef,
$key = undef,
$ipv6 = undef,
$bind_ip = undef,
$pidfilepath = undef
) inherits mongodb::params {
Expand Down Expand Up @@ -137,6 +138,7 @@
slowms => $slowms,
keyfile => $keyfile,
key => $key,
ipv6 => $ipv6,
bind_ip => $bind_ip,
pidfilepath => $pidfilepath,
}
Expand Down
1 change: 1 addition & 0 deletions mongodb/manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
class mongodb::params inherits mongodb::globals {
$ensure = true
$mongos_ensure = true
$ipv6 = undef
$service_enable = pick($mongodb::globals::service_enable, true)
$service_ensure = pick($mongodb::globals::service_ensure, 'running')
$service_status = $mongodb::globals::service_status
Expand Down
1 change: 1 addition & 0 deletions mongodb/manifests/server.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

$logpath = $mongodb::params::logpath,
$bind_ip = $mongodb::params::bind_ip,
$ipv6 = undef,
$logappend = true,
$fork = $mongodb::params::fork,
$port = undef,
Expand Down
1 change: 1 addition & 0 deletions mongodb/manifests/server/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
$slowms = $mongodb::server::slowms
$keyfile = $mongodb::server::keyfile
$key = $mongodb::server::key
$ipv6 = $mongodb::server::ipv6
$bind_ip = $mongodb::server::bind_ip
$directoryperdb = $mongodb::server::directoryperdb
$profile = $mongodb::server::profile
Expand Down
9 changes: 9 additions & 0 deletions mongodb/spec/classes/server_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@

end

describe 'with specific bind_ip values and ipv6' do
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $ensure = present $bind_ip = ['127.0.0.1', 'fd00:beef:dead:55::143'] $ipv6 = true }", "include mongodb::server"]}

it {
should contain_file('/etc/mongod.conf').with_content(/bind_ip\s=\s127\.0\.0\.1\,fd00:beef:dead:55::143/)
should contain_file('/etc/mongod.conf').with_content(/ipv6=true/)
}
end

describe 'with specific bind_ip values' do
let(:pre_condition) { ["class mongodb::server { $config = '/etc/mongod.conf' $dbpath = '/var/lib/mongo' $ensure = present $bind_ip = ['127.0.0.1', '10.1.1.13']}", "include mongodb::server"]}

Expand Down
3 changes: 3 additions & 0 deletions mongodb/templates/mongodb.conf.2.6.erb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ security.javascriptEnabled: <%= @noscripting %>


# Net
<% if @ipv6 -%>
net.ipv6=<%= @ipv6 %>
<% end -%>
<% if @bind_ip -%>
net.bindIp: <%= Array(@bind_ip).join(',') %>
<% end -%>
Expand Down
3 changes: 3 additions & 0 deletions mongodb/templates/mongodb.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ logpath=<%= @logpath %>
logappend=<%= @logappend %>
<% end -%>
<% end -%>
<% if @ipv6 -%>
ipv6=<%= @ipv6 %>
<% end -%>
<% if @bind_ip -%>
# Set this option to configure the mongod or mongos process to bind to and
# listen for connections from applications on this address.
Expand Down

0 comments on commit c65717f

Please sign in to comment.