From 1f65509ad6c56941aa1429bb850b9cb81b203feb Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 25 Sep 2019 19:01:00 +0200 Subject: [PATCH] Revert "Since the conditional does not work for default values for params, fall back to sane defaults in code" This reverts commit 75ce99c03293e2df071bcbb7f56694d192652586. --- data/common.yaml | 1 + modules/bacula/manifests/director.pp | 4 ---- modules/bacula/manifests/init.pp | 12 ++++++------ modules/bacula/templates/bacula-dir.conf.erb | 8 ++++---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/data/common.yaml b/data/common.yaml index 06f0d036d..a4c5ac67b 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -33,6 +33,7 @@ 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 696ed7baa..dd5395df6 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -31,10 +31,6 @@ 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 5eb7e93ff..90e42af87 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 (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 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 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, - Optional[String] $email_error = undef, - Optional[String] $email_operator = undef, - Optional[String] $email_daemon = undef, + String $email_error = $email_all ? { true => $email_all, default => 'root@localhost' }, + String $email_operator = $email_error, + String $email_daemon = $email_error, 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 92cafa8fd..b2a209335 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 @real_email_error != @email_all %> - mail on error = <%= @real_email_error %> = all +<% if @email_error != @email_all %> + mail on error = <%= @email_error %> = all <% end %> - operator = <%= @real_email_operator %> = mount + operator = <%= @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 = <%= @real_email_daemon %> = all + mail = <%= @email_daemon %> = all console = all, !skipped, !saved syslog = all append = "/var/lib/bacula/log" = all -- 2.20.1