Class: RuboCop::Cop::Chef::Modernize::WindowsScResource

Inherits:
RuboCop::Cop
  • Object
show all
Extended by:
TargetChefVersion
Defined in:
lib/rubocop/cop/chef/modernize/sc_windows_resource.rb

Overview

The sc_windows resource from the sc cookbook allowed for the creation of windows services on legacy Chef Infra Client releases. Chef Infra Client 14.0 and later includes :create, :delete, and :configure actions without the need for additional cookbook dependencies. See the windows_service documentation at docs.chef.io/resources/windows_service for additional details on creating services with the windows_service resource.

Examples:


### incorrect
sc_windows 'chef-client' do
  path "C:\\opscode\\chef\\bin"
  action :create
end

### correct
windows_service 'chef-client' do
  action :create
  binary_path_name "C:\\opscode\\chef\\bin"
end

Constant Summary collapse

MSG =
'Chef Infra Client 14.0 and later includes :create, :delete, and :configure actions without the need for the sc cookbook dependency. See the windows_service documentation at https://docs.chef.io/resources/windows_service for additional details.'
RESTRICT_ON_SEND =
[:sc_windows].freeze

Instance Method Summary collapse

Methods included from TargetChefVersion

minimum_target_chef_version, required_minimum_chef_version, support_target_chef_version?

Instance Method Details

#on_send(node) ⇒ Object



46
47
48
# File 'lib/rubocop/cop/chef/modernize/sc_windows_resource.rb', line 46

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