class RuboCop::Cop::Chef::RedundantCode::AptRepositoryNotifiesAptUpdate
There is no need to notify an apt-get update when an apt_repository is created as this is done automatically by the apt_repository resource.
@example
### incorrect apt_repository 'my repo' do uri 'http://packages.example.com/debian' components %w(stable main) deb_src false notifies :run, 'execute[apt-get update]', :immediately end ### correct apt_repository 'my repo' do uri 'http://packages.example.com/debian' components %w(stable main) deb_src false end
Constants
- MSG
Public Instance Methods
Source
# File lib/rubocop/cop/chef/redundant/apt_repository_notifies_apt_update.rb, line 48 def on_block(node) match_property_in_resource?(:apt_repository, 'notifies', node) do |notifies| return unless notifies.arguments[1] == s(:str, 'execute[apt-get update]') add_offense(notifies, severity: :refactor) do |corrector| corrector.remove(range_with_surrounding_space(range: notifies.loc.expression, side: :left)) end end end