Description
Cookbook version
v2.0.0 or later
Chef-client version
14.8.12 (although should apply to any supported version)
Platform Details
Ubuntu 18.04
Scenario:
When using an image that doesn't come with build-essential pre-installed, Chef fails because ffi-libarchive is compiled before there is any chance to install build-essential.
Steps to Reproduce:
- Use any image that doesn't come with build-essential pre-installed
- Include this cookbook as a dependency (doesn't even need to be used in any way)
- Cook
Expected Result:
Technically this is the expected behavior, according to the docs:
Do not install native gems with the gem setting in metadata.rb . The gem setting is not a general purpose replacement for the chef_gem resource, and does not internally re-use the chef_gem resource. Native gems require C compilation and must not be installed with metadata.rb because metadata.rb runs before any recipe code runs. Consequently, the chef-client cannot install the C compilers before the gem installation occurs. Instead, install native gems with the chef_gem resource called from the recipe code. You’ll also need to use the build_essential resource in the recipe code to install the prerequisite compilers onto the system.
https://docs.chef.io/config_rb_metadata.html
That being said, I imagine the intended result is for the Chef run to succeed as long as build-essential is installed before this cookbook is used.
Actual Result:
Chef run fails during cookbook gem installation.
It looks like this was introduced here: f594b79