Class: RuboCop::Cop::Chef::Deprecations::DeprecatedShelloutMethods

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

Overview

The large number of ‘shell_out` helper methods in Chef Infra Client has been reduced to just `shell_out` and `shell_out!` methods. The legacy methods were removed in Chef Infra Client and cookbooks using these legacy helpers will need to be updated.

Examples:


### incorrect
shell_out_compact('foo')
shell_out_compact!('foo')
shell_out_with_timeout('foo')
shell_out_with_timeout!('foo')
shell_out_with_systems_locale('foo')
shell_out_with_systems_locale!('foo')
shell_out_compact_timeout('foo')
shell_out_compact_timeout!('foo')

### correct
shell_out('foo')
shell_out!('foo')
shell_out!('foo', default_env: false) # replaces shell_out_with_systems_locale

Constant Summary collapse

MSG =
'Many legacy specialized shell_out methods were replaced in Chef Infra Client 14.3 and removed in Chef Infra Client 15. Use shell_out and any additional options if necessary.'
RESTRICT_ON_SEND =
%i( shell_out_compact
  shell_out_compact!
  shell_out_compact_timeout
  shell_out_compact_timeout!
  shell_out_with_timeout
  shell_out_with_timeout!
  shell_out_with_systems_locale
  shell_out_with_systems_locale!
).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



57
58
59
# File 'lib/rubocop/cop/chef/deprecation/deprecated_shellout_methods.rb', line 57

def on_send(node)
  add_offense(node, severity: :warning)
end