Loading manifests/files.pp +9 −3 Changes for manifests/files.pp: 9 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ class postfix::files { $manage_conffiles = $postfix::manage_conffiles $maincf_source = $postfix::maincf_source $mastercf_source = $postfix::mastercf_source $mastercf_content = $postfix::mastercf_content $mastercf_template = $postfix::mastercf_template $master_smtp = $postfix::master_smtp $master_smtps = $postfix::master_smtps $master_submission = $postfix::master_submission Loading Loading @@ -58,9 +60,13 @@ class postfix::files { # Config files if $mastercf_source { $mastercf_content = undef $_mastercf_content = undef } elsif $mastercf_content { $_mastercf_content = $mastercf_content } elsif $mastercf_template { $_mastercf_content = epp($mastercf_template) } else { $mastercf_content = template( $_mastercf_content = template( $postfix::params::master_os_template, 'postfix/master.cf.common.erb' ) Loading @@ -68,7 +74,7 @@ class postfix::files { file { '/etc/postfix/master.cf': ensure => 'file', content => $mastercf_content, content => $_mastercf_content, group => 'root', mode => '0644', owner => 'root', Loading manifests/init.pp +13 −0 Changes for manifests/init.pp: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ # # [*mastercf_source*] - (string) # # [*mastercf_content*] - (string) # # [*mastercf_template*] - (string) # # [*master_smtp*] - (string) # # [*master_smtps*] - (string) Loading Loading @@ -101,6 +105,8 @@ class postfix ( Boolean $manage_conffiles = true, Boolean $manage_mailx = true, Optional[String] $mastercf_source = undef, Optional[String] $mastercf_content = undef, Optional[String] $mastercf_template = undef, Optional[String] $master_smtp = undef, # postfix_master_smtp Optional[String] $master_smtps = undef, # postfix_master_smtps Optional[String] $master_submission = undef, # postfix_master_submission Loading Loading @@ -128,6 +134,13 @@ class postfix ( Boolean $service_enabled = true, ) inherits postfix::params { if (($mastercf_source and $mastercf_content) or ($mastercf_source and $mastercf_template) or ($mastercf_content and $mastercf_template) or ($mastercf_source and $mastercf_content and $mastercf_template)){ fail('mastercf_source, mastercf_content and mastercf_template are mutually exclusive') } $_smtp_listen = $mailman ? { true => '0.0.0.0', default => $smtp_listen, Loading spec/classes/postfix_spec.rb +53 −0 Changes for spec/classes/postfix_spec.rb: 53 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -221,6 +221,59 @@ describe 'postfix' do skip 'need to write this still' end end context 'when specifying a custom mastercf_content' do let (:params) { { :mastercf_content => 'testy' } } it 'should do stuff' do skip 'need to write this still' end end context 'when specifying a custom mastercf_template' do let (:params) { { :mastercf_template => 'testy' } } it 'should do stuff' do skip 'need to write this still' end end context 'when specifying a custom mastercf_source and mastercf_content' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_content => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom mastercf_source and mastercf_template' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_template => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom mastercf_content and mastercf_template' do let (:params) { { :mastercf_content => 'testy_1' , :mastercf_template => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a mastercf_source and custom mastercf_content and mastercf_template' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_content => 'testy_2' , :mastercf_template => 'testy_3' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom master_smtp' do let(:params) do { Loading Loading
manifests/files.pp +9 −3 Changes for manifests/files.pp: 9 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -8,6 +8,8 @@ class postfix::files { $manage_conffiles = $postfix::manage_conffiles $maincf_source = $postfix::maincf_source $mastercf_source = $postfix::mastercf_source $mastercf_content = $postfix::mastercf_content $mastercf_template = $postfix::mastercf_template $master_smtp = $postfix::master_smtp $master_smtps = $postfix::master_smtps $master_submission = $postfix::master_submission Loading Loading @@ -58,9 +60,13 @@ class postfix::files { # Config files if $mastercf_source { $mastercf_content = undef $_mastercf_content = undef } elsif $mastercf_content { $_mastercf_content = $mastercf_content } elsif $mastercf_template { $_mastercf_content = epp($mastercf_template) } else { $mastercf_content = template( $_mastercf_content = template( $postfix::params::master_os_template, 'postfix/master.cf.common.erb' ) Loading @@ -68,7 +74,7 @@ class postfix::files { file { '/etc/postfix/master.cf': ensure => 'file', content => $mastercf_content, content => $_mastercf_content, group => 'root', mode => '0644', owner => 'root', Loading
manifests/init.pp +13 −0 Changes for manifests/init.pp: 13 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -34,6 +34,10 @@ # # [*mastercf_source*] - (string) # # [*mastercf_content*] - (string) # # [*mastercf_template*] - (string) # # [*master_smtp*] - (string) # # [*master_smtps*] - (string) Loading Loading @@ -101,6 +105,8 @@ class postfix ( Boolean $manage_conffiles = true, Boolean $manage_mailx = true, Optional[String] $mastercf_source = undef, Optional[String] $mastercf_content = undef, Optional[String] $mastercf_template = undef, Optional[String] $master_smtp = undef, # postfix_master_smtp Optional[String] $master_smtps = undef, # postfix_master_smtps Optional[String] $master_submission = undef, # postfix_master_submission Loading Loading @@ -128,6 +134,13 @@ class postfix ( Boolean $service_enabled = true, ) inherits postfix::params { if (($mastercf_source and $mastercf_content) or ($mastercf_source and $mastercf_template) or ($mastercf_content and $mastercf_template) or ($mastercf_source and $mastercf_content and $mastercf_template)){ fail('mastercf_source, mastercf_content and mastercf_template are mutually exclusive') } $_smtp_listen = $mailman ? { true => '0.0.0.0', default => $smtp_listen, Loading
spec/classes/postfix_spec.rb +53 −0 Changes for spec/classes/postfix_spec.rb: 53 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -221,6 +221,59 @@ describe 'postfix' do skip 'need to write this still' end end context 'when specifying a custom mastercf_content' do let (:params) { { :mastercf_content => 'testy' } } it 'should do stuff' do skip 'need to write this still' end end context 'when specifying a custom mastercf_template' do let (:params) { { :mastercf_template => 'testy' } } it 'should do stuff' do skip 'need to write this still' end end context 'when specifying a custom mastercf_source and mastercf_content' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_content => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom mastercf_source and mastercf_template' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_template => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom mastercf_content and mastercf_template' do let (:params) { { :mastercf_content => 'testy_1' , :mastercf_template => 'testy_2' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a mastercf_source and custom mastercf_content and mastercf_template' do let (:params) { { :mastercf_source => 'testy_1' , :mastercf_content => 'testy_2' , :mastercf_template => 'testy_3' } } it 'should fail' do expect { should compile }.to raise_error(/mutually exclusive/) end end context 'when specifying a custom master_smtp' do let(:params) do { Loading