summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMicah Anderson <micah@riseup.net>2013-12-09 19:52:46 -0500
committerMicah Anderson <micah@riseup.net>2013-12-09 19:52:46 -0500
commit0c57b954d1b33da8d6b44bb45db0dd71dd929ee5 (patch)
tree886c01af08fc0905780c6977f8e3ba774ab955eb
parent9e3327c05f4cba6ea6d95b627599cbb61154dfd3 (diff)
some linting, and make the 'config_dir' name be more specifically 'dovecot_config_dir' to not be greedy in the namespace
-rw-r--r--manifests/base.pp48
-rw-r--r--manifests/config/file.pp126
2 files changed, 90 insertions, 84 deletions
diff --git a/manifests/base.pp b/manifests/base.pp
index 6960c8a..7eff064 100644
--- a/manifests/base.pp
+++ b/manifests/base.pp
@@ -1,40 +1,48 @@
class dovecot::base {
-
+
file { '/etc/dovecot.conf':
- source => [ "puppet:///modules/site_dovecot/config/${fqdn}/dovecot.conf",
- "puppet:///modules/site_dovecot/config/${dovecot::type}/dovecot.conf",
- "puppet:///modules/site_dovecot/config/dovecot.conf",
- "puppet:///modules/dovecot/config/${operatingsystem}/dovecot.conf",
- "puppet:///modules/dovecot/config/dovecot.conf" ],
+ source => [ "puppet:///modules/site_dovecot/config/${::fqdn}/dovecot.conf",
+ "puppet:///modules/site_dovecot/config/${::dovecot::type}/dovecot.conf",
+ 'puppet:///modules/site_dovecot/config/dovecot.conf',
+ "puppet:///modules/dovecot/config/${::operatingsystem}/dovecot.conf",
+ 'puppet:///modules/dovecot/config/dovecot.conf' ],
require => Package['dovecot'],
- notify => Service['dovecot'],
- owner => root, group => mail, mode => 0640;
+ notify => Service['dovecot'],
+ owner => root,
+ group => mail,
+ mode => '0640';
}
-
- file { 'config_dir':
- path => '/etc/dovecot/conf.d',
- ensure => directory,
+
+ file { 'dovecot_config_dir':
+ ensure => directory,
+ path => '/etc/dovecot/conf.d',
require => Package['dovecot'],
- owner => dovecot, group => 0, mode => 0755;
+ owner => dovecot,
+ group => 0,
+ mode => '0755';
}
file {
'/var/log/dovecot':
- ensure => directory,
+ ensure => directory,
require => Package['dovecot'],
- before => Service['dovecot'],
- owner => dovecot, group => dovecot, mode => 0750;
+ before => Service['dovecot'],
+ owner => dovecot,
+ group => dovecot,
+ mode => '0750';
[ '/var/log/dovecot/error.log',
'/var/log/dovecot/dovecot.log' ]:
require => Package['dovecot'],
- before => Service['dovecot'],
- owner => root, group => dovecot, mode => 0660;
+ before => Service['dovecot'],
+ owner => root,
+ group => dovecot,
+ mode => '0660';
}
-
+
package { 'dovecot':
- alias => 'dovecot',
ensure => installed,
+ alias => 'dovecot'
}
include dovecot::logrotate
diff --git a/manifests/config/file.pp b/manifests/config/file.pp
index 0fe777f..e6e93c3 100644
--- a/manifests/config/file.pp
+++ b/manifests/config/file.pp
@@ -7,72 +7,70 @@ define dovecot::config::file (
$owner = 'absent',
$group = 'absent'
)
- {
+{
- # the default destination is 'absent', so if the user doesn't specify a
- # destination, then we use the following defaults. If different systems
- # implement different locations, we can trigger here off of operatingsystem
- # and change the 'config_dir' path in base.pp to just be /etc/dovecot
- $real_destination = $destination ? {
- 'absent' => "/etc/dovecot/conf.d/${name}",
- default => $destination
- }
+ # the default destination is 'absent', so if the user doesn't specify a
+ # destination, then we use the following defaults. If different systems
+ # implement different locations, we can trigger here off of operatingsystem
+ # and change the 'dovecot_config_dir' path in base.pp to just be /etc/dovecot
+ $real_destination = $destination ? {
+ 'absent' => "/etc/dovecot/conf.d/${name}",
+ default => $destination
+ }
- $real_mode = $mode ? {
- 'absent' => 0640,
- default => $mode
- }
+ $real_mode = $mode ? {
+ 'absent' => 0640,
+ default => $mode
+ }
- $real_owner = $owner ? {
- 'absent' => root,
- default => $owner
- }
+ $real_owner = $owner ? {
+ 'absent' => root,
+ default => $owner
+ }
- $real_group = $group ? {
- 'absent' => 0,
- default => $group
- }
-
- # the $name variable is set to dovecot_${name}, but the actual filename will
- # be set to $name
- file { "dovecot_${name}":
- ensure => $ensure,
- path => $real_destination,
- notify => Service[dovecot],
- owner => $real_owner, group => $real_group, mode => $real_mode;
- }
+ $real_group = $group ? {
+ 'absent' => 0,
+ default => $group
+ }
- # the $content variable is 'absent' by default, so if the user doesn't
- # specify anything for $content, then the following will be used, searching
- # from the first source line until a file is found that matches. We use the
- # standard search prioritizing the site_dovecot module first
- case $content {
- 'absent': {
- $real_source = $source ? {
- 'absent' => [
- "puppet:///modules/site_dovecot/config/${fqdn}/${name}",
- "puppet:///modules/site_dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
- "puppet:///modules/site_dovecot/config/${operatingsystem}/${name}",
- "puppet:///modules/site_dovecot/config/${name}",
- "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
- "puppet:///modules/dovecot/config/${operatingsystem}/${name}",
- "puppet:///modules/dovecot/config/${name}"
- ],
- default => "puppet:///${source}",
- }
- File["dovecot_${name}"]{
- source => $real_source,
- }
- }
- default: {
- File["dovecot_${name}"]{
- content => $content,
- }
- }
- }
- File["dovecot_${name}"]{
- require => Package[dovecot],
- }
- }
-
-
+ # the $name variable is set to dovecot_${name}, but the actual filename will
+ # be set to $name
+ file { "dovecot_${name}":
+ ensure => $ensure,
+ path => $real_destination,
+ notify => Service[dovecot],
+ owner => $real_owner, group => $real_group, mode => $real_mode;
+ }
+
+ # the $content variable is 'absent' by default, so if the user doesn't
+ # specify anything for $content, then the following will be used, searching
+ # from the first source line until a file is found that matches. We use the
+ # standard search prioritizing the site_dovecot module first
+ case $content {
+ 'absent': {
+ $real_source = $source ? {
+ 'absent' => [
+ "puppet:///modules/site_dovecot/config/${fqdn}/${name}",
+ "puppet:///modules/site_dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
+ "puppet:///modules/site_dovecot/config/${operatingsystem}/${name}",
+ "puppet:///modules/site_dovecot/config/${name}",
+ "puppet:///modules/dovecot/config/${operatingsystem}/${lsbdistcodename}/${name}",
+ "puppet:///modules/dovecot/config/${operatingsystem}/${name}",
+ "puppet:///modules/dovecot/config/${name}"
+ ],
+ default => "puppet:///${source}",
+ }
+ File["dovecot_${name}"]{
+ source => $real_source,
+ }
+ }
+ default: {
+ File["dovecot_${name}"]{
+ content => $content,
+ }
+ }
+ }
+ File["dovecot_${name}"]{
+ require => Package[dovecot],
+ }
+}