Class: RuboCop::Cop::Chef::ChefModernize::ExecuteAptUpdate
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::Chef::ChefModernize::ExecuteAptUpdate
- Defined in:
- lib/rubocop/cop/chef/modernize/execute_apt_update.rb
Overview
Instead of using the execute resource to to run the ‘apt-get update` use Chef Infra Client’s built-n apt_update resource which is available in Chef Infra Client 12.7 and later.
# bad
execute 'apt-get update'
# good
apt_update
Constant Summary collapse
- MSG =
'Use the apt_update resource instead of the execute resource to run an apt-get update package cache update'.freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
37 38 39 40 41 |
# File 'lib/rubocop/cop/chef/modernize/execute_apt_update.rb', line 37 def on_send(node) execute_apt_update?(node) do add_offense(node, location: :expression, message: MSG, severity: :refactor) end end |