voxpupuli / puppet-prometheus

Puppet module for prometheus
https://forge.puppet.com/puppet/prometheus
Apache License 2.0
60 stars 241 forks source link

The module should have manage_home => true for user #548

Open samuraiii opened 3 years ago

samuraiii commented 3 years ago

Affected Puppet, Ruby, OS and module versions/distributions

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

When you setup a cron for the prometheus user all is alright up to the time when the cronjob should be runnig. It fails with

May 04 09:49:01 prometheus CROND[8958]: (CRON) ERROR chdir failed (/home/prometheus): No such file or directory

And this indicates that there is no home dir for the prometheus user.

Puppet example:

cron {
   'send date to /tmp/test':
        command => '/bin/date > /tmp/test',
        user           =>$prometheus::server::user;
}

this should change content of the /tmp/test every minute, but it does not happen due to the mentioned error.

Cheers S

PS: also the home for system users should not be in the /home directory.

samuraiii commented 3 years ago

suggested fix in install.pp

  if $prometheus::server::manage_user {
    ensure_resource('user', [$prometheus::server::user], {
        ensure     => 'present',
        system     => true,
        groups     => $prometheus::server::extra_groups,
        shell      => $prometheus::server::usershell,
        managehome => true,
        home       => $prometheus::server::localstorage,
    })