Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: voxpupuli/puppet-logrotate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.2.8
Choose a base ref
...
head repository: voxpupuli/puppet-logrotate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.3.0
Choose a head ref
  • 7 commits
  • 8 files changed
  • 4 contributors

Commits on Nov 3, 2015

  1. add support for maxsize

    zeromind committed Nov 3, 2015
    Copy the full SHA
    4f7c8df View commit details
  2. Merge pull request #10 from zeromind/master

    Add support for maxsize directive
    robinbowes committed Nov 3, 2015
    Copy the full SHA
    f48b259 View commit details

Commits on Nov 4, 2015

  1. Default to ensure => 'present' for the package

    Prior to this, the default value for the `ensure` parameter of the
    logrotate package was set to 'latest'. This meant that by simply
    declaring a logrotate::rule, the package could also be updated. It is
    generally not a good idea to update system packages unless being done in
    a controlled envrionment.
    
    To fix that issue, the default value is being changed to 'present'.
    This way, the end-user can choose to update the logrotate package when
    they want to.
    
    This fixes issue #11
    natemccurdy committed Nov 4, 2015
    Copy the full SHA
    f4b0db2 View commit details
  2. Add ::logrotate documentation to the README

    Prior to this, there was no documentation on how the main ::logrotate
    class could be used to adjust global settings. This fixes that by
    including some brief examples of how to ovverride the default parameters
    to accomplish some basic tuning.
    natemccurdy committed Nov 4, 2015
    Copy the full SHA
    e914165 View commit details

Commits on Nov 5, 2015

  1. Remove quotes from ensure parameter default value

    Robin Bowes committed Nov 5, 2015
    Copy the full SHA
    fe78f17 View commit details
  2. Merge branch 'natemccurdy-issue/11'

    * natemccurdy-issue/11:
      Remove quotes from ensure parameter default value
      Add ::logrotate documentation to the README
      Default to ensure => 'present' for the package
    Robin Bowes committed Nov 5, 2015
    Copy the full SHA
    cf94240 View commit details
  3. Prep for 1.3.0 release

    Robin Bowes committed Nov 5, 2015
    Copy the full SHA
    499b74b View commit details
Showing with 46 additions and 7 deletions.
  1. +4 −0 CHANGELOG
  2. +4 −0 CONTRIBUTORS
  3. +27 −3 README.md
  4. +1 −1 manifests/init.pp
  5. +7 −0 manifests/rule.pp
  6. +1 −1 metadata.json
  7. +1 −1 spec/classes/init_spec.rb
  8. +1 −1 templates/etc/logrotate.d/rule.erb
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
2015-11-05 Release 1.3.0
- set default package version to "present" rather than "latest" (#11) (natemccurdy)
- add documentation for setting class defaults (natemccurdy)

2015-09-14 Release 1.2.8
- Fix hidden unicode character (#8)
- Allow config to be passed in as an hash (#6)
4 changes: 4 additions & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
Andreas Ntaflos
Atom Powers
Daniel Beckham
David Collom
Jurgen Weber
Keith McDuffee
Mason Malone
Matthias Kneer
Michael Moll
Mick Pollard
Nate McCurdy
Nathan Huff
Nicolas Jehle
Robin Bowes
Tim Sharpe
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Logrotate module for Puppet

## Disclaimer
## Disclaimer

This module is a fork of https://github.com/rodjek/puppet-logrotate merging some of the outstanding pull requests

I have also added the puppetlabs_spec_help functionality as used in [Gareth Rushgrove](https://github.com/garethr)'s [puppet-module-skeleton](https://github.com/garethr/puppet-module-skeleton).

## Description
## Description

A more Puppety way of managing logrotate configs. Where possible, as many of
the configuration options have remained the same with a couple of notable
@@ -83,6 +83,11 @@ minsize - The String minimum size a log file must be to be rotated,
but not before the scheduled rotation time (optional).
The default units are bytes, append k, M or G for kilobytes,
megabytes and gigabytes respectively.
maxsize - The String maximum size a log file may be to be rotated;
When maxsize is used, both the size and timestamp of a log
file are considered for rotation.
The default units are bytes, append k, M or G for kilobytes,
megabytes and gigabytes respectively.
missingok - A Boolean specifying whether logrotate should ignore missing
log files or issue an error (optional).
olddir - A String path to a directory that rotated logs should be
@@ -131,9 +136,28 @@ uncompresscmd - The String command to be used to uncompress log files

Further details about these options can be found by reading `man 8 logrotate`.

### Examples
## logrotate

You may, optionally, declare the main `::logrotate` class to adjust some of the
defaults that are used when intalling the logrotate package and creating the
main `/etc/logrotate.conf` configuration file.

This example will ensure that the logrotate package is latest and that the `dateext` and `compress` options are added to the defaults for a node.

```puppet
class { '::logrotate':
ensure => 'latest',
config => {
dateext => true,
compress => true,
}
}
```


## Examples

```puppet
logrotate::conf { '/etc/logrotate.conf':
rotate => 10,
rotate_every => 'week',
2 changes: 1 addition & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
class logrotate (
$ensure = 'latest',
$ensure = present,
$hieramerge = false,
$manage_cron_daily = true,
$package = 'logrotate',
7 changes: 7 additions & 0 deletions manifests/rule.pp
Original file line number Diff line number Diff line change
@@ -50,6 +50,11 @@
# but not before the scheduled rotation time (optional).
# The default units are bytes, append k, M or G for kilobytes,
# megabytes and gigabytes respectively.
# maxsize - The String maximum size a log file may be to be rotated;
# When maxsize is used, both the size and timestamp of a log
# file are considered for rotation.
# The default units are bytes, append k, M or G for kilobytes,
# megabytes and gigabytes respectively.
# missingok - A Boolean specifying whether logrotate should ignore missing
# log files or issue an error (optional).
# olddir - A String path to a directory that rotated logs should be
@@ -139,6 +144,7 @@
$maillast = 'undef',
$maxage = 'undef',
$minsize = 'undef',
$maxsize = 'undef',
$missingok = 'undef',
$olddir = 'undef',
$postrotate = 'undef',
@@ -299,6 +305,7 @@
# Any better ideas greatfully received
validate_re("X${maxage}", ['^Xundef$', '^X\d+$'], "Logrotate::Conf[${name}]: maxage must be an integer")
validate_re("X${minsize}", ['^Xundef$', '^X\d+[kMG]?$'], "Logrotate::Conf[${name}]: minsize must match /\\d+[kMG]?/")
validate_re("X${maxsize}", ['^Xundef$', '^X\d+[kMG]?$'], "Logrotate::Conf[${name}]: maxsize must match /\\d+[kMG]?/")
validate_re("X${rotate}", ['^Xundef$', '^X\d+$'], "Logrotate::Conf[${name}]: rotate must be an integer")
validate_re("X${size}", ['^Xundef$', '^X\d+[kMG]?$'], "Logrotate::Conf[${name}]: size must match /\\d+[kMG]?/")
validate_re("X${shredcycles}", ['^Xundef$', '^X\d+$'], "Logrotate::Conf[${name}]: shredcycles must be an integer")
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yo61-logrotate",
"version": "1.2.8",
"version": "1.3.0",
"author": "Robin Bowees <robin.bowes@yo61.com>",
"summary": "Manage logrotate",
"license": "MIT",
2 changes: 1 addition & 1 deletion spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
it { is_expected.to compile.with_all_deps }

it do
should contain_package('logrotate').with_ensure('latest')
should contain_package('logrotate').with_ensure('present')

# should contain_file('/etc/logrotate.conf').with({
# 'ensure' => 'file',
2 changes: 1 addition & 1 deletion templates/etc/logrotate.d/rule.erb
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@

[
'compresscmd', 'compressext', 'compressoptions', 'dateformat', 'extension',
'maxage', 'minsize', 'rotate', 'size', 'shredcycles', 'start',
'maxage', 'minsize', 'maxsize', 'rotate', 'size', 'shredcycles', 'start',
'uncompresscmd'
].each do |key|
value = scope.to_hash[key]