Allow user to modify loglevel of apt-get update Exec resource so that its
authorTom Downes <thomas.downes@ligo.org>
Tue, 1 Aug 2017 13:01:12 +0000 (08:01 -0500)
committerTom Downes <thomas.downes@ligo.org>
Tue, 1 Aug 2017 13:01:12 +0000 (08:01 -0500)
execution goes unlogged

README.md
manifests/params.pp
manifests/update.pp

index ac945b40933428c3aaeb32a8021fd92664d48563..bbe429fc9f8dfe015576903d252b2db066645257 100644 (file)
--- 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
 
 
 ### Pin a specific release
 
index bcff6bd40d293cde5ed273e6d55495b2a252075a..87c4a2b6b1a25e0208528519c2279e17ef26d76d 100644 (file)
@@ -39,6 +39,7 @@ class apt::params {
 
   $update_defaults = {
     'frequency' => 'reluctantly',
 
   $update_defaults = {
     'frequency' => 'reluctantly',
+    'loglevel'  => undef,
     'timeout'   => undef,
     'tries'     => undef,
   }
     'timeout'   => undef,
     'tries'     => undef,
   }
index 4a8a7c8c21be204eb104da03139fbfdf2d89a45e..461e8c14e1768927b838d0a715766d08809f8e37 100644 (file)
@@ -52,6 +52,7 @@ class apt::update {
   }
   exec { 'apt_update':
     command     => "${::apt::provider} update",
   }
   exec { 'apt_update':
     command     => "${::apt::provider} update",
+    loglevel    => $::apt::_update['loglevel'],
     logoutput   => 'on_failure',
     refreshonly => $_refresh,
     timeout     => $::apt::_update['timeout'],
     logoutput   => 'on_failure',
     refreshonly => $_refresh,
     timeout     => $::apt::_update['timeout'],