Loading REFERENCE.md +9 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ The following parameters are available in the `postfix` class: * [`use_schleuder`](#-postfix--use_schleuder) * [`use_sympa`](#-postfix--use_sympa) * [`virtuals`](#-postfix--virtuals) * [`canonicals`](#-postfix--canonicals) ##### <a name="-postfix--alias_maps"></a>`alias_maps` Loading Loading @@ -657,6 +658,14 @@ A hash of postfix::virtual resources Default value: `{}` ##### <a name="-postfix--canonicals"></a>`canonicals` Data type: `Hash[String[1], Hash[String[1], Any]]` A hash of postfix::canonical resources Default value: `{}` ## Defined types ### <a name="postfix--canonical"></a>`postfix::canonical` Loading manifests/init.pp +10 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,9 @@ # @param virtuals # A hash of postfix::virtual resources # # @param canonicals # A hash of postfix::canonical resources # class postfix ( String $alias_maps = 'hash:/etc/aliases', Integer $amavis_procs = 2, Loading Loading @@ -318,6 +321,7 @@ class postfix ( Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder Boolean $use_sympa = false, # postfix_use_sympa Hash $virtuals = {}, Hash[String[1], Hash[String[1], Any]] $canonicals = {}, ) inherits postfix::params { if ( ($mastercf_source and $mastercf_content) or Loading Loading @@ -362,6 +366,12 @@ class postfix ( } } $canonicals.each |$key, $value| { postfix::canonical { $key: * => $value, } } $hashes.each |$key, $value| { postfix::hash { $key: * => $value, Loading spec/classes/postfix_spec.rb +25 −0 Original line number Diff line number Diff line Loading @@ -756,6 +756,31 @@ describe 'postfix' do end end context 'when canonicals hash is used' do # rubocop:disable RSpec/MultipleMemoizedHelpers let :pre_condition do "postfix::hash{'/etc/postfix/sender_canonical': ensure => present }" end let(:params) do { canonicals: { 'root' => { 'destination' => 'root_special@example.org', 'file' => '/etc/postfix/sender_canonical', }, 'adm' => { 'destination' => 'adm_special@example.org', 'file' => '/etc/postfix/sender_canonical', }, }, } end it 'updates the cannonical map' do is_expected.to contain_postfix__canonical('root').with_destination('root_special@example.org') is_expected.to contain_postfix__canonical('adm').with_file('/etc/postfix/sender_canonical') end end context 'when conffiles hash is used' do # rubocop:disable RSpec/MultipleMemoizedHelpers let(:params) do { Loading Loading
REFERENCE.md +9 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,7 @@ The following parameters are available in the `postfix` class: * [`use_schleuder`](#-postfix--use_schleuder) * [`use_sympa`](#-postfix--use_sympa) * [`virtuals`](#-postfix--virtuals) * [`canonicals`](#-postfix--canonicals) ##### <a name="-postfix--alias_maps"></a>`alias_maps` Loading Loading @@ -657,6 +658,14 @@ A hash of postfix::virtual resources Default value: `{}` ##### <a name="-postfix--canonicals"></a>`canonicals` Data type: `Hash[String[1], Hash[String[1], Any]]` A hash of postfix::canonical resources Default value: `{}` ## Defined types ### <a name="postfix--canonical"></a>`postfix::canonical` Loading
manifests/init.pp +10 −0 Original line number Diff line number Diff line Loading @@ -260,6 +260,9 @@ # @param virtuals # A hash of postfix::virtual resources # # @param canonicals # A hash of postfix::canonical resources # class postfix ( String $alias_maps = 'hash:/etc/aliases', Integer $amavis_procs = 2, Loading Loading @@ -318,6 +321,7 @@ class postfix ( Variant[Integer[2, 3], Boolean] $use_schleuder = false, # postfix_use_schleuder Boolean $use_sympa = false, # postfix_use_sympa Hash $virtuals = {}, Hash[String[1], Hash[String[1], Any]] $canonicals = {}, ) inherits postfix::params { if ( ($mastercf_source and $mastercf_content) or Loading Loading @@ -362,6 +366,12 @@ class postfix ( } } $canonicals.each |$key, $value| { postfix::canonical { $key: * => $value, } } $hashes.each |$key, $value| { postfix::hash { $key: * => $value, Loading
spec/classes/postfix_spec.rb +25 −0 Original line number Diff line number Diff line Loading @@ -756,6 +756,31 @@ describe 'postfix' do end end context 'when canonicals hash is used' do # rubocop:disable RSpec/MultipleMemoizedHelpers let :pre_condition do "postfix::hash{'/etc/postfix/sender_canonical': ensure => present }" end let(:params) do { canonicals: { 'root' => { 'destination' => 'root_special@example.org', 'file' => '/etc/postfix/sender_canonical', }, 'adm' => { 'destination' => 'adm_special@example.org', 'file' => '/etc/postfix/sender_canonical', }, }, } end it 'updates the cannonical map' do is_expected.to contain_postfix__canonical('root').with_destination('root_special@example.org') is_expected.to contain_postfix__canonical('adm').with_file('/etc/postfix/sender_canonical') end end context 'when conffiles hash is used' do # rubocop:disable RSpec/MultipleMemoizedHelpers let(:params) do { Loading