Loading manifests/init.pp +10 −1 Original line number Diff line number Diff line Loading @@ -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) Loading Loading @@ -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', Loading Loading @@ -200,6 +203,12 @@ class postfix ( } } $maps.each |$key, $value| { postfix::map { $key: * => $value, } } contain 'postfix::packages' contain 'postfix::files' contain 'postfix::service' Loading spec/classes/postfix_spec.rb +23 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading Loading @@ -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 Loading Loading
manifests/init.pp +10 −1 Original line number Diff line number Diff line Loading @@ -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) Loading Loading @@ -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', Loading Loading @@ -200,6 +203,12 @@ class postfix ( } } $maps.each |$key, $value| { postfix::map { $key: * => $value, } } contain 'postfix::packages' contain 'postfix::files' contain 'postfix::service' Loading
spec/classes/postfix_spec.rb +23 −4 Original line number Diff line number Diff line Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading @@ -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 Loading Loading @@ -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 Loading