Cookbook Ruby Gem Dependencies:
Extending Chef Client’s Set of Ruby Gems: This document provides background and proposes a solution to topic of extending the Ruby environment provided by the Chef Client package with additional Ruby Gem packages
There are isolated cases in which Chef cookbooks developed by employer need to leverage Ruby libraries that are not bundled in the Chef Client package provided by Chef Software. Since the Gem package format is the means by which libraries and other code are managed in Ruby, any extensions to the Ruby environment provided by the Chef Client package involves use of additional Gem packages.
We introduced several dependencies on Gems that historically have not been included in the Chef client package. To address these gaps, we packaged necessary Gems and their dependencies in “chefgem-…” RPMs.
Since the set of gems embedded in the Chef client changes from version to version, our current chefgem RPMs are not always compatible with what is already embedded. This means the chefgem packages would not always work with a particular version of Chef client and this needs to be addressed.
For example, when we need to ensure the set of employers Gem extensions are added to traditionally managed nodes that have later versions of the Chef Client package, we’re forced to install at least one package with a --nodeps override to get the package installed. We clearly can’t continue applying such a workaround.
Extending the Ruby environment provided by the Chef Client packages needs to be supported
Since we expect the situations to be relatively limited, a pull request to a central management team is an acceptable part of the process
We should avoid implementation approaches where binary Gem packages are bundled in cookbooks so that we:
Avoid duplication of binary packages when multiple cookbooks need to leverage common components
Avoid complicating Chef run lists through the inclusion of cookbooks required to install extension Gems
Approach needs to account for multiple OS platforms
Approach needs to address cases in which the Chef DK is used
solution we are proposing :
We are going to create a single RPM package that is chef-client. This will be reoccurring process so that whenever a new version of chef client introduces we would need to upgrade our chef-client package each time. So that It can bundle the latest chef client along with its required dependent gem versions.Part of it will complement the following build script that eases the process of generating native RPMs/Deb packages given a gem of interest.
for ex. To package chef-client-12.5.1-1 we require chef-12.5.1-1, rest-client & nokogiri-diff. To be more specific below would be the steps to achieve this :
We need to create a single gem RPM and other gem packages
Secondly ,we need to create chef-client package bundling chef-12.5.1-1 and chef-gem altogether
Please review and suggest other workarounds.