Unverified Commit 7f0b8849 authored by Kenyon Ralph's avatar Kenyon Ralph
Browse files

init.pp: allow creation of postfix::map resources with hiera

parent 35dae1f6
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@
#
# [*conffiles*]           - (hash) A hash of postfix::conffile resources
#
# [*maps*]                - (hash) A hash of postfix::map resources
#
# [*amavis_procs*]        - (integer) Number of amavis scanners to spawn
#
# [*inet_interfaces*]     - (string)
@@ -111,6 +113,7 @@ class postfix (
  Hash                            $transports          = {},
  Hash                            $virtuals            = {},
  Hash                            $conffiles           = {},
  Hash                            $maps                = {},
  Integer                         $amavis_procs        = 2,
  String                          $inet_interfaces     = 'all',
  String                          $inet_protocols      = 'all',
@@ -200,6 +203,12 @@ class postfix (
    }
  }

  $maps.each |$key, $value| {
    postfix::map { $key:
      * => $value,
    }
  }

  contain 'postfix::packages'
  contain 'postfix::files'
  contain 'postfix::service'
+19 −0
Original line number Diff line number Diff line
@@ -570,6 +570,25 @@ describe 'postfix' do
              )
            end
          end
          context 'when maps hash is used' do
            let(:params) do
              {
                maps: {
                  'a_map' => {
                    'type' => 'regexp',
                    'content' => 'abc xyz',
                  },
                },
              }
            end

            it 'creates the map resource' do
              is_expected.to contain_postfix__map('a_map').with(
                'type' => 'regexp',
                'content' => 'abc xyz'
              )
            end
          end
        end
      end
    end