From 030fbaef64d729f6c3b4d467a352b6c657ba7bb9 Mon Sep 17 00:00:00 2001 From: Doug Luce Date: Thu, 3 Mar 2016 15:10:19 -0800 Subject: [PATCH] Use os module for checking absolute/joining paths --- lib/ansible/modules/extras/system/cronvar.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/extras/system/cronvar.py b/lib/ansible/modules/extras/system/cronvar.py index d6a45e6b54..50afe26e30 100755 --- a/lib/ansible/modules/extras/system/cronvar.py +++ b/lib/ansible/modules/extras/system/cronvar.py @@ -129,9 +129,10 @@ class CronVar(object): if cron_file: self.cron_file = "" - if cron_file[0] != '/': - self.cron_file = '/etc/cron.d/' - self.cron_file = self.cron_file + 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