Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logrotate config defaults #118

Open
olifre opened this issue Jun 19, 2018 · 4 comments
Open

Logrotate config defaults #118

olifre opened this issue Jun 19, 2018 · 4 comments
Labels
enhancement New feature or request

Comments

@olifre
Copy link

olifre commented Jun 19, 2018

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: 5.5.3
  • Ruby: AIO packages
  • Distribution: Ubuntu 18.04
  • Module version: v3.2.2-rc0

How to reproduce (e.g Puppet code you use)

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

What are you seeing

Sensible OS defaults from https://github.com/voxpupuli/puppet-logrotate/blob/master/manifests/params.pp are not applied anymore if any config is specified. These defaults are crucial at least on Ubuntu, where su_user and su_group are essential.

What behaviour did you expect instead

I expected the defaults to be used as base, extended / overwritable with user options, i.e.:

config => merge($::logrotate::params::conf_params, $logrotate_our_config),

I'm using now as workaround exactly that, preceded by:

        if ! defined(Class['::logrotate::params']) {
                include ::logrotate::params
        }

i.e. using the params class manually.

@juniorsysadmin juniorsysadmin added the enhancement New feature or request label Jun 26, 2018
@vegarnilsen
Copy link

I'm having the same issue with Puppet 6 and v3.4.0 of this module.

clsvegar@test02:~$ /opt/puppetlabs/bin/puppet --version
6.0.4
clsvegar@test02:~$ sudo /opt/puppetlabs/bin/puppet module list | grep logrotate
├── puppet-logrotate (v3.4.0)

I have this config in Hiera, and none of the default su* parameters for Ubuntu 18.04 are used:

logrotate::config:
  dateext: true
  dateformat: '.upto-%Y%m%d'
  compress: true
  delaycompress: true

To have a working config, I have to add these lines as well:

  su: true
  su_user: 'root'
  su_group: 'syslog'

@amateo
Copy link

amateo commented Jan 31, 2019

I'm having this same problem since I updated from version 3.3.0 to 3.4.0.
Although using configuration from @vegarnilsen works, I think that default config should produce a correct configuration, which is not the case in ubuntu.

@bastelfreak
Copy link
Member

Hey @vegarnilsen or @amateo, could you provide a PR with a fix for this?

@amateo
Copy link

amateo commented Jul 15, 2020

After a lot of time...

The problem is with the code in logrotate::defaults:

  if !defined( Logrotate::Conf[$logrotate::params::config_file] ) {
    logrotate::conf{ $logrotate::params::config_file:
      * => $logrotate::params::conf_params,
    }
  }

This if isn't matched when you have $logrotate::config param, because of the:

  if $config {
    logrotate::conf { $logrotate_conf:
      * => $config,
    }
  }

in logrotate::config.
To fix this I think a refactor is needed to integrate default config in just one logrotate::conf directive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants