Class: RuboCop::Cop::Chef::ChefDeprecations::PoiseArchiveUsage

Inherits:
RuboCop::Cop
  • Object
show all
Includes:
RuboCop::Chef::CookbookHelpers
Defined in:
lib/rubocop/cop/chef/deprecation/poise_archive.rb

Overview

The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+.

Examples:


# bad
poise_archive 'https://example.com/myapp.tgz' do
  destination '/opt/myapp'
end

# good
archive_file 'https://example.com/myapp.tgz' do
  destination '/opt/myapp'
end

Constant Summary collapse

MSG =
'The poise_archive resource in the deprecated poise-archive should be replaced with the archive_file resource found in Chef Infra Client 15+'.freeze

Instance Method Summary collapse

Methods included from RuboCop::Chef::CookbookHelpers

#match_property_in_resource?, #match_resource_type?, #method_arg_ast_to_string, #resource_block_name_if_string

Instance Method Details

#on_block(node) ⇒ Object



50
51
52
53
54
# File 'lib/rubocop/cop/chef/deprecation/poise_archive.rb', line 50

def on_block(node)
  match_resource_type?(:poise_archive, node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end

#on_send(node) ⇒ Object



44
45
46
47
48
# File 'lib/rubocop/cop/chef/deprecation/poise_archive.rb', line 44

def on_send(node)
  depends_poise_archive?(node) do
    add_offense(node, location: :expression, message: MSG, severity: :refactor)
  end
end