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 the Chef client run 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 12.1.0, and using chef_gem without specifying a phase will become an error in Chef 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"