Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set dbpath_fix to false by default #347

Merged
merged 1 commit into from
Oct 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ for your OS distro.
Set this value to designate a directory for the mongod instance to store
it's data. If not specified, the module will use the default for your OS distro.

##### `dbpath_fix`
Set this value to true if you want puppet to recursively manage the permissions
of the files in the dbpath directory. If you are using the default dbpath, this
should probably be false. Set this to true if you are using a custom dbpath. The
default is false.

##### `pidfilepath`
Specify a file location to hold the PID or process ID of the mongod process.
If not specified, the module will use the default for your OS distro.
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$handle_creds = true
$store_creds = false
$rcfile = "${::root_home}/.mongorc.js"
$dbpath_fix = true
$dbpath_fix = false

$mongos_service_manage = pick($mongodb::globals::mongos_service_manage, true)
$mongos_service_enable = pick($mongodb::globals::mongos_service_enable, true)
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/server_config_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
is_expected.to contain_file('/etc/mongod.conf').with_content(%r{^fork=true})

is_expected.to contain_file('/root/.mongorc.js').with(ensure: 'absent')
is_expected.to_not contain_exec('fix dbpath permissions')
}
end

Expand Down Expand Up @@ -149,4 +150,17 @@

it { is_expected.to contain_file('/var/run/mongodb/mongod.pid').with_mode('0640') }
end

describe 'with dbpath_fix enabled' do
let(:pre_condition) { "class { 'mongodb::server': config => '/etc/mongod.conf', dbpath => '/var/lib/mongo', rcfile => '/root/.mongorc.js', dbpath_fix => true, user => 'foo', group => 'bar' }" }

it {
is_expected.to contain_exec('fix dbpath permissions').with(
:command => 'chown -R foo:bar /var/lib/mongo',
:path => ['/usr/bin', '/bin'],
:onlyif => "find /var/lib/mongo -not -user foo -o -not -group bar -print -quit | grep -q '.*'")
is_expected.to contain_exec('fix dbpath permissions').that_subscribes_to('File[/var/lib/mongo]')
}
end

end