Skip to content
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
4 changes: 2 additions & 2 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ Default value: `true`
Data type: `String[1]`

The version of the package repo.

Default value: `'5.0'`
If not specified, the module will default to the latest supported version for your OS distro.
When `repo_location` is specified `repo_version` is ignored.

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

Expand Down
2 changes: 2 additions & 0 deletions data/Debian-11.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
mongodb::globals::repo_version: '7.0'
1 change: 1 addition & 0 deletions data/Debian-family.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
mongodb::globals::repo_version: '8.0'
mongodb::server::user: 'mongodb'
mongodb::server::group: 'mongodb'
mongodb::server::dbpath: '/var/lib/mongodb'
Expand Down
1 change: 1 addition & 0 deletions data/Linux-family.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
# Amazon uses os family Linux
mongodb::globals::repo_version: '8.0'
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::dbpath: '/var/lib/mongodb'
Expand Down
1 change: 1 addition & 0 deletions data/RedHat-family.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
mongodb::globals::repo_version: '8.0'
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::dbpath: '/var/lib/mongo'
Expand Down
2 changes: 2 additions & 0 deletions data/Suse-12.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
mongodb::globals::repo_version: '7.0'
1 change: 1 addition & 0 deletions data/Suse-family.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
mongodb::globals::repo_version: '8.0'
mongodb::server::user: 'mongod'
mongodb::server::group: 'mongod'
mongodb::server::dbpath: '/var/lib/mongodb'
Expand Down
4 changes: 3 additions & 1 deletion manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
#
# @param repo_version
# The version of the package repo.
# If not specified, the module will default to the latest supported version for your OS distro.
# When `repo_location` is specified `repo_version` is ignored.
#
# @param use_enterprise_repo
# When manage_package_repo is set to true, this setting indicates if it will use the Community Edition
Expand All @@ -74,10 +76,10 @@
# This sets the password for the proxyserver, should authentication be required
#
class mongodb::globals (
String[1] $repo_version,
Optional[String[1]] $version = undef,
Optional[String[1]] $client_version = undef,
Boolean $manage_package_repo = true,
String[1] $repo_version = '5.0',
Boolean $use_enterprise_repo = false,
Optional[String] $repo_location = undef,
Optional[String] $keyring_location = undef,
Expand Down
3 changes: 0 additions & 3 deletions manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
if $version == undef and $repo_location == undef {
fail('`version` or `repo_location` is required')
}
if $version != undef and $repo_location != undef {
fail('`version` is not supported with `repo_location`')
}
if $version != undef and versioncmp($version, '4.4') < 0 {
fail('Package repositories for versions older than 4.4 are unsupported')
}
Expand Down
93 changes: 78 additions & 15 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,7 @@
}
end

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

describe 'with journal: false' do
Expand All @@ -286,10 +283,7 @@
}
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(false)
end
it { is_expected.to raise_error(Puppet::Error) }
end

describe 'with journal and package_version < 7.0.0' do
Expand All @@ -300,10 +294,7 @@
}
end

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

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

describe 'with journal and user defined repo_version < 7.0' do
let :params do
{
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = undef
$edition = "org"
$repo_version = "6.0"
$repo_location = undef
}',
'class{"mongodb::globals": }'
]
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
end
end

describe 'with journal and user defined repo_location without version' do
let :params do
{
Expand All @@ -327,7 +343,32 @@
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$version = undef
$edition = "org"
$repo_location = "https://repo.myorg.com/"
}',
'class{"mongodb::globals": }'
]
end

it do
config_data = YAML.safe_load(catalogue.resource("File[#{config_file}]")[:content])
expect(config_data['storage']['journal']['enabled']).to be(true)
end
end

describe 'with journal, package_version < 7.0.0 and user defined repo_location without version' do
let :params do
{
package_ensure: '6.0.0',
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = undef
$edition = "org"
$repo_location = "https://repo.myorg.com/"
}',
Expand All @@ -341,6 +382,28 @@
end
end

describe 'with journal, package_version >= 7.0.0 and user defined repo_location without version' do
let :params do
{
package_ensure: '7.0.0',
journal: true
}
end
let(:pre_condition) do
[
'class mongodb::globals {
$manage_package_repo = true
$version = undef
$edition = "org"
$repo_location = "https://repo.myorg.com/"
}',
'class{"mongodb::globals": }'
]
end

it { is_expected.to raise_error(Puppet::Error) }
end

describe 'with journal and user defined repo_location with version < 7.0' do
let :params do
{
Expand All @@ -351,7 +414,7 @@
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$version = undef
$edition = "org"
$repo_location = "https://repo.myorg.com/6.0/"
}',
Expand All @@ -375,7 +438,7 @@
[
'class mongodb::globals {
$manage_package_repo = true
$version = "5.0"
$version = undef
$edition = "org"
$repo_location = "https://repo.myorg.com/7.0/"
}',
Expand Down