Class: RuboCop::Cop::Chef::Modernize::CronManageResource

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector, TargetChefVersion
Defined in:
lib/rubocop/cop/chef/modernize/cron_manage_resource.rb

Overview

The cron_manage resource was renamed to cron_access in the 6.1 release of the cron cookbook, and later shipped in Chef Infra Client 14.4. The new resource name should be used.

Examples:


### incorrect
cron_manage 'mike'

### correct
cron_access 'mike'

Constant Summary collapse

MSG =
'The cron_manage resource was renamed to cron_access in the 6.1 release of the cron cookbook and later shipped in Chef Infra Client 14.4. The new resource name should be used.'
RESTRICT_ON_SEND =
[:cron_manage].freeze

Instance Method Summary collapse

Methods included from TargetChefVersion

minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?

Methods inherited from Base

#target_chef_version

Instance Method Details

#on_send(node) ⇒ Object



41
42
43
44
45
# File 'lib/rubocop/cop/chef/modernize/cron_manage_resource.rb', line 41

def on_send(node)
  add_offense(node, severity: :refactor) do |corrector|
    corrector.replace(node, node.source.gsub(/^cron_manage/, 'cron_access'))
  end
end