diff options
author | BradLook <brad.dewey@hautelook.com> | 2016-08-10 14:30:09 -0700 |
---|---|---|
committer | Rene Moser <mail@renemoser.net> | 2016-08-10 23:32:17 +0200 |
commit | b8280db07b2b970bfcfce2c41c91464793021513 (patch) | |
tree | 4f6599998f0d0ff288e5bbda6b43c2a23913717b | |
parent | 36f512abc1a75b01ae7207c74cdfbcb54a84be54 (diff) | |
download | ansible-modules-core-b8280db07b2b970bfcfce2c41c91464793021513.tar.gz |
Allow cron to target remote user (#4270)
-rw-r--r-- | system/cron.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/system/cron.py b/system/cron.py index 67dda844..64b7ea3a 100644 --- a/system/cron.py +++ b/system/cron.py @@ -474,7 +474,7 @@ class CronTab(object): return "%s -l %s" % (pipes.quote(CRONCMD), pipes.quote(self.user)) elif platform.system() == 'HP-UX': return "%s %s %s" % (CRONCMD , '-l', pipes.quote(self.user)) - else: + elif os.getlogin() != self.user: user = '-u %s' % pipes.quote(self.user) return "%s %s %s" % (CRONCMD , user, '-l') @@ -486,7 +486,7 @@ class CronTab(object): if self.user: if platform.system() in ['SunOS', 'HP-UX', 'AIX']: return "chown %s %s ; su '%s' -c '%s %s'" % (pipes.quote(self.user), pipes.quote(path), pipes.quote(self.user), CRONCMD, pipes.quote(path)) - else: + elif os.getlogin() != self.user: user = '-u %s' % pipes.quote(self.user) return "%s %s %s" % (CRONCMD , user, pipes.quote(path)) |