summaryrefslogtreecommitdiff
path: root/lib/chef/provider/cron.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/provider/cron.rb')
-rw-r--r--lib/chef/provider/cron.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/chef/provider/cron.rb b/lib/chef/provider/cron.rb
index 7d37f34b1a..694f7ba4b8 100644
--- a/lib/chef/provider/cron.rb
+++ b/lib/chef/provider/cron.rb
@@ -100,8 +100,11 @@ class Chef
newcron = get_crontab_entry
if @cron_exists
- unless cron_different?
- logger.trace("Skipping existing cron entry '#{new_resource.name}'")
+ # Only compare the crontab if the current resource has a set command.
+ # This may not be set in cases where the Chef comment exists but the
+ # crontab command was commented out.
+ if current_resource.property_is_set?(:command) && !cron_different?
+ logger.debug("#{new_resource}: Skipping existing cron entry")
return
end
read_crontab.each_line do |line|