Skip to content

Commit 9e2cf80

Browse files
authored
Merge pull request #347 from mwhahaha/idempotency-issues
Set dbpath_fix to false by default
2 parents d970680 + 65197d9 commit 9e2cf80

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ for your OS distro.
255255
Set this value to designate a directory for the mongod instance to store
256256
it's data. If not specified, the module will use the default for your OS distro.
257257

258+
##### `dbpath_fix`
259+
Set this value to true if you want puppet to recursively manage the permissions
260+
of the files in the dbpath directory. If you are using the default dbpath, this
261+
should probably be false. Set this to true if you are using a custom dbpath. The
262+
default is false.
263+
258264
##### `pidfilepath`
259265
Specify a file location to hold the PID or process ID of the mongod process.
260266
If not specified, the module will use the default for your OS distro.

manifests/params.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
$handle_creds = true
1414
$store_creds = false
1515
$rcfile = "${::root_home}/.mongorc.js"
16-
$dbpath_fix = true
16+
$dbpath_fix = false
1717

1818
$mongos_service_manage = pick($mongodb::globals::mongos_service_manage, true)
1919
$mongos_service_enable = pick($mongodb::globals::mongos_service_enable, true)

spec/classes/server_config_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
is_expected.to contain_file('/etc/mongod.conf').with_content(%r{^fork=true})
2828

2929
is_expected.to contain_file('/root/.mongorc.js').with(ensure: 'absent')
30+
is_expected.to_not contain_exec('fix dbpath permissions')
3031
}
3132
end
3233

@@ -149,4 +150,17 @@
149150

150151
it { is_expected.to contain_file('/var/run/mongodb/mongod.pid').with_mode('0640') }
151152
end
153+
154+
describe 'with dbpath_fix enabled' do
155+
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' }" }
156+
157+
it {
158+
is_expected.to contain_exec('fix dbpath permissions').with(
159+
:command => 'chown -R foo:bar /var/lib/mongo',
160+
:path => ['/usr/bin', '/bin'],
161+
:onlyif => "find /var/lib/mongo -not -user foo -o -not -group bar -print -quit | grep -q '.*'")
162+
is_expected.to contain_exec('fix dbpath permissions').that_subscribes_to('File[/var/lib/mongo]')
163+
}
164+
end
165+
152166
end

0 commit comments

Comments
 (0)