Commit 4fdb6536 authored by Rurik Ylä-Onnenvuori's avatar Rurik Ylä-Onnenvuori Committed by Raphaël Pinson

Introduce new parameter 'config' for adding configuration using hiera (#240)

With configs hash user can define configuration values in hiera.
parent 1655262e
......@@ -31,6 +31,12 @@ A string defining the location of the alias map file.
Default: 'hash:/etc/aliases'.
Example: 'hash:/etc/other_aliases'.
##### `configs`
A hash containing optional configuration values for main.cf. The values are configured using postfix::config.
Default: An empty hash.
Example: '{message_size_limit': {'value': '51200000'}}.
##### `inet_interfaces`
A string defining the network interfaces that Postfix will listen on.
......
......@@ -8,6 +8,8 @@
#
# [*alias_maps*] - (string)
#
# [*configs*] - (hash)
#
# [*inet_interfaces*] - (string)
#
# [*inet_protocols*] - (string)
......@@ -84,6 +86,7 @@
#
class postfix (
String $alias_maps = 'hash:/etc/aliases',
Optional[Hash] $configs = {},
String $inet_interfaces = 'all',
String $inet_protocols = 'all',
Boolean $ldap = false,
......@@ -132,6 +135,8 @@ class postfix (
true => "${alias_maps}, ldap:/etc/postfix/ldap-aliases.cf",
}
create_resources('::postfix::config', $configs)
anchor { 'postfix::begin': }
-> class { '::postfix::packages': }
-> class { '::postfix::files': }
......
......@@ -302,6 +302,16 @@ describe 'postfix' do
is_expected.not_to contain_package('mailx')
end
end
context 'when config hash is used' do
let (:params) { {
:configs => {
'message_size_limit' => {
'value' => '51200000'
} } } }
it 'should update master.cf with the specified contents' do
is_expected.to contain_postfix__config('message_size_limit').with_value('51200000')
end
end
end
end
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment