diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 8b466cfb..651e6793 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -181,6 +181,11 @@ against it. You can run those locally ahead of time with: bundle exec rake rubocop ``` +Or if you want to run them all together at once: +```sh +bundle exec rake strings:generate:reference && bundle exec rake lint && bundle exec rake validate && bundle exec rake rubocop +``` + ### Running the unit tests The unit test suite covers most of the code, as mentioned above please diff --git a/README.md b/README.md index 5e8c8774..cdd80018 100644 --- a/README.md +++ b/README.md @@ -180,6 +180,20 @@ class { 'bacula::client': } ``` +To exclude Info messages from the logfile. + +```puppet +class { 'bacula::client': + messages => { 'Standard-fd' => { + daemon => 'fd', + mname => 'Standard', + director => "${director}-dir = all, !skipped, !restored", + append => '"/var/log/bacula/bacula-fd.log" = all, !info, !skipped', + }, + }, + } +``` + #### Data Encryption (PKI Setup) Refer to the [PKI diff --git a/REFERENCE.md b/REFERENCE.md index cea8beaf..bd7db928 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -262,6 +262,7 @@ class { 'bacula::client': director_name => 'mydirector.example.com' } The following parameters are available in the `bacula::client` class: +* [`messages`](#-bacula--client--messages) * [`packages`](#-bacula--client--packages) * [`services`](#-bacula--client--services) * [`default_pool`](#-bacula--client--default_pool) @@ -284,6 +285,12 @@ The following parameters are available in the `bacula::client` class: * [`pki_master_key`](#-bacula--client--pki_master_key) * [`plugin_dir`](#-bacula--client--plugin_dir) +##### `messages` + +Data type: `Hash[String, Bacula::Message]` + +Logging configuration; loaded from hiera + ##### `packages` Data type: `Array[String]` @@ -2178,21 +2185,21 @@ Alias of ```puppet Struct[{ - mname => String, - append => Optional[String], - catalog => Optional[String], - console => Optional[String], - daemon => Optional[String], - director => Optional[String], - mail => Optional[String], - mailcmd => Optional[String], - mailonsuccess => Optional[String], - mailonsuccesscmd => Optional[String], - mailonerror => Optional[String], - mailonerrorcmd => Optional[String], - operator => Optional[String], - operatorcmd => Optional[String], - syslog => Optional[String], + mname => String, + append => Optional[String], + catalog => Optional[String], + console => Optional[String], + daemon => Optional[String], + director => Optional[String], + mail => Optional[String], + mailcmd => Optional[String], + mailonsuccess => Optional[String], + mailonsuccesscmd => Optional[String], + mailonerror => Optional[String], + mailonerrorcmd => Optional[String], + operator => Optional[String], + operatorcmd => Optional[String], + syslog => Optional[String], }] ``` diff --git a/data/common.yaml b/data/common.yaml index d33583c5..96f8842a 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -9,6 +9,12 @@ bacula::director::messages: console: 'all, !skipped, !saved' append: '"/var/log/bacula/bacula-dir.log" = all, !skipped' catalog: 'all' +bacula::client::messages: + Standard-fd: + daemon: 'fd' + mname: 'Standard' + director: "%{trusted.certname}-dir = all, !skipped, !restored" + append: '"/var/log/bacula/bacula-fd.log" = all, !skipped' bacula::director::packages: [] bacula::storage::services: 'bacula-sd' diff --git a/manifests/client.pp b/manifests/client.pp index dcaf1cbe..5418a74e 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -2,6 +2,7 @@ # # This class installs and configures the File Daemon to backup a client system. # +# @param messages Logging configuration; loaded from hiera # @param packages A list of packages to install; loaded from hiera # @param services A list of services to operate; loaded from hiera # @param default_pool The name of the Pool for this FD to use by default @@ -51,27 +52,28 @@ # class { 'bacula::client': director_name => 'mydirector.example.com' } # class bacula::client ( - Array[String] $packages, - String $services, - String $default_pool, - Optional[String] $default_pool_full, - Optional[String] $default_pool_inc, - Optional[String] $default_pool_diff, - Integer $port = 9102, - Array[String[1]] $listen_address = [], - String $password = 'secret', - Integer $max_concurrent_jobs = 2, - String $director_name = $bacula::director_name, - Bacula::Yesno $autoprune = true, - Bacula::Time $file_retention = '45 days', - Bacula::Time $job_retention = '6 months', - String $client = $trusted['certname'], - String $address = $facts['networking']['fqdn'], - Optional[Bacula::Yesno] $pki_signatures = undef, - Optional[Bacula::Yesno] $pki_encryption = undef, - Optional[String] $pki_keypair = undef, - Optional[String] $pki_master_key = undef, - Optional[String] $plugin_dir = undef, + Hash[String, Bacula::Message] $messages, + Array[String] $packages, + String $services, + String $default_pool, + Optional[String] $default_pool_full, + Optional[String] $default_pool_inc, + Optional[String] $default_pool_diff, + Integer $port = 9102, + Array[String[1]] $listen_address = [], + String $password = 'secret', + Integer $max_concurrent_jobs = 2, + String $director_name = $bacula::director_name, + Bacula::Yesno $autoprune = true, + Bacula::Time $file_retention = '45 days', + Bacula::Time $job_retention = '6 months', + String $client = $trusted['certname'], + String $address = $facts['networking']['fqdn'], + Optional[Bacula::Yesno] $pki_signatures = undef, + Optional[Bacula::Yesno] $pki_encryption = undef, + Optional[String] $pki_keypair = undef, + Optional[String] $pki_master_key = undef, + Optional[String] $plugin_dir = undef, ) inherits bacula { $group = $bacula::bacula_group $conf_dir = $bacula::conf_dir @@ -103,12 +105,7 @@ content => epp('bacula/bacula-fd-header.epp'), } - bacula::messages { 'Standard-fd': - daemon => 'fd', - director => "${director_name}-dir = all, !skipped, !restored", - append => '"/var/log/bacula/bacula-fd.log" = all, !skipped', - } - + create_resources(bacula::messages, $messages) # Tell the director about this client config @@bacula::director::client { $client: address => $address, diff --git a/types/message.pp b/types/message.pp index 942eb7e1..b908816e 100644 --- a/types/message.pp +++ b/types/message.pp @@ -1,18 +1,18 @@ # A Bacula message specification type Bacula::Message = Struct[{ - mname => String, - append => Optional[String], - catalog => Optional[String], - console => Optional[String], - daemon => Optional[String], - director => Optional[String], - mail => Optional[String], - mailcmd => Optional[String], - mailonsuccess => Optional[String], - mailonsuccesscmd => Optional[String], - mailonerror => Optional[String], - mailonerrorcmd => Optional[String], - operator => Optional[String], - operatorcmd => Optional[String], - syslog => Optional[String], + mname => String, + append => Optional[String], + catalog => Optional[String], + console => Optional[String], + daemon => Optional[String], + director => Optional[String], + mail => Optional[String], + mailcmd => Optional[String], + mailonsuccess => Optional[String], + mailonsuccesscmd => Optional[String], + mailonerror => Optional[String], + mailonerrorcmd => Optional[String], + operator => Optional[String], + operatorcmd => Optional[String], + syslog => Optional[String], }]