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

Add Debian 10 support #619

Merged
merged 1 commit into from
Sep 3, 2021
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
11 changes: 8 additions & 3 deletions manifests/globals.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
$ipv6 = undef,
$bind_ip = undef,

$version = undef,

$manage_package_repo = undef,
$version = fact('os.distro.codename') ? { # Debian 10 doesn't provide mongodb 3.6.
'buster' => '4.4.8',
default => undef
},
$manage_package_repo = fact('os.distro.codename') ? { # Debian 10 doesn't provide mongodb packages. So manage it!
'buster' => true,
default => undef
},
Comment on lines +19 to +26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That mean that the same configuration on some nodes install the version packaged for the system by the OS vendor, and on other brings in a custom repository and version not supported by the OS vendor.

I would be more confident if we required the end user to set manage_package_repo and version explicitly and defaulting to what the OS recommend.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My only concern is that for some OSes the module will work out of the box and for Debian 10/11 you'll need mongodb::globals class as well

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But since Debian does not support MongoDB out of the box, that seems fair. Maybe I am the only one worried by this :-) Let's wait for other reviewers opinion about this.

$manage_package = undef,
$repo_proxy = undef,
$proxy_username = undef,
Expand Down
3 changes: 2 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"9"
"9",
"10"
]
},
{
Expand Down
6 changes: 5 additions & 1 deletion spec/acceptance/mongos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
describe 'mongodb::mongos class' do
case fact('osfamily')
when 'Debian'
package_name = 'mongodb-server'
package_name = if fact('os.distro.codename') =~ %r{^(buster|bullseye)$}
'mongodb-org-server'
else
'mongodb-server'
end
config_file = '/etc/mongodb-shard.conf'
else
package_name = 'mongodb-org-server'
Expand Down
18 changes: 15 additions & 3 deletions spec/acceptance/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,21 @@
describe 'mongodb::server class' do
case fact('osfamily')
when 'Debian'
config_file = '/etc/mongodb.conf'
service_name = 'mongodb'
package_name = 'mongodb-server'
config_file = if fact('os.distro.codename') =~ %r{^(buster)$}
'/etc/mongod.conf'
else
'/etc/mongodb.conf'
end
service_name = if fact('os.distro.codename') =~ %r{^(buster)$}
'mongod'
else
'mongodb'
end
package_name = if fact('os.distro.codename') =~ %r{^(buster)$}
'mongodb-org-server'
else
'mongodb-server'
end
else
config_file = '/etc/mongod.conf'
service_name = 'mongod'
Expand Down
12 changes: 10 additions & 2 deletions spec/classes/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

context 'with defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to create_package('mongodb_client').with_ensure('present') }
if facts[:os]['release']['major'] =~ %r{(10)}
it { is_expected.to create_package('mongodb_client').with_ensure('4.4.8') }
else
it { is_expected.to create_package('mongodb_client').with_ensure('present') }
end
end

context 'with manage_package' do
Expand All @@ -16,7 +20,11 @@
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to create_package('mongodb_client').with_ensure('present').with_name('mongodb-org-shell').with_tag('mongodb_package') }
if facts[:os]['release']['major'] =~ %r{(10)}
it { is_expected.to create_package('mongodb_client').with_ensure('4.4.8').with_name('mongodb-org-shell').with_tag('mongodb_package') }
else
it { is_expected.to create_package('mongodb_client').with_ensure('present').with_name('mongodb-org-shell').with_tag('mongodb_package') }
end
end
end
end
Expand Down
19 changes: 16 additions & 3 deletions spec/classes/mongos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

case facts[:os]['family']
when 'Debian'
package_name = 'mongodb-server'
package_name = if facts[:os]['release']['major'] =~ %r{(10)}
'mongodb-org-mongos'
else
'mongodb-server'
end
config_file = '/etc/mongodb-shard.conf'
else
package_name = 'mongodb-org-mongos'
Expand All @@ -19,7 +23,11 @@

# install
it { is_expected.to contain_class('mongodb::mongos::install') }
it { is_expected.to contain_package('mongodb_mongos').with_ensure('present').with_name(package_name).with_tag('mongodb_package') }
if facts[:os]['release']['major'] =~ %r{(10)}
it { is_expected.to contain_package('mongodb_mongos').with_ensure('4.4.8').with_name(package_name).with_tag('mongodb_package') }
else
it { is_expected.to contain_package('mongodb_mongos').with_ensure('present').with_name(package_name).with_tag('mongodb_package') }
end

# config
it { is_expected.to contain_class('mongodb::mongos::config') }
Expand Down Expand Up @@ -79,7 +87,12 @@
end

it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('mongodb_mongos').with_name('mongo-foo').with_ensure('present').with_tag('mongodb_package') }

if facts[:os]['release']['major'] =~ %r{(10)}
it { is_expected.to contain_package('mongodb_mongos').with_name('mongo-foo').with_ensure('4.4.8').with_tag('mongodb_package') }
else
it { is_expected.to contain_package('mongodb_mongos').with_name('mongo-foo').with_ensure('present').with_tag('mongodb_package') }
end
end

context 'service_manage => false' do
Expand Down
10 changes: 8 additions & 2 deletions spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

let(:config_file) do
if facts[:os]['family'] == 'Debian'
'/etc/mongodb.conf'
if facts[:os]['release']['major'] =~ %r{(10)}
'/etc/mongod.conf'
else
'/etc/mongodb.conf'
end
else
'/etc/mongod.conf'
end
Expand All @@ -39,6 +43,8 @@

if facts[:os]['family'] == 'RedHat'
it { is_expected.to contain_package('mongodb_server').with_ensure('present').with_name('mongodb-org-server').with_tag('mongodb_package') }
elsif facts[:os]['release']['major'] =~ %r{(10)}
it { is_expected.to contain_package('mongodb_server').with_ensure('4.4.8').with_name('mongodb-org-server').with_tag('mongodb_package') }
else
it { is_expected.to contain_package('mongodb_server').with_ensure('present').with_name('mongodb-server').with_tag('mongodb_package') }
end
Expand Down Expand Up @@ -372,7 +378,7 @@
let(:rsConf) do
{
'rsTest' => {
'ensure' => 'present',
'ensure' => 'present',
'members' => [
'mongo1:27017',
'mongo2:27017',
Expand Down