|
|
|
@ -233,6 +233,12 @@ import tempfile
|
|
|
|
import platform
|
|
|
|
import platform
|
|
|
|
import pipes
|
|
|
|
import pipes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try:
|
|
|
|
|
|
|
|
import selinux
|
|
|
|
|
|
|
|
HAS_SELINUX = True
|
|
|
|
|
|
|
|
except ImportError:
|
|
|
|
|
|
|
|
HAS_SELINUX = False
|
|
|
|
|
|
|
|
|
|
|
|
CRONCMD = "/usr/bin/crontab"
|
|
|
|
CRONCMD = "/usr/bin/crontab"
|
|
|
|
|
|
|
|
|
|
|
|
class CronTabError(Exception):
|
|
|
|
class CronTabError(Exception):
|
|
|
|
@ -334,6 +340,10 @@ class CronTab(object):
|
|
|
|
if rc != 0:
|
|
|
|
if rc != 0:
|
|
|
|
self.module.fail_json(msg=err)
|
|
|
|
self.module.fail_json(msg=err)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# set SELinux permissions
|
|
|
|
|
|
|
|
if HAS_SELINUX:
|
|
|
|
|
|
|
|
selinux.selinux_lsetfilecon_default(self.cron_file)
|
|
|
|
|
|
|
|
|
|
|
|
def do_comment(self, name):
|
|
|
|
def do_comment(self, name):
|
|
|
|
return "%s%s" % (self.ansible, name)
|
|
|
|
return "%s%s" % (self.ansible, name)
|
|
|
|
|
|
|
|
|
|
|
|
|