Skip to content

Commit 9a83e21

Browse files
authored
Merge pull request #779 from h-haaks/update-default-repo-version
Update default repo version to latest supported by OS
2 parents 28d71fd + b684e0e commit 9a83e21

10 files changed

Lines changed: 91 additions & 21 deletions

File tree

REFERENCE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,8 @@ Default value: `true`
176176
Data type: `String[1]`
177177

178178
The version of the package repo.
179-
180-
Default value: `'5.0'`
179+
If not specified, the module will default to the latest supported version for your OS distro.
180+
When `repo_location` is specified `repo_version` is ignored.
181181

182182
##### <a name="-mongodb--globals--use_enterprise_repo"></a>`use_enterprise_repo`
183183

data/Debian-11.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
mongodb::globals::repo_version: '7.0'

data/Debian-family.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
mongodb::globals::repo_version: '8.0'
23
mongodb::server::user: 'mongodb'
34
mongodb::server::group: 'mongodb'
45
mongodb::server::dbpath: '/var/lib/mongodb'

data/Linux-family.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
# Amazon uses os family Linux
3+
mongodb::globals::repo_version: '8.0'
34
mongodb::server::user: 'mongod'
45
mongodb::server::group: 'mongod'
56
mongodb::server::dbpath: '/var/lib/mongodb'

data/RedHat-family.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
mongodb::globals::repo_version: '8.0'
23
mongodb::server::user: 'mongod'
34
mongodb::server::group: 'mongod'
45
mongodb::server::dbpath: '/var/lib/mongo'

data/Suse-12.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
mongodb::globals::repo_version: '7.0'

data/Suse-family.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
---
2+
mongodb::globals::repo_version: '8.0'
23
mongodb::server::user: 'mongod'
34
mongodb::server::group: 'mongod'
45
mongodb::server::dbpath: '/var/lib/mongodb'

manifests/globals.pp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
#
5151
# @param repo_version
5252
# The version of the package repo.
53+
# If not specified, the module will default to the latest supported version for your OS distro.
54+
# When `repo_location` is specified `repo_version` is ignored.
5355
#
5456
# @param use_enterprise_repo
5557
# When manage_package_repo is set to true, this setting indicates if it will use the Community Edition
@@ -74,10 +76,10 @@
7476
# This sets the password for the proxyserver, should authentication be required
7577
#
7678
class mongodb::globals (
79+
String[1] $repo_version,
7780
Optional[String[1]] $version = undef,
7881
Optional[String[1]] $client_version = undef,
7982
Boolean $manage_package_repo = true,
80-
String[1] $repo_version = '5.0',
8183
Boolean $use_enterprise_repo = false,
8284
Optional[String] $repo_location = undef,
8385
Optional[String] $keyring_location = undef,

manifests/repo.pp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@
4040
if $version == undef and $repo_location == undef {
4141
fail('`version` or `repo_location` is required')
4242
}
43-
if $version != undef and $repo_location != undef {
44-
fail('`version` is not supported with `repo_location`')
45-
}
4643
if $version != undef and versioncmp($version, '4.4') < 0 {
4744
fail('Package repositories for versions older than 4.4 are unsupported')
4845
}

spec/classes/server_spec.rb

Lines changed: 78 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,7 @@
273273
}
274274
end
275275

276-
it do
277-
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
278-
expect(config_data['storage']['journal']['enabled']).to be(true)
279-
end
276+
it { is_expected.to raise_error(Puppet::Error) }
280277
end
281278

282279
describe 'with journal: false' do
@@ -286,10 +283,7 @@
286283
}
287284
end
288285

289-
it do
290-
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
291-
expect(config_data['storage']['journal']['enabled']).to be(false)
292-
end
286+
it { is_expected.to raise_error(Puppet::Error) }
293287
end
294288

295289
describe 'with journal and package_version < 7.0.0' do
@@ -300,10 +294,7 @@
300294
}
301295
end
302296

303-
it do
304-
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
305-
expect(config_data['storage']['journal']['enabled']).to be(true)
306-
end
297+
it { is_expected.to raise_error(Puppet::Error) }
307298
end
308299

309300
describe 'with journal and package_version >= 7.0.0' do
@@ -317,6 +308,31 @@
317308
it { is_expected.to raise_error(Puppet::Error) }
318309
end
319310

311+
describe 'with journal and user defined repo_version < 7.0' do
312+
let :params do
313+
{
314+
journal: true
315+
}
316+
end
317+
let(:pre_condition) do
318+
[
319+
'class mongodb::globals {
320+
$manage_package_repo = true
321+
$version = undef
322+
$edition = "org"
323+
$repo_version = "6.0"
324+
$repo_location = undef
325+
}',
326+
'class{"mongodb::globals": }'
327+
]
328+
end
329+
330+
it do
331+
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
332+
expect(config_data['storage']['journal']['enabled']).to be(true)
333+
end
334+
end
335+
320336
describe 'with journal and user defined repo_location without version' do
321337
let :params do
322338
{
@@ -327,7 +343,32 @@
327343
[
328344
'class mongodb::globals {
329345
$manage_package_repo = true
330-
$version = "5.0"
346+
$version = undef
347+
$edition = "org"
348+
$repo_location = "https://repo.myorg.com/"
349+
}',
350+
'class{"mongodb::globals": }'
351+
]
352+
end
353+
354+
it do
355+
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
356+
expect(config_data['storage']['journal']['enabled']).to be(true)
357+
end
358+
end
359+
360+
describe 'with journal, package_version < 7.0.0 and user defined repo_location without version' do
361+
let :params do
362+
{
363+
package_ensure: '6.0.0',
364+
journal: true
365+
}
366+
end
367+
let(:pre_condition) do
368+
[
369+
'class mongodb::globals {
370+
$manage_package_repo = true
371+
$version = undef
331372
$edition = "org"
332373
$repo_location = "https://repo.myorg.com/"
333374
}',
@@ -341,6 +382,28 @@
341382
end
342383
end
343384

385+
describe 'with journal, package_version >= 7.0.0 and user defined repo_location without version' do
386+
let :params do
387+
{
388+
package_ensure: '7.0.0',
389+
journal: true
390+
}
391+
end
392+
let(:pre_condition) do
393+
[
394+
'class mongodb::globals {
395+
$manage_package_repo = true
396+
$version = undef
397+
$edition = "org"
398+
$repo_location = "https://repo.myorg.com/"
399+
}',
400+
'class{"mongodb::globals": }'
401+
]
402+
end
403+
404+
it { is_expected.to raise_error(Puppet::Error) }
405+
end
406+
344407
describe 'with journal and user defined repo_location with version < 7.0' do
345408
let :params do
346409
{
@@ -351,7 +414,7 @@
351414
[
352415
'class mongodb::globals {
353416
$manage_package_repo = true
354-
$version = "5.0"
417+
$version = undef
355418
$edition = "org"
356419
$repo_location = "https://repo.myorg.com/6.0/"
357420
}',
@@ -375,7 +438,7 @@
375438
[
376439
'class mongodb::globals {
377440
$manage_package_repo = true
378-
$version = "5.0"
441+
$version = undef
379442
$edition = "org"
380443
$repo_location = "https://repo.myorg.com/7.0/"
381444
}',

0 commit comments

Comments
 (0)