-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: op-ct <[email protected]>
- Loading branch information
1 parent
a26dc1a
commit 36fba1b
Showing
5 changed files
with
39 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
* Tue Aug 02 2022 Mike Riddle <[email protected]> - 5.7.0 | ||
- Added the ability for users to specify aliases via hieradata | ||
|
||
* Wed Jun 16 2021 Chris Tessmer <[email protected]> - 5.6.0 | ||
- Removed support for Puppet 5 | ||
- Ensured support for Puppet 7 in requirements and stdlib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ postfix::main_cf_hash: | |
- 'permit_mynetworks' | ||
- 'reject' | ||
|
||
postfix::aliases: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,14 +21,23 @@ | |
# @param inet_protocols | ||
# The protocols to use when enabling the service | ||
# | ||
# @param aliases | ||
# Hash of alias key/value pairs that can be set in hieradata | ||
# Example: | ||
# --- | ||
# postfix::aliases: | ||
# 'root': '[email protected]' | ||
# 'foo.bar': 'fbar, [email protected]' | ||
# | ||
# @author https://github.com/simp/pupmod-simp-postfix/graphs/contributors | ||
# | ||
class postfix ( | ||
Hash $main_cf_hash, # Set in module data | ||
Boolean $enable_server = false, | ||
String $postfix_ensure = simplib::lookup('simp_options::package_ensure', { 'default_value' => 'installed' }), | ||
String $mutt_ensure = simplib::lookup('simp_options::package_ensure', { 'default_value' => 'installed' }), | ||
Postfix::InetProtocols $inet_protocols = fact('ipv6_enabled') ? { true => ['all'], default => ['ipv4'] } | ||
Postfix::InetProtocols $inet_protocols = fact('ipv6_enabled') ? { true => ['all'], default => ['ipv4'] }, | ||
Optional[Hash] $aliases, | ||
) { | ||
|
||
include 'postfix::install' | ||
|
@@ -45,4 +54,10 @@ | |
~> Class['postfix::service'] | ||
} | ||
|
||
$aliases.each | $key, $value| { | ||
postfix::alias { $key: | ||
values => $value, | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,24 @@ | |
it { is_expected.to compile.with_all_deps } | ||
it {is_expected.to create_class('postfix::server').that_notifies('Class[postfix::service]') } | ||
end | ||
|
||
context 'with aliases defined' do | ||
let(:params) {{ :aliases => { | ||
'root' => '[email protected]', | ||
'foo.bar' => 'fbar, [email protected]' | ||
} }} | ||
it { is_expected.to compile.with_all_deps } | ||
it do | ||
is_expected.to contain_concat__fragment("postfix+root.alias").with({ | ||
'content' => "root: [email protected]\n" | ||
}) | ||
end | ||
it do | ||
is_expected.to contain_concat__fragment("postfix+foo.bar.alias").with({ | ||
'content' => "foo.bar: fbar, [email protected]\n" | ||
}) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|