From 820c1c410cb381be3af94859695658cd093b8829 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Tue, 24 Sep 2019 23:53:42 +0200 Subject: [PATCH] Make a few Strings be Stdlib::Host --- modules/bacula/manifests/client.pp | 4 ++-- modules/bacula/manifests/director.pp | 2 +- modules/bacula/manifests/director/client.pp | 6 +++--- modules/bacula/manifests/director/client_from_storage.pp | 4 ++-- modules/bacula/manifests/init.pp | 4 ++-- modules/bacula/manifests/storage.pp | 2 ++ modules/bacula/manifests/storage/client.pp | 8 ++++---- modules/bacula/templates/bacula-sd.conf.erb | 4 ++-- 8 files changed, 18 insertions(+), 16 deletions(-) diff --git a/modules/bacula/manifests/client.pp b/modules/bacula/manifests/client.pp index 97b5f2126..9d35c63f7 100644 --- a/modules/bacula/manifests/client.pp +++ b/modules/bacula/manifests/client.pp @@ -9,8 +9,8 @@ # @param client_name bacula client name for this instance # @param ensure present or absent class bacula::client( - String $director_server, - String $storage_server, + Stdlib::Host $director_server, + Stdlib::Host $storage_server, Integer $port_fd = 9102, String $client_name = "${::fqdn}-fd", Enum['present', 'absent'] $ensure = defined(Class['bacula::not_a_client']) ? { true => 'absent', default => 'present' }, diff --git a/modules/bacula/manifests/director.pp b/modules/bacula/manifests/director.pp index bb6901dba..5c522c53b 100644 --- a/modules/bacula/manifests/director.pp +++ b/modules/bacula/manifests/director.pp @@ -16,7 +16,7 @@ class bacula::director( String $pool_name = 'bacula', Integer $port_dir = 9101, Optional[String] $db_sslca = undef, - #String $storage_name = "${::fqdn}-dir", + #String $director_name = "${::fqdn}-dir", String $director_name = $bacula::bacula_director_name, ) inherits bacula { diff --git a/modules/bacula/manifests/director/client.pp b/modules/bacula/manifests/director/client.pp index 16ce4f546..09117c66b 100644 --- a/modules/bacula/manifests/director/client.pp +++ b/modules/bacula/manifests/director/client.pp @@ -8,9 +8,9 @@ # @param client_secret shared secret between director and client define bacula::director::client ( Integer $port_fd, - String $client = $name, - String $client_name = "${client}-fd", # XXX remove default - String $client_secret = hkdf('/etc/puppet/secret', "bacula-fd-${client}"), # XXX remove default + Stdlib::Host $client = $name, + String $client_name, + String $client_secret, ) { include bacula::director diff --git a/modules/bacula/manifests/director/client_from_storage.pp b/modules/bacula/manifests/director/client_from_storage.pp index 5be90c3cf..aff272088 100644 --- a/modules/bacula/manifests/director/client_from_storage.pp +++ b/modules/bacula/manifests/director/client_from_storage.pp @@ -10,13 +10,13 @@ # @param storage_device_name Device name on the storage daemon for this node's backups # @param storage_media_type_name Media type name on the storage daemon for this node's backupse define bacula::director::client_from_storage ( - String $storage_address, + Stdlib::Host $storage_address, Integer $port_sd, String $storage_secret, String $storage_device_name, String $storage_media_type_name, - String $client = $name, + Stdlib::Host $client = $name, ) { include bacula::director diff --git a/modules/bacula/manifests/init.pp b/modules/bacula/manifests/init.pp index 78ef859da..5f0aa8600 100644 --- a/modules/bacula/manifests/init.pp +++ b/modules/bacula/manifests/init.pp @@ -5,8 +5,8 @@ class bacula ( String $bacula_operator_email = 'bacula-reports@admin.debian.org', String $bacula_director_name = 'debian-dir', - String $bacula_director_address = 'dinis.debian.org', - String $bacula_storage_address = 'storace.debian.org', + Stdlib::Host $bacula_director_address = 'dinis.debian.org', + Stdlib::Host $bacula_storage_address = 'storace.debian.org', String $bacula_db_secret = hkdf('/etc/puppet/secret', "bacula-db-${::hostname}"), diff --git a/modules/bacula/manifests/storage.pp b/modules/bacula/manifests/storage.pp index 874efec92..4ed59928c 100644 --- a/modules/bacula/manifests/storage.pp +++ b/modules/bacula/manifests/storage.pp @@ -5,12 +5,14 @@ # @param filestor_name storage device media type name prefix # @param port_sd port for the sd to listen on # @param storage_name bacula name of this sd instance +# @param storage_address address of this sd instance that other instances should connect to (dns name) class bacula::storage ( String $backup_path = '/srv/bacula', String $filestor_device = 'FileStorage', String $filestor_name = 'File', Integer $port_sd = 9103, String $storage_name = "${::fqdn}-sd", + Stdlib::Host $storage_address = $::fqdn, ) inherits bacula { $storage_secret = hkdf('/etc/puppet/secret', "bacula-sd-${::fqdn}") diff --git a/modules/bacula/manifests/storage/client.pp b/modules/bacula/manifests/storage/client.pp index c8969c0c1..ba2f930b1 100644 --- a/modules/bacula/manifests/storage/client.pp +++ b/modules/bacula/manifests/storage/client.pp @@ -2,11 +2,11 @@ # # This is stored config by a client and then collected on the storage # -# @param director_server The director for this client -# @param client The name of the client (relevant for device names, media type names, etc.) +# @param director_server director for this client +# @param client name/address of the client (relevant for device names, media type names, etc.) define bacula::storage::client( String $director_server, - String $client = $name + Stdlib::Host $client = $name ) { include bacula::storage @@ -33,7 +33,7 @@ define bacula::storage::client( @@bacula::director::client_from_storage { $client: tag => "bacula::to-director::${director_server}", client => $client, - storage_address => $::fqdn, + storage_address => $bacula::storage::storage_address, port_sd => $bacula::storage::port_sd, storage_secret => $bacula::storage::storage_secret, storage_device_name => $device_name, diff --git a/modules/bacula/templates/bacula-sd.conf.erb b/modules/bacula/templates/bacula-sd.conf.erb index f9bcdfee7..c15203907 100644 --- a/modules/bacula/templates/bacula-sd.conf.erb +++ b/modules/bacula/templates/bacula-sd.conf.erb @@ -14,13 +14,13 @@ Storage { ipv4 = { # use the hostname rather than the IP address from LDAP, # as /etc/hosts might have a better answer in case of natted hosts. - addr = <%= @bacula_storage_address %> + addr = <%= @storage_address %> port = <%= @port_sd %> } <%- end -%> <%- if scope.lookupvar('deprecated::nodeinfo')['misc']['has_v6_ldap'] -%> ipv6 = { - addr = <%= @bacula_storage_address %> + addr = <%= @storage_address %> port = <%= @port_sd %> } <%- end -%> -- 2.20.1