From 4905ab66d6525b503b592e1a539cd63c42972e68 Mon Sep 17 00:00:00 2001 From: Evan Kaufman Date: Wed, 10 Aug 2016 14:43:58 -0700 Subject: [PATCH] Fixes #3791 cron always returning changed state for multiline jobs (#4285) Strip only newlines and carriage returns. Instead of stripping ALL whitespace, which may have unintended side effects --- system/cron.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/system/cron.py b/system/cron.py index 0c0454e2ce0..0c17777be4e 100644 --- a/system/cron.py +++ b/system/cron.py @@ -383,6 +383,9 @@ class CronTab(object): return [] def get_cron_job(self,minute,hour,day,month,weekday,job,special,disabled): + # normalize any leading/trailing newlines (ansible/ansible-modules-core#3791) + job = job.strip('\r\n') + if disabled: disable_prefix = '#' else: