Update plugins/modules/cronvar.py

Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
Giorgos Drosos 2025-07-26 15:31:45 +03:00 committed by GitHub
commit 1eecd94070
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -136,7 +136,7 @@ class CronVar(object):
else:
self.cron_file = os.path.join('/etc/cron.d', cron_file)
parent_dir = os.path.dirname(self.cron_file)
if not os.path.isdir(parent_dir):
if parent_dir and not os.path.isdir(parent_dir):
module.fail_json(msg="Parent directory '{}' does not exist for cron_file: '{}'".format(parent_dir, cron_file))
else:
self.cron_file = None