From efd742c81f629d653b9d9a29a400f37d0a44dee9 Mon Sep 17 00:00:00 2001 From: Micah Anderson Date: Fri, 2 Sep 2011 16:31:32 -0400 Subject: the new version of dovecot (version 2) has a number of differences from version 1, so I added a $version class parameter (defaulting to 2) so we can have different configurations for the different versions. for version 2, debian does have different sql packages, so we test the above variable before attempting to install the packages, rather than test for the $operatingsystem in sql.pp --- manifests/init.pp | 1 + manifests/sql.pp | 28 ++++++++++++---------------- manifests/sql/mysql.pp | 8 +++++--- manifests/sql/pgsql.pp | 8 +++++--- manifests/sql/sqlite.pp | 8 +++++--- 5 files changed, 28 insertions(+), 25 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 09af028..de8259c 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -9,6 +9,7 @@ class dovecot( }, $munin_checks = true, $manage_shorewall = true + $version = 2 ){ case $operatingsystem { centos: { include dovecot::centos } diff --git a/manifests/sql.pp b/manifests/sql.pp index fc9a864..528fd94 100644 --- a/manifests/sql.pp +++ b/manifests/sql.pp @@ -11,21 +11,17 @@ class dovecot::sql { owner => root, group => 0, mode => 0600; } - case $operatingsystem { - centos: { - if $dovecot::mysql { - include ::dovecot::sql::mysql - } - if $dovecot::pgsql { - include ::dovecot::sql::pgsql - } - if $dovecot::sqlite { - include ::dovecot::sql::sqlite - } - } - debian: { - File['/etc/dovecot-sql.conf'] { path => '/etc/dovecot/dovecot-sql.conf' } - } - default: {} + if $dovecot::mysql { + include ::dovecot::sql::mysql + } + if $dovecot::pgsql { + include ::dovecot::sql::pgsql + } + if $dovecot::sqlite { + include ::dovecot::sql::sqlite + } + + if $operatingsystem == 'Debian' { + File['/etc/dovecot-sql.conf'] { path => '/etc/dovecot/dovecot-sql.conf' } } } diff --git a/manifests/sql/mysql.pp b/manifests/sql/mysql.pp index 95149d7..f4c1a4a 100644 --- a/manifests/sql/mysql.pp +++ b/manifests/sql/mysql.pp @@ -1,7 +1,9 @@ class dovecot::sql::mysql { - package { 'dovecot-mysql': - ensure => installed, - before => File['/etc/dovecot-sql.conf'], + if $version == 2 { + package { 'dovecot-mysql': + ensure => installed, + before => File['/etc/dovecot-sql.conf'], + } } } diff --git a/manifests/sql/pgsql.pp b/manifests/sql/pgsql.pp index 8fa2ae1..39f1b64 100644 --- a/manifests/sql/pgsql.pp +++ b/manifests/sql/pgsql.pp @@ -1,7 +1,9 @@ class dovecot::sql::pgsql { - package { 'dovecot-pgsql': - ensure => installed, - before => File['/etc/dovecot-sql.conf'], + if $version == 2 { + package { 'dovecot-pgsql': + ensure => installed, + before => File['/etc/dovecot-sql.conf'], + } } } diff --git a/manifests/sql/sqlite.pp b/manifests/sql/sqlite.pp index 5a2bb06..c2a848e 100644 --- a/manifests/sql/sqlite.pp +++ b/manifests/sql/sqlite.pp @@ -1,7 +1,9 @@ class dovecot::sql::sqlite { - package { 'dovecot-sqlite': - ensure => installed, - before => File['/etc/dovecot-sql.conf'], + if $version == 2 { + package { 'dovecot-sqlite': + ensure => installed, + before => File['/etc/dovecot-sql.conf'], + } } } -- cgit v1.2.3