Deprecation: Chef Gem Compile Time (CHEF-3)

[edit on GitHub]

Originally, the chef gem resource always ran during the compile phase (see this section on Chef Infra Client runs for further details). It is now possible to control which phase the resource is run in. Calling chef_gem without specifying the phase is now deprecated.

This deprecation warning was added in Chef Client 12.1.0, and using chef_gem without specifying a phase will become an error in Chef Client 13.

Remediation

There are two possible remediations.

The first is to set the compile_time property on the resource. To maintain the same behavior as before, the property should be set to true:

chef_gem 'etcd' do
  compile_time true
end

The second, and preferred, is to add a gem dependency in your cookbook metadata.

gem 'etcd'

© Chef Software, Inc.
Licensed under the Creative Commons Attribution 3.0 Unported License.
The Chef™ Mark and Chef Logo are either registered trademarks/service marks or trademarks/servicemarks of Chef, in the United States and other countries and are used with Chef Inc's permission.
We are not affiliated with, endorsed or sponsored by Chef Inc.
https://docs.chef.io/deprecations_chef_gem_compile_time/