class RuboCop::Cop::Chef::Deprecations::DeprecatedYumRepositoryActions
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.
@example
#### incorrect yum_repository 'OurCo' do description 'OurCo yum repository' baseurl 'http://artifacts.ourco.org/foo/bar' gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6' action :add end #### correct yum_repository 'OurCo' do description 'OurCo yum repository' baseurl 'http://artifacts.ourco.org/foo/bar' gpgkey 'http://artifacts.ourco.org/pub/yum/RPM-GPG-KEY-OURCO-6' action :create end
Constants
- MSG
Public Instance Methods
on_block(node)
click to toggle source
# 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