Skip to content
This repository was archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #63 from gpenaud/mongo3_upstream_repository_for_de…
Browse files Browse the repository at this point in the history
…bian

 Add upstream repository compatibility for debian (version 3.0.x)
  • Loading branch information
dwerder committed Jan 18, 2016
2 parents 21b6930 + 034e216 commit 13e07c7
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 14 deletions.
3 changes: 1 addition & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
enable => false,
hasstatus => true,
hasrestart => true,
subscribe => Package['mongodb-10gen'],
subscribe => Package['mongodb-package'],
before => Anchor['mongodb::end'],
}

Expand Down Expand Up @@ -78,4 +78,3 @@
}

}

6 changes: 3 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
before => Anchor['mongodb::install::end']
}

package { 'mongodb-10gen':
package { 'mongodb-package':
ensure => $package_ensure,
name => $::mongodb::package_name,
name => $::mongodb::repos::apt::package_name,
require => $mongodb_10gen_package_require,
before => Anchor['mongodb::install::end']
before => [Anchor['mongodb::install::end']]
}

}
51 changes: 42 additions & 9 deletions manifests/repos/apt.pp
Original file line number Diff line number Diff line change
@@ -1,17 +1,50 @@
# == class mongodb::repos::apt
class mongodb::repos::apt {
$source_location = $::operatingsystem ? {
'Ubuntu' => 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart',
default => 'http://downloads-distro.mongodb.org/repo/debian-sysvinit',
class mongodb::repos::apt (
$package_ensure = $::mongodb::package_ensure,
) {

# define ordering
Class['mongodb::repos::apt']
-> Class['apt::update']
-> Package<| title == 'mongo' |>

if (($package_ensure =~ /(\d+\.*)+\d/) and (versioncmp($package_ensure, '3.0.0') >= 0)) {
$mongover = split($package_ensure, '[.]')
$package_name = 'mongodb-org'

case $::operatingsystem {
'Debian': {
$location = 'http://repo.mongodb.org/apt/debian'
$repos = 'main'
# FIXME: for the moment only Debian 'Wheezy' is supported
$release = "wheezy/mongodb-org/${$mongover[0]}.${$mongover[1]}"
}
'Ubuntu': {
$location = 'http://repo.mongodb.org/apt/ubuntu'
$release = "${::lsbdistcodename}/mongodb-org/${$mongover[0]}.${$mongover[1]}"
$repos = 'multiverse'
}
default: {
fail("Unsupported managed repository for operatingsystem: ${::operatingsystem}, module ${::module_name} currently only supports managing repos for operatingsystem Debian and Ubuntu")
}
}
} else {
$location = $::operatingsystem ? {
'Ubuntu' => 'http://downloads-distro.mongodb.org/repo/ubuntu-upstart',
default => 'http://downloads-distro.mongodb.org/repo/debian-sysvinit',
}

$package_name = 'mongodb-10gen'
$release = 'dist'
$repos = '10gen'
}

apt::source{ '10gen':
location => $source_location,
release => 'dist',
repos => '10gen',
apt::source{ 'mongodb-source':
location => $location,
release => $release,
repos => $repos,
key => '492EAFE8CD016A07919F1D2B9ECBEC467F0CEB10',
key_server => 'keyserver.ubuntu.com',
include_src => false,
}
}

0 comments on commit 13e07c7

Please sign in to comment.