Merge pull request #1787 from dougluce/cronvar-root-cron
cronvar.py: support absolute destinations
This commit is contained in:
commit
074c179793
1 changed files with 8 additions and 2 deletions
10
system/cronvar.py
Normal file → Executable file
10
system/cronvar.py
Normal file → Executable file
|
@ -70,7 +70,9 @@ options:
|
|||
default: root
|
||||
cron_file:
|
||||
description:
|
||||
- If specified, uses this file in cron.d instead of an individual user's crontab.
|
||||
- If specified, uses this file instead of an individual user's crontab.
|
||||
Without a leading /, this is assumed to be in /etc/cron.d. With a leading
|
||||
/, this is taken as absolute.
|
||||
required: false
|
||||
default: null
|
||||
backup:
|
||||
|
@ -126,7 +128,11 @@ class CronVar(object):
|
|||
self.wordchars = ''.join(chr(x) for x in range(128) if chr(x) not in ('=', "'", '"', ))
|
||||
|
||||
if cron_file:
|
||||
self.cron_file = '/etc/cron.d/%s' % cron_file
|
||||
self.cron_file = ""
|
||||
if os.path.isabs(cron_file):
|
||||
self.cron_file = cron_file
|
||||
else:
|
||||
self.cron_file = os.path.join('/etc/cron.d', cron_file)
|
||||
else:
|
||||
self.cron_file = None
|
||||
|
||||
|
|
Loading…
Reference in a new issue