Loading manifests/conffile.pp +6 −14 Original line number Diff line number Diff line Loading @@ -44,22 +44,15 @@ # } # define postfix::conffile ( $ensure = 'present', $source = undef, $content = undef, $path = "/etc/postfix/${name}", $mode = '0644', $options = {}, Enum['present', 'absent', 'directory'] $ensure = 'present', Variant[Array[String], String, Undef] $source = undef, Optional[String] $content = undef, Stdlib::Absolutepath $path = "/etc/postfix/${name}", String $mode = '0644', Hash $options = {}, ) { include ::postfix::params validate_absolute_path($path) if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") } if !is_string($content) { fail("value for content should be String type; got ${content}") } validate_re($ensure, ['present', 'absent', 'directory'], "\$ensure must be either 'present', 'absent' or 'directory', got '${ensure}'") validate_hash($options) if (!defined(Class['postfix'])) { fail 'You must define class postfix before using postfix::config!' } Loading @@ -68,7 +61,6 @@ define postfix::conffile ( fail 'You must provide either \'source\' or \'content\', not both' } validate_hash($options) if !$source and !$content and $ensure == 'present' and empty($options) { fail 'You must provide \'options\' hash parameter if you don\'t provide \'source\' neither \'content\'' } Loading manifests/config.pp +7 −5 Original line number Diff line number Diff line Loading @@ -27,13 +27,15 @@ # ensure => 'blank', # } # define postfix::config ($value = undef, $ensure = 'present') { define postfix::config ( Optional[String] $value = undef, Enum['present', 'absent', 'blank'] $ensure = 'present', ) { validate_re($ensure, ['present', 'absent', 'blank'], "\$ensure must be either 'present', 'absent' or 'blank', got '${ensure}'") if ($ensure == 'present') { validate_re($value, '^.+$', '$value can not be empty if ensure = present') assert_type(Pattern[/^.+$/], $value) |$e, $a| { fail '$value can not be empty if ensure = present' } } if (!defined(Class['postfix'])) { Loading manifests/files.pp +3 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ class postfix::files { $use_schleuder = $postfix::use_schleuder $use_sympa = $postfix::use_sympa validate_string($mastercf_source) validate_string($master_smtp) validate_string($master_smtps) assert_type(Optional[String], $mastercf_source) assert_type(Optional[String], $master_smtp) assert_type(Optional[String], $master_smtps) File { replace => $manage_conffiles, Loading manifests/hash.pp +4 −8 Original line number Diff line number Diff line Loading @@ -25,17 +25,13 @@ # } # define postfix::hash ( $ensure='present', $source=undef, $content=undef, Enum['present', 'absent'] $ensure='present', Variant[Array[String], String, Undef] $source=undef, Variant[Array[String], String, Undef] $content=undef, ) { include ::postfix::params validate_absolute_path($name) if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") } if !is_string($content) and !is_array($content) { fail("value for source should be either String type or Array type got ${content}") } validate_re($ensure, ['present', 'absent'], "\$ensure must be either 'present' or 'absent', got '${ensure}'") assert_type(Stdlib::Absolutepath, $name) if (!defined(Class['postfix'])) { fail 'You must define class postfix before using postfix::config!' Loading manifests/init.pp +30 −56 Original line number Diff line number Diff line Loading @@ -72,64 +72,38 @@ # } # class postfix ( $alias_maps = 'hash:/etc/aliases', $inet_interfaces = 'all', $ldap = false, $ldap_base = undef, $ldap_host = undef, $ldap_options = undef, $mail_user = 'vmail', # postfix_mail_user $mailman = false, $maincf_source = "puppet:///modules/${module_name}/main.cf", $manage_conffiles = true, $manage_mailx = true, $mastercf_source = undef, $master_smtp = undef, # postfix_master_smtp $master_smtps = undef, # postfix_master_smtps $master_submission = undef, # postfix_master_submission $mta = false, $mydestination = '$myorigin', # postfix_mydestination $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks $myorigin = $::fqdn, $relayhost = undef, # postfix_relayhost $manage_root_alias = true, $root_mail_recipient = 'nobody', # root_mail_recipient $satellite = false, $smtp_listen = '127.0.0.1', # postfix_smtp_listen $use_amavisd = false, # postfix_use_amavisd $use_dovecot_lda = false, # postfix_use_dovecot_lda $use_schleuder = false, # postfix_use_schleuder $use_sympa = false, # postfix_use_sympa $postfix_ensure = 'present', $mailx_ensure = 'present', String $alias_maps = 'hash:/etc/aliases', String $inet_interfaces = 'all', Boolean $ldap = false, Optional[String] $ldap_base = undef, Optional[String] $ldap_host = undef, Optional[String] $ldap_options = undef, String $mail_user = 'vmail', # postfix_mail_user Boolean $mailman = false, String $maincf_source = "puppet:///modules/${module_name}/main.cf", Boolean $manage_conffiles = true, Boolean $manage_mailx = true, Optional[String] $mastercf_source = 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 Boolean $mta = false, String $mydestination = '$myorigin', # postfix_mydestination String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks String $myorigin = $::fqdn, Optional[String] $relayhost = undef, # postfix_relayhost Boolean $manage_root_alias = true, Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient Boolean $satellite = false, String $smtp_listen = '127.0.0.1', # postfix_smtp_listen Boolean $use_amavisd = false, # postfix_use_amavisd Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda Boolean $use_schleuder = false, # postfix_use_schleuder Boolean $use_sympa = false, # postfix_use_sympa String $postfix_ensure = 'present', String $mailx_ensure = 'present', ) inherits postfix::params { validate_bool($ldap) validate_bool($mailman) validate_bool($mta) validate_bool($manage_root_alias) validate_bool($manage_mailx) validate_bool($satellite) validate_bool($use_amavisd) validate_bool($use_dovecot_lda) validate_bool($use_schleuder) validate_bool($use_sympa) validate_string($alias_maps) validate_string($inet_interfaces) validate_string($mail_user) validate_string($mydestination) validate_string($mynetworks) validate_string($myorigin) validate_string($relayhost) if ! is_array($root_mail_recipient) { validate_string($root_mail_recipient) } validate_string($smtp_listen) $_smtp_listen = $mailman ? { true => '0.0.0.0', default => $smtp_listen, Loading Loading
manifests/conffile.pp +6 −14 Original line number Diff line number Diff line Loading @@ -44,22 +44,15 @@ # } # define postfix::conffile ( $ensure = 'present', $source = undef, $content = undef, $path = "/etc/postfix/${name}", $mode = '0644', $options = {}, Enum['present', 'absent', 'directory'] $ensure = 'present', Variant[Array[String], String, Undef] $source = undef, Optional[String] $content = undef, Stdlib::Absolutepath $path = "/etc/postfix/${name}", String $mode = '0644', Hash $options = {}, ) { include ::postfix::params validate_absolute_path($path) if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") } if !is_string($content) { fail("value for content should be String type; got ${content}") } validate_re($ensure, ['present', 'absent', 'directory'], "\$ensure must be either 'present', 'absent' or 'directory', got '${ensure}'") validate_hash($options) if (!defined(Class['postfix'])) { fail 'You must define class postfix before using postfix::config!' } Loading @@ -68,7 +61,6 @@ define postfix::conffile ( fail 'You must provide either \'source\' or \'content\', not both' } validate_hash($options) if !$source and !$content and $ensure == 'present' and empty($options) { fail 'You must provide \'options\' hash parameter if you don\'t provide \'source\' neither \'content\'' } Loading
manifests/config.pp +7 −5 Original line number Diff line number Diff line Loading @@ -27,13 +27,15 @@ # ensure => 'blank', # } # define postfix::config ($value = undef, $ensure = 'present') { define postfix::config ( Optional[String] $value = undef, Enum['present', 'absent', 'blank'] $ensure = 'present', ) { validate_re($ensure, ['present', 'absent', 'blank'], "\$ensure must be either 'present', 'absent' or 'blank', got '${ensure}'") if ($ensure == 'present') { validate_re($value, '^.+$', '$value can not be empty if ensure = present') assert_type(Pattern[/^.+$/], $value) |$e, $a| { fail '$value can not be empty if ensure = present' } } if (!defined(Class['postfix'])) { Loading
manifests/files.pp +3 −3 Original line number Diff line number Diff line Loading @@ -19,9 +19,9 @@ class postfix::files { $use_schleuder = $postfix::use_schleuder $use_sympa = $postfix::use_sympa validate_string($mastercf_source) validate_string($master_smtp) validate_string($master_smtps) assert_type(Optional[String], $mastercf_source) assert_type(Optional[String], $master_smtp) assert_type(Optional[String], $master_smtps) File { replace => $manage_conffiles, Loading
manifests/hash.pp +4 −8 Original line number Diff line number Diff line Loading @@ -25,17 +25,13 @@ # } # define postfix::hash ( $ensure='present', $source=undef, $content=undef, Enum['present', 'absent'] $ensure='present', Variant[Array[String], String, Undef] $source=undef, Variant[Array[String], String, Undef] $content=undef, ) { include ::postfix::params validate_absolute_path($name) if !is_string($source) and !is_array($source) { fail("value for source should be either String type or Array type got ${source}") } if !is_string($content) and !is_array($content) { fail("value for source should be either String type or Array type got ${content}") } validate_re($ensure, ['present', 'absent'], "\$ensure must be either 'present' or 'absent', got '${ensure}'") assert_type(Stdlib::Absolutepath, $name) if (!defined(Class['postfix'])) { fail 'You must define class postfix before using postfix::config!' Loading
manifests/init.pp +30 −56 Original line number Diff line number Diff line Loading @@ -72,64 +72,38 @@ # } # class postfix ( $alias_maps = 'hash:/etc/aliases', $inet_interfaces = 'all', $ldap = false, $ldap_base = undef, $ldap_host = undef, $ldap_options = undef, $mail_user = 'vmail', # postfix_mail_user $mailman = false, $maincf_source = "puppet:///modules/${module_name}/main.cf", $manage_conffiles = true, $manage_mailx = true, $mastercf_source = undef, $master_smtp = undef, # postfix_master_smtp $master_smtps = undef, # postfix_master_smtps $master_submission = undef, # postfix_master_submission $mta = false, $mydestination = '$myorigin', # postfix_mydestination $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks $myorigin = $::fqdn, $relayhost = undef, # postfix_relayhost $manage_root_alias = true, $root_mail_recipient = 'nobody', # root_mail_recipient $satellite = false, $smtp_listen = '127.0.0.1', # postfix_smtp_listen $use_amavisd = false, # postfix_use_amavisd $use_dovecot_lda = false, # postfix_use_dovecot_lda $use_schleuder = false, # postfix_use_schleuder $use_sympa = false, # postfix_use_sympa $postfix_ensure = 'present', $mailx_ensure = 'present', String $alias_maps = 'hash:/etc/aliases', String $inet_interfaces = 'all', Boolean $ldap = false, Optional[String] $ldap_base = undef, Optional[String] $ldap_host = undef, Optional[String] $ldap_options = undef, String $mail_user = 'vmail', # postfix_mail_user Boolean $mailman = false, String $maincf_source = "puppet:///modules/${module_name}/main.cf", Boolean $manage_conffiles = true, Boolean $manage_mailx = true, Optional[String] $mastercf_source = 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 Boolean $mta = false, String $mydestination = '$myorigin', # postfix_mydestination String $mynetworks = '127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128', # postfix_mynetworks String $myorigin = $::fqdn, Optional[String] $relayhost = undef, # postfix_relayhost Boolean $manage_root_alias = true, Variant[Array[String], String] $root_mail_recipient = 'nobody', # root_mail_recipient Boolean $satellite = false, String $smtp_listen = '127.0.0.1', # postfix_smtp_listen Boolean $use_amavisd = false, # postfix_use_amavisd Boolean $use_dovecot_lda = false, # postfix_use_dovecot_lda Boolean $use_schleuder = false, # postfix_use_schleuder Boolean $use_sympa = false, # postfix_use_sympa String $postfix_ensure = 'present', String $mailx_ensure = 'present', ) inherits postfix::params { validate_bool($ldap) validate_bool($mailman) validate_bool($mta) validate_bool($manage_root_alias) validate_bool($manage_mailx) validate_bool($satellite) validate_bool($use_amavisd) validate_bool($use_dovecot_lda) validate_bool($use_schleuder) validate_bool($use_sympa) validate_string($alias_maps) validate_string($inet_interfaces) validate_string($mail_user) validate_string($mydestination) validate_string($mynetworks) validate_string($myorigin) validate_string($relayhost) if ! is_array($root_mail_recipient) { validate_string($root_mail_recipient) } validate_string($smtp_listen) $_smtp_listen = $mailman ? { true => '0.0.0.0', default => $smtp_listen, Loading