Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
9a68a73
Merge branch 'fix-upstream'
fbrehm Aug 31, 2018
fb99370
Version bump to 2.3.2
fbrehm Aug 31, 2018
9dac807
Merge branch 'fix-upstream'
fbrehm Sep 3, 2018
45db478
Version bump to 2.3.3
fbrehm Sep 3, 2018
0e24528
Merge branch 'upstream'
fbrehm Oct 8, 2018
6f9497e
Updating module version
fbrehm Oct 8, 2018
e036161
Merge tag 'v4.0.0' into fix-upstream
fbrehm Sep 7, 2021
3071da4
Adding manifests/repo/zypper.pp
fbrehm Sep 7, 2021
757ef00
Support of Suse zypper repos
fbrehm Sep 7, 2021
18b4269
Merge branch 'fix-upstream'
fbrehm Sep 7, 2021
848c840
Fixing manifests/repo.pp
fbrehm Sep 7, 2021
9b1122b
Version bump to 4.0.0.2
fbrehm Sep 7, 2021
a28348c
Merge branch 'fix-upstream'
fbrehm Sep 7, 2021
da5b682
Version bump to 4.0.1-rc0
fbrehm Sep 7, 2021
7b9677f
Setting version to 4.0.0
fbrehm Sep 20, 2021
12144ce
Adding SLES 12 and 15 as a supported operating system
fbrehm Sep 20, 2021
b859e3b
Setting supported version for Enterprise Linux to 3.0
fbrehm Sep 20, 2021
e16118f
Adding dependency to puppet/zypprepo
fbrehm Sep 20, 2021
06c8e44
Updating spec test for Suse
fbrehm Sep 20, 2021
605c40f
Fixing spec tests for Suse
fbrehm Sep 20, 2021
6748333
Style changes
fbrehm Sep 20, 2021
99dd8ac
Fixing package in manifests/mongos/params.pp for Suse
fbrehm Sep 20, 2021
3956fd6
Fixing config in manifests/mongos/config.pp for Suse
fbrehm Sep 20, 2021
7a293f7
Making fork on package purge for Suse
fbrehm Sep 20, 2021
22ce01a
Fixing Repo base_url for zypper
fbrehm Sep 20, 2021
61d34cd
Fixing spec/classes/repo_spec.rb for Suse
fbrehm Sep 20, 2021
2d2a584
Changing two elsifs to one
fbrehm Oct 28, 2021
f09d237
Simplifying logic in manifests/repo.pp
fbrehm Oct 28, 2021
8c008c1
Adding puppet strings documentation to manifests/repo/zypper.pp and d…
fbrehm Oct 28, 2021
106dc49
Update metadata.json
fbrehm Oct 28, 2021
cd1f749
Make the linter happy
fbrehm Oct 28, 2021
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
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fixtures:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
"apt": "git://github.com/puppetlabs/puppetlabs-apt.git"
"systemd": "https://github.com/voxpupuli/puppet-systemd.git"
"zypprepo": "https://github.com/voxpupuli/puppet-zypprepo.git"
yumrepo_core:
repo: https://github.com/puppetlabs/puppetlabs-yumrepo_core.git
puppet_version: ">= 6.0.0"
2 changes: 1 addition & 1 deletion manifests/mongos/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
}

if $service_manage {
if $facts['os']['family'] == 'RedHat' {
if $facts['os']['family'] == 'RedHat' or $facts['os']['family'] == 'Suse' {
file { '/etc/sysconfig/mongos' :
ensure => $ensure,
owner => 'root',
Expand Down
8 changes: 7 additions & 1 deletion manifests/mongos/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,15 @@
$package_ensure = $mongodb::mongos::package_ensure,
$package_name = $mongodb::mongos::package_name,
) {
if $facts['os']['family'] == 'Suse' and $package_ensure == 'purged' {
$_package_ensure = 'absent'
} else {
$_package_ensure = $package_ensure
}

unless defined(Package[$package_name]) {
package { 'mongodb_mongos':
ensure => $package_ensure,
ensure => $_package_ensure,
Comment thread
fbrehm marked this conversation as resolved.
name => $package_name,
tag => 'mongodb_package',
}
Expand Down
2 changes: 1 addition & 1 deletion manifests/mongos/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$package_ensure = pick($version, 'present')
if $manage_package {
$package_name = "mongodb-${mongodb::globals::edition}-mongos"
} elsif $facts['os']['family'] == 'RedHat' {
} elsif $facts['os']['family'] in ['RedHat', 'Suse'] {
$package_name = "mongodb-${mongodb::globals::edition}-mongos"
} else {
$package_name = 'mongodb-server'
Expand Down
17 changes: 16 additions & 1 deletion manifests/repo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@
contain mongodb::repo::yum
}

'Suse': {
if $repo_location {
$location = $repo_location
$description = 'MongoDB Custom Repository'
} elsif $version == undef or versioncmp($version, '3.2.0') < 0 {
fail('Package repositories for versions older than 3.2 are unsupported')
} else {
$mongover = split($version, '[.]')
$location = "https://repo.mongodb.org/zypper/suse/\$releasever_major/mongodb-org/${mongover[0]}.${mongover[1]}/\$basearch/"
$description = 'MongoDB Repository'
}

contain mongodb::repo::zypper
}

'Debian': {
if $repo_location != undef {
$location = $repo_location
Expand Down Expand Up @@ -73,7 +88,7 @@

default: {
if($ensure == 'present' or $ensure == true) {
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']}, module ${module_name} currently only supports managing repos for osfamily RedHat, Debian and Ubuntu")
fail("Unsupported managed repository for osfamily: ${facts['os']['family']}, operatingsystem: ${facts['os']['name']}, module ${module_name} currently only supports managing repos for osfamily RedHat, Suse, Debian and Ubuntu")
}
}
}
Expand Down
31 changes: 31 additions & 0 deletions manifests/repo/zypper.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# PRIVATE CLASS: do not use directly
Comment thread
fbrehm marked this conversation as resolved.
#
# @summary This is a repo class for zypper
#
# This is a private class and cannot be used from outside this module.
#
# @author Frank Brehm <frank@brehm-online.com>
#
# @api private
#
class mongodb::repo::zypper inherits mongodb::repo {
# We try to follow/reproduce the instruction
# http://docs.mongodb.org/manual/tutorial/install-mongodb-on-red-hat-centos-or-fedora-linux/

Comment thread
fbrehm marked this conversation as resolved.
assert_private()

if $mongodb::repo::ensure == 'present' or $mongodb::repo::ensure == true {
zypprepo { 'mongodb':
descr => $mongodb::repo::description,
baseurl => $mongodb::repo::location,
gpgcheck => '0',
enabled => '1',
}
Zypprepo['mongodb'] -> Package<| tag == 'mongodb_package' |>
}
else {
zypprepo { 'mongodb':
ensure => absent,
}
}
}
11 changes: 11 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
"18.04",
"20.04"
]
},
{
"operatingsystem": "SLES",
"operatingsystemrelease": [
"12",
"15"
]
}
],
"requirements": [
Expand All @@ -53,6 +60,10 @@
{
"name": "puppet/systemd",
"version_requirement": ">= 2.5.1 < 4.0.0"
},
{
"name": "puppet/zypprepo",
"version_requirement": ">= 4.0.1 < 6.0.0"
}
]
}
14 changes: 9 additions & 5 deletions spec/classes/mongos_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
it { is_expected.to contain_class('mongodb::mongos::config') }

case facts[:osfamily]
when 'RedHat'
when 'RedHat', 'Suse'
expected_content = <<-CONFIG
configdb = 127.0.0.1:27019
fork = true
Expand All @@ -54,7 +54,7 @@
# service
it { is_expected.to contain_class('mongodb::mongos::service') }

if facts[:osfamily] == 'RedHat'
if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'Suse'
it { is_expected.to contain_file('/etc/sysconfig/mongos') }
else
it { is_expected.not_to contain_file('/etc/sysconfig/mongos') }
Expand Down Expand Up @@ -119,19 +119,23 @@

# install
it { is_expected.to contain_class('mongodb::mongos::install') }
it { is_expected.to contain_package('mongodb_mongos').with_ensure('purged') }
if facts[:osfamily] == 'Suse'
it { is_expected.to contain_package('mongodb_mongos').with_ensure('absent') }
else
it { is_expected.to contain_package('mongodb_mongos').with_ensure('purged') }
end

# config
it { is_expected.to contain_class('mongodb::mongos::config') }

case facts[:osfamily]
when 'RedHat'
when 'RedHat', 'Suse'
it { is_expected.to contain_file('/etc/mongos.conf').with_ensure('absent') }
when 'Debian'
it { is_expected.to contain_file('/etc/mongodb-shard.conf').with_ensure('absent') }
end

if facts[:osfamily] == 'RedHat'
if facts[:osfamily] == 'RedHat' || facts[:osfamily] == 'Suse'
it { is_expected.to contain_file('/etc/sysconfig/mongos').with_ensure('absent') }
else
it { is_expected.not_to contain_file('/etc/sysconfig/mongos') }
Expand Down
8 changes: 8 additions & 0 deletions spec/classes/repo_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
is_expected.to contain_yumrepo('mongodb').
with_baseurl('https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/3.6/$basearch/')
end
when 'Suse'
it { is_expected.to contain_class('mongodb::repo::zypper') }
it do
is_expected.to contain_zypprepo('mongodb').
with_baseurl('https://repo.mongodb.org/zypper/suse/$releasever_major/mongodb-org/3.6/$basearch/')
end
when 'Debian'
it { is_expected.to contain_class('mongodb::repo::apt') }
case facts[:operatingsystem]
Expand Down Expand Up @@ -66,6 +72,8 @@
with_proxy_username('proxyuser1').
with_proxy_password('proxypassword1')
end
when 'Suse'
it { is_expected.to contain_class('mongodb::repo::zypper') }
when 'Debian'
it { is_expected.to contain_class('mongodb::repo::apt') }
else
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/server_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
describe 'with defaults' do
it_behaves_like 'server classes'

if facts[:os]['family'] == 'RedHat'
if facts[:os]['family'] == 'RedHat' || facts[:os]['family'] == 'Suse'
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') }
Expand Down