Class: RuboCop::Cop::Chef::Deprecations::DeprecatedYumRepositoryActions
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Chef::Deprecations::DeprecatedYumRepositoryActions
- Extended by:
- AutoCorrector, TargetChefVersion
- Includes:
- RuboCop::Chef::CookbookHelpers
- Defined in:
- lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb
Overview
With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 the actions the ‘yum_repository` resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.
Constant Summary collapse
- MSG =
'With the release of Chef Infra Client 12.14 and the yum cookbook 3.0 several properties in the yum_repository resource the actions the yum_repository resource actions were renamed. The `add` action became `create` and `delete` became `remove` to better match other resources in Chef Infra Client.'
Instance Method Summary collapse
Methods included from TargetChefVersion
minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?
Methods included from RuboCop::Chef::CookbookHelpers
#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string
Methods inherited from Base
Instance Method Details
#on_block(node) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/rubocop/cop/chef/deprecation/deprecated_yum_repository_actions.rb', line 51 def on_block(node) match_property_in_resource?(:yum_repository, 'action', node) do |prop_node| next unless prop_node.arguments.first.sym_type? next unless [s(:sym, :add), s(:sym, :delete)].include?(prop_node.arguments.first) add_offense(prop_node, severity: :warning) do |corrector| corrector.replace(prop_node, prop_node.source .gsub('add', 'create') .gsub('delete', 'remove')) end end end |