Skip to content

Don't use cron::environment #125

Closed
@baurmatt

Description

@baurmatt

Affected Puppet, Ruby, OS and module versions/distributions

  • Puppet: All
  • Ruby: All
  • Distribution: Ubuntu 14.04/16.04/? Probably all others as well
  • Module version: Current master

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

root@mbaur-letsencrypt:/# crontab -l
# HEADER: This file was autogenerated at 2018-06-28 14:39:10 +0200 by puppet.
# HEADER: While it can still be managed manually, it is definitely not recommended.
# HEADER: Note particularly that the comments starting with 'Puppet Name' should
# HEADER: not be deleted, as doing so could cause duplicate cron jobs.
# Puppet Name: letsencrypt renew cron mbaur-letsencrypt.invaliddomain.de
VENV_PATH=/opt/letsencrypt/.venv
51 11 * * * /opt/puppetlabs/puppet/cache/letsencrypt/renew-mbaur-letsencrypt.invaliddomain.de.sh
# Puppet Name: test cron
25 15 * * * echo $VENV_PATH > /tmp/mbaur-test
root@mbaur-letsencrypt:/# date
Thu Jun 28 15:24:49 CEST 2018
root@mbaur-letsencrypt:/# date
Thu Jun 28 15:25:07 CEST 2018
root@mbaur-letsencrypt:/# cat /tmp/mbaur-test
/opt/letsencrypt/.venv

What are you seeing

The environment parameter of the cron resource gets interpreted by all cronjobs which can lead to serious problems!

What behaviour did you expect instead

Environment variable should be only valid for one cronjob

Output log

Any additional information you'd like to impart

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions