summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvarac <varacanero@zeromail.org>2015-10-14 18:23:31 +0200
committervarac <varacanero@zeromail.org>2015-10-14 18:27:00 +0200
commitd077a7b11c95089882e08432c45b883a9097e81d (patch)
tree0a6ff28331f9b43382c6f7a3d758556aeba497d7
parentae53b180783016faa4331094a52769ddd57463f8 (diff)
[feat] Use ensure_packages() instead of package{}
The rationale behind this is that many modules might ensure the same packages to be installed, and this will result in duplicate package definitions. ensure_packages() from the stdlib module with solve this. - Resolves: #7530
-rw-r--r--manifests/backup.pp8
-rw-r--r--manifests/base.pp14
-rw-r--r--manifests/debian.pp5
-rw-r--r--manifests/init.pp7
-rw-r--r--manifests/ssl/generate_cert.pp5
5 files changed, 17 insertions, 22 deletions
diff --git a/manifests/backup.pp b/manifests/backup.pp
index 6eb48c5..a477b5b 100644
--- a/manifests/backup.pp
+++ b/manifests/backup.pp
@@ -1,3 +1,4 @@
+# configure backup using couchdb-backup.py
class couchdb::backup {
include couchdb::params
@@ -32,10 +33,9 @@ class couchdb::backup {
case $::operatingsystem {
/Debian|Ubunu/: {
# note: python-couchdb >= 0.8 required, which is found in debian wheezy.
- package { ['python-couchdb', 'python-simplejson']:
- ensure => present,
- before => File['/usr/local/sbin/couchdb-backup.py'],
- }
+ ensure_packages (['python-couchdb', 'python-simplejson'], {
+ before => File['/usr/local/sbin/couchdb-backup.py']
+ })
}
/RedHat|Centos/: {
exec {'install python-couchdb using easy_install':
diff --git a/manifests/base.pp b/manifests/base.pp
index f738e26..66c80ad 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -8,9 +8,7 @@ class couchdb::base {
$couchdb_user = 'couchdb'
}
- package { 'couchdb':
- ensure => present
- }
+ ensure_packages ('couchdb')
service { 'couchdb':
ensure => running,
@@ -28,15 +26,13 @@ class couchdb::base {
# couchrest gem is required for couch-doc-update script,
# and it needs the ruby-dev package installed to build
- class {'::ruby':
- install_dev => true
- }
+ #include ruby::devel
- package { 'couchrest':
- ensure => installed,
+ ensure_packages('ruby-dev')
+ ensure_packages('couchrest', {
provider => 'gem',
require => Package['ruby-dev']
- }
+ })
File['/usr/local/bin/couch-doc-update'] -> Couchdb::Update <| |>
File['/usr/local/bin/couch-doc-diff'] -> Couchdb::Update <| |>
diff --git a/manifests/debian.pp b/manifests/debian.pp
index 535551a..b83b227 100644
--- a/manifests/debian.pp
+++ b/manifests/debian.pp
@@ -1,8 +1,7 @@
+# installs initscript and dependent packages on debian
class couchdb::debian inherits couchdb::base {
- package { 'libjs-jquery':
- ensure => present,
- }
+ ensure_packages('libjs-jquery')
file { '/etc/init.d/couchdb':
source => [
diff --git a/manifests/init.pp b/manifests/init.pp
index cbddcf1..7ff9ed3 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -8,6 +8,9 @@ class couchdb (
$pwhash_alg = 'sha1' )
{
+ # stdlib is needed i.e. for ensure_packages()
+ include ::stdlib
+
case $::operatingsystem {
Debian: {
case $::lsbdistcodename {
@@ -23,7 +26,5 @@ class couchdb (
RedHat: { include couchdb::redhat }
}
- package { 'curl':
- ensure => installed,
- }
+ ensure_packages('curl')
}
diff --git a/manifests/ssl/generate_cert.pp b/manifests/ssl/generate_cert.pp
index 3d500ac..a443250 100644
--- a/manifests/ssl/generate_cert.pp
+++ b/manifests/ssl/generate_cert.pp
@@ -1,8 +1,7 @@
+# configures cert for ssl access
class couchdb::ssl::generate_cert {
- package { ['openssl']:
- ensure => 'installed',
- }
+ ensure_packages('openssl')
file { $couchdb::cert_path:
ensure => 'directory',