Only realize the director-from-client config if the director-from-client-via-storage...
authorPeter Palfrader <peter@palfrader.org>
Wed, 25 Sep 2019 16:37:11 +0000 (18:37 +0200)
committerPeter Palfrader <peter@palfrader.org>
Wed, 25 Sep 2019 16:37:11 +0000 (18:37 +0200)
modules/bacula/manifests/director.pp
modules/bacula/manifests/director/client.pp

index 26ed44f..dd5395d 100644 (file)
@@ -99,8 +99,8 @@ class bacula::director(
     notify  => Exec['bacula-director reload']
   }
 
-  Bacula::Director::Client             <<| tag == "bacula::to-director::${::fqdn}" |>>
   Bacula::Director::Client_from_storage<<| tag == "bacula::to-director::${::fqdn}" |>>
+  Bacula::Director::Client             <<| tag == "bacula::to-director::${::fqdn}" |>>
 
   package { 'bacula-console':
     ensure => installed;
index 0d356a6..f021819 100644 (file)
@@ -22,11 +22,14 @@ define bacula::director::client (
   # bacula::director::client and it needs to match.
   $pool_name     = "${bacula::director::pool_name}-${client}"
 
-  file { "/etc/bacula/conf.d/${client}.conf":
-    content => template('bacula/director/dir-per-client.erb'),
-    mode    => '0440',
-    group   => bacula,
-    notify  => Exec['bacula-director reload']
+  if defined(File["/etc/bacula/conf.d/${client}_storage.conf"]) {
+    # this config is only valid if the pools defined in ${client}_storage exist.
+    file { "/etc/bacula/conf.d/${client}.conf":
+      content => template('bacula/director/dir-per-client.erb'),
+      mode    => '0440',
+      group   => bacula,
+      notify  => Exec['bacula-director reload']
+    }
   }
 }