chef-boneyard / chef-vault

chef-vault cookbook
https://supermarket.chef.io/cookbooks/chef-vault
Apache License 2.0
60 stars 53 forks source link

Add logic to use 3.x gem on chef 12 #75

Closed Sean89us closed 4 years ago

Sean89us commented 4 years ago

Signed-off-by: Sean Milbrath Sean.Milbrath@Cerner.com

Description

Due to the release of the 4.0.1 chef-vault ruby gem, which now has a ruby requirement of 2.4+, this cookbook is broken for anyone using Chef 12. This logic checks which chef-client version is being run, and selects a gem version that is appropriate.

I have tested this change in our own dev environment as well as performed kitchen testing.

Issues Resolved

74

Check List

Sean89us commented 4 years ago

@tas50 Please review

Gazzonyx commented 4 years ago

FWIW, I tried this and it didn't work for Chef 12.19.36.

We had to pin to : gem 'chef-vault', '3.4.3'

gleamicus commented 4 years ago

None of this works in a normal chef-server setup because metadata.rb is compiled to metadata.json on cookbook upload, which means it's using the chef version on the developer workstation, not on the node that's going to actually install the gem. It also ignores whatever is specified in node['chef-vault']['version'], so the version, gem_source, and gem_options attributes are currently (3.1.1) completely unused, a behavior that's undocumented.

Does the gem need to be installed via metadata.rb? Is there an irresolvable timing issue if we switch back to chef_gem? It looks like the change from chef_gem to metadata.rb happened with the chef_vault_item resource rewrite in 3.0.0.

tas50 commented 4 years ago

I'm going to close this one out at this point. I release 3.1.2, which restores chef 12 compatibility and then 4.0 release which requires Chef 13.4+. I cannot stress more that now is the time to upgrade your chef-client. These sorts of breaks are only going to be more common as Chef 12 went EOL nearly 2 years ago.