From: Tom Downes Date: Tue, 1 Aug 2017 13:01:12 +0000 (-0500) Subject: Allow user to modify loglevel of apt-get update Exec resource so that its X-Git-Tag: 4.2.0~14^2 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;ds=sidebyside;h=a99752f729bf5d3200f63d3e336e4021a1e5d4a5;p=puppet-modules%2Fpuppetlabs-apt.git Allow user to modify loglevel of apt-get update Exec resource so that its execution goes unlogged --- diff --git a/README.md b/README.md index ac945b4..bbe429f 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,15 @@ class { 'apt': }, } ``` +When `Exec['apt_update']` is triggered, it will generate a `Notice` message. Because the default [logging level for agents](https://docs.puppet.com/puppet/latest/configuration.html#loglevel) is `notice`, this will cause the repository update to appear in logs and agent reports. Some tools, such as [The Foreman](https://www.theforeman.org), report the update notice as a significant change. By setting the [loglevel](https://docs.puppet.com/puppet/latest/metaparameter.html#loglevel) metaparameter for `Exec['apt_update']` above the agent logging level, one can eliminate these updates from reports: +```puppet +class { 'apt': + update => { + frequency => 'daily', + loglevel => 'debug', + }, +} +``` ### Pin a specific release diff --git a/manifests/params.pp b/manifests/params.pp index bcff6bd..87c4a2b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -39,6 +39,7 @@ class apt::params { $update_defaults = { 'frequency' => 'reluctantly', + 'loglevel' => undef, 'timeout' => undef, 'tries' => undef, } diff --git a/manifests/update.pp b/manifests/update.pp index 4a8a7c8..461e8c1 100644 --- a/manifests/update.pp +++ b/manifests/update.pp @@ -52,6 +52,7 @@ class apt::update { } exec { 'apt_update': command => "${::apt::provider} update", + loglevel => $::apt::_update['loglevel'], logoutput => 'on_failure', refreshonly => $_refresh, timeout => $::apt::_update['timeout'],