From 3bd8e749b9f67f269b6be35438a7b9f34fbd1e02 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 24 Sep 2019 16:29:29 +0200 Subject: [PATCH] Move device name, media type name, and archive device construction to the manifest --- modules/bacula/manifests/storage/client.pp | 7 +++++-- modules/bacula/templates/storage/sd-per-client.conf.erb | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/bacula/manifests/storage/client.pp b/modules/bacula/manifests/storage/client.pp index 3b03a7598..7aa04287a 100644 --- a/modules/bacula/manifests/storage/client.pp +++ b/modules/bacula/manifests/storage/client.pp @@ -8,6 +8,10 @@ define bacula::storage::client( ) { include bacula::storage + $device_name = "${bacula::storage::filestor_device}-${client}" + $media_type_name = "${bacula::storage::filestor_name}-${client}" + $directory = "${bacula::storage::backup_path}/${client}" + file { "/etc/bacula/storage-conf.d/${client}.conf": content => template('bacula/storage/sd-per-client.conf.erb'), @@ -15,7 +19,7 @@ define bacula::storage::client( group => bacula, notify => Exec['bacula-sd restart-when-idle'], ; - "${bacula::storage::backup_path}/${client}": + $directory: ensure => directory, mode => '0755', owner => bacula, @@ -23,4 +27,3 @@ define bacula::storage::client( ; } } - diff --git a/modules/bacula/templates/storage/sd-per-client.conf.erb b/modules/bacula/templates/storage/sd-per-client.conf.erb index 5d6c769f9..a50cb0eae 100644 --- a/modules/bacula/templates/storage/sd-per-client.conf.erb +++ b/modules/bacula/templates/storage/sd-per-client.conf.erb @@ -4,9 +4,9 @@ ## Device { - Name = "<%= scope['bacula::storage::filestor_device'] %>-<%= @client %>" - Media Type = "<%= scope['bacula::storage::filestor_name'] %>-<%= @client %>" - Archive Device = "<%= scope['bacula::storage::backup_path'] %>/<%= @client %>" + Name = "<%= @device_name %>" + Media Type = "<%= @media_type_name %>" + Archive Device = "<%= @directory %>" LabelMedia = yes; Random Access = Yes; AutomaticMount = yes; -- 2.20.1