Skip to content

Commit

Permalink
Merge pull request #690 from tpdownes/master
Browse files Browse the repository at this point in the history
Allow user to modify loglevel of apt-get update Exec resource
  • Loading branch information
tphoney authored Aug 4, 2017
2 parents bc751e0 + a99752f commit dadbfa6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

$update_defaults = {
'frequency' => 'reluctantly',
'loglevel' => undef,
'timeout' => undef,
'tries' => undef,
}
Expand Down
1 change: 1 addition & 0 deletions manifests/update.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
}
exec { 'apt_update':
command => "${::apt::provider} update",
loglevel => $::apt::_update['loglevel'],
logoutput => 'on_failure',
refreshonly => $_refresh,
timeout => $::apt::_update['timeout'],
Expand Down

0 comments on commit dadbfa6

Please sign in to comment.