From: Peter Palfrader Date: Wed, 25 Sep 2019 16:52:36 +0000 (+0200) Subject: Since the conditional does not work for default values for params, fall back to sane... X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-puppet.git;a=commitdiff_plain;h=75ce99c03293e2df071bcbb7f56694d192652586 Since the conditional does not work for default values for params, fall back to sane defaults in code --- diff --git a/data/common.yaml b/data/common.yaml index a4c5ac67b..06f0d036d 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -33,7 +33,6 @@ roles::dns_primary::allow_access: # bacula # bacula::email_all: 'bacula-reports@admin.debian.org' -bacula::email_error: 'bacula-reports@admin.debian.org' bacula::ssl_ca_path: '/etc/ssl/debian/certs/ca.crt' bacula::ssl_client_cert: '/etc/ssl/debian/certs/thishost.crt' bacula::ssl_client_key: '/etc/ssl/private/thishost.key' diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index dd5395df6..696ed7baa 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -31,6 +31,10 @@ class bacula::director( $some_pool_name = "poolfull-${pool_name}-${director_address}" $some_client_name = "${director_address}-fd" + $real_email_error = $bacula::email_error ? { true => $bacula::email_error , default => 'root@localhost' } + $real_email_operator = $bacula::email_operator ? { true => $bacula::email_operator, default => 'root@localhost' } + $real_email_daemon = $bacula::email_daemon ? { true => $bacula::email_daemon , default => 'root@localhost' } + # let the SD know we exist @@bacula::storage::director{ $::fqdn: tag => 'bacula::to-storage', diff --git a/modules/bacula/manifests/init.pp b/modules/bacula/manifests/init.pp index 90e42af87..5eb7e93ff 100644 --- a/modules/bacula/manifests/init.pp +++ b/modules/bacula/manifests/init.pp @@ -6,9 +6,9 @@ # @param ssl_server_cert path to TLS server certificate # @param ssl_server_key path to TLS server certificate key # @param email_all email address for all reports -# @param email_error email address for errors -# @param email_operator email address for the operator (to mount tapes etc) -# @param email_daemon email address for messages from the daemon +# @param email_error email address for errors (defaults to root@localhost) +# @param email_operator email address for the operator (to mount tapes etc; defaults to root@localhost) +# @param email_daemon email address for messages from the daemon (defaults to root@localhost) # @param public_addresses this host's public IP addresses. The ones it connects out from and is reachable from outsite. # @param has_ipv4 daemons should listen on ipv4 # @param has_ipv6 daemons should listen on ipv6 @@ -20,9 +20,9 @@ class bacula ( String $ssl_server_key, Optional[String] $email_all = undef, - String $email_error = $email_all ? { true => $email_all, default => 'root@localhost' }, - String $email_operator = $email_error, - String $email_daemon = $email_error, + Optional[String] $email_error = undef, + Optional[String] $email_operator = undef, + Optional[String] $email_daemon = undef, Array[Stdlib::IP::Address] $public_addresses = $base::public_addresses, Boolean $has_ipv4 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V4 }, Boolean $has_ipv6 = $bacula::public_addresses.any |$addr| { $addr =~ Stdlib::IP::Address::V6 }, diff --git a/modules/bacula/templates/bacula-dir.conf.erb b/modules/bacula/templates/bacula-dir.conf.erb index b2a209335..92cafa8fd 100644 --- a/modules/bacula/templates/bacula-dir.conf.erb +++ b/modules/bacula/templates/bacula-dir.conf.erb @@ -108,10 +108,10 @@ Messages { <% if @email_all %> mail = <%= @email_all %> = all <% end %> -<% if @email_error != @email_all %> - mail on error = <%= @email_error %> = all +<% if @real_email_error != @email_all %> + mail on error = <%= @real_email_error %> = all <% end %> - operator = <%= @email_operator %> = mount + operator = <%= @real_email_operator %> = mount console = all, !skipped, !saved syslog = all append = "/var/lib/bacula/log" = all @@ -122,7 +122,7 @@ Messages { Messages { Name = Daemon mailcommand = "/usr/lib/bacula/bsmtp -h localhost -f \"\(Bacula\) %r\" -s \"Bacula daemon message\" %r" - mail = <%= @email_daemon %> = all + mail = <%= @real_email_daemon %> = all console = all, !skipped, !saved syslog = all append = "/var/lib/bacula/log" = all