Class: RuboCop::Cop::Chef::Deprecations::PoiseArchiveUsage

Inherits:
Base
  • Object
show all
Extended by:
TargetChefVersion
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:


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

### correct
archive_file 'https://example.com/myapp.tgz' do
  destination '/opt/my_app'
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+'
RESTRICT_ON_SEND =
[:depends].freeze

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

#target_chef_version

Instance Method Details

#on_block(node) ⇒ Object



54
55
56
57
58
# File 'lib/rubocop/cop/chef/deprecation/poise_archive.rb', line 54

def on_block(node)
  match_resource_type?(:poise_archive, node) do
    add_offense(node, severity: :warning)
  end
end

#on_send(node) ⇒ Object



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

def on_send(node)
  depends_poise_archive?(node) do
    add_offense(node, severity: :warning)
  end
end