Chef/Deprecations/DeprecatedPlatformMethods
The Cookstyle cops department: Chef/Deprecations
Enabled by default | Supports autocorrection | Target Chef Version |
---|---|---|
Enabled | No | All Versions |
Use provider_for_action
or provides instead of the deprecated Chef::Platform
methods in resources, which were removed in Chef Infra Client 13.
Examples
incorrect
resource = Chef::Resource::File.new("/tmp/foo.xyz", run_context)
provider = Chef::Platform.provider_for_resource(resource, :create)
resource = Chef::Resource::File.new("/tmp/foo.xyz", run_context)
provider = Chef::Platform.find_provider("ubuntu", "16.04", resource)
resource = Chef::Resource::File.new("/tmp/foo.xyz", run_context)
provider = Chef::Platform.find_provider_for_node(node, resource)
Chef::Platform.set :platform => :mac_os_x, :resource => :package, :provider => Chef::Provider::Package::Homebrew
correct
resource = Chef::Resource::File.new("/tmp/foo.xyz", run_context)
provider = resource.provider_for_action(:create)
# provides :package, platform_family: 'mac_os_x'
Configurable attributes
Name | Default value | Configurable values |
---|---|---|
Version Added | 5.16.0 | String |
Include |
| Array |