Unverified Commit b9b9011a authored by Kenyon Ralph's avatar Kenyon Ralph Committed by GitHub
Browse files

Merge pull request #316 from kenyon/hiera-maps

allow creation of postfix::map resources with hiera
parents 9c9b9764 7f0b8849
Loading
Loading
Loading
Loading
+10 −1
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'
+23 −4
Original line number Diff line number Diff line
@@ -486,7 +486,7 @@ describe 'postfix' do
              }
            end

            it 'updates master.cf with the specified contents' do
            it 'updates main.cf with the specified contents' do
              is_expected.to contain_postfix__config('message_size_limit').with_value('51200000')
            end
          end
@@ -501,7 +501,7 @@ describe 'postfix' do
              }
            end

            it 'updates master.cf with the specified contents' do
            it 'creates the hash' do
              is_expected.to contain_postfix__hash('/etc/postfix/transport').with_ensure('present')
            end
          end
@@ -516,7 +516,7 @@ describe 'postfix' do
              }
            end

            it 'updates master.cf with the specified contents' do
            it 'updates the transport map' do
              is_expected.to contain_postfix__transport('local_relay').with_nexthop('[10.12.0.2]:9925')
            end
          end
@@ -531,7 +531,7 @@ describe 'postfix' do
              }
            end

            it 'updates master.cf with the specified contents' do
            it 'updates the virtual map' do
              is_expected.to contain_postfix__virtual('someone@somedomain.tld').with_destination('internal@ourdomain.tld')
            end
          end
@@ -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