From 74aaf446380e2244015e0f7330f5cab1631d1c43 Mon Sep 17 00:00:00 2001
From: Russ Allbery <rra@stanford.edu>
Date: Sun, 14 Jul 2013 16:09:35 -0700
Subject: [PATCH] Reformat base::postfix::map and improve examples

Reindent for our current indentation standards, and fix the examples
to use the correct URLs with the /modules component.
---
 manifests/postfix/map.pp | 81 ++++++++++++++++++++--------------------
 1 file changed, 40 insertions(+), 41 deletions(-)

diff --git a/manifests/postfix/map.pp b/manifests/postfix/map.pp
index 54b2195..77cf40a 100644
--- a/manifests/postfix/map.pp
+++ b/manifests/postfix/map.pp
@@ -2,14 +2,14 @@
 # postmap or postalias as needed.  Example for a map file:
 #
 #     base::postfix::map { '/etc/postfix/access/smtp':
-#         source => 'puppet:///s_emailrouter/etc/postfix/access/smtp',
+#       source => 'puppet:///modules/s_emailrouter/etc/postfix/access/smtp',
 #     }
 #
 # Example for an aliases file, which has to use a different command:
 #
 #     base::postfix::map { '/etc/postfix/aliases':
-#         command => 'postalias',
-#         source  => 'puppet:///s_nagios/etc/postfix/aliases',
+#       command => 'postalias',
+#       source  => 'puppet:///modules/s_nagios/etc/postfix/aliases',
 #     }
 #
 # Either source or content can be used with the map.
@@ -21,45 +21,44 @@
 # actually needs that.
 
 define base::postfix::map(
-    $ensure  = 'present',
-    $command = 'postmap',
-    $type    = 'hash',
-    $content = undef,
-    $source  = undef)
+  $ensure  = 'present',
+  $command = 'postmap',
+  $type    = 'hash',
+  $content = undef,
+  $source  = undef)
 {
-    if ($type != 'hash') and ($type != 'btree') {
-        crit "unknown Postfix map type $type"
-    }
+  if ($type != 'hash') and ($type != 'btree') {
+    crit "unknown Postfix map type $type"
+  }
 
-    file { $name:
-        ensure  => $ensure,
-        content => $content,
-        source  => $source,
-        notify  => Exec["${command} ${type}:${name}"],
-        require => Package['postfix'],
-    }
+  file { $name:
+    ensure  => $ensure,
+    content => $content,
+    source  => $source,
+    notify  => Exec["${command} ${type}:${name}"],
+    require => Package['postfix'],
+  }
 
-    # If ensure is absent, remove the detritus of our hash.
-    if ($ensure == 'absent') {
-        file { "${name}.db": ensure => $ensure }
-    } else {
-        # We have to define two commands here.  The first uses creates and is
-        # responsible for ensuring that the *.db file always exists (and is
-        # only defined if the type is hash).  The second is called by notify
-        # and is responsible for updating the hash when the source file
-        # changes.  We need both because a command with a creates stanza won't
-        # run even if notified if that file already exists.
-        exec { "${command} ${type}:${name} initial":
-            command => "${command} ${type}:${name}",
-            creates => "${name}.db",
-            require => [ File[$name], File['/etc/postfix/main.cf'],
-                         Package['postfix'] ],
-        }
-        exec { "${command} ${type}:${name}":
-            refreshonly => true,
-            command     => "${command} ${type}:${name}",
-            require     => [ File['/etc/postfix/main.cf'],
-                             Package['postfix'] ],
-        }
+  # If ensure is absent, remove the detritus of our hash.
+  if ($ensure == 'absent') {
+    file { "${name}.db": ensure => $ensure }
+  } else {
+    # We have to define two commands here.  The first uses creates and is
+    # responsible for ensuring that the *.db file always exists (and is only
+    # defined if the type is hash).  The second is called by notify and is
+    # responsible for updating the hash when the source file changes.  We need
+    # both because a command with a creates stanza won't run even if notified
+    # if that file already exists.
+    exec { "${command} ${type}:${name} initial":
+      command => "${command} ${type}:${name}",
+      creates => "${name}.db",
+      require => [ File[$name], File['/etc/postfix/main.cf'],
+                   Package['postfix'] ],
+    }
+    exec { "${command} ${type}:${name}":
+      refreshonly => true,
+      command     => "${command} ${type}:${name}",
+      require     => [ File['/etc/postfix/main.cf'], Package['postfix'] ],
     }
-}
\ No newline at end of file
+  }
+}
-- 
GitLab