Class: RuboCop::Cop::Chef::Modernize::IncludingAptDefaultRecipe

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

Overview

For many users the apt::default cookbook is used only to update apt’s package cache. Chef Infra Client 12.7 and later include an apt_update resource which should be used to perform this instead. Keep in mind that some users will want to stick with the apt::default recipe as it also installs packages necessary for using https repositories on Debian systems and manages some configuration files.

Examples:


### incorrect
include_recipe 'apt::default'
include_recipe 'apt'

### correct
apt_update

Constant Summary collapse

MSG =
'Do not include the Apt default recipe to update package cache. Instead use the apt_update resource, which is built into Chef Infra Client 12.7 and later.'
RESTRICT_ON_SEND =
[:include_recipe].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



45
46
47
48
49
# File 'lib/rubocop/cop/chef/modernize/apt_default_recipe.rb', line 45

def on_send(node)
  apt_recipe_usage?(node) do
    add_offense(node, severity: :refactor)
  end
end