Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef Solo - Chef::Exceptions::PrivateKeyMissing

Tags:

chef-infra

I am using Chef Solo and trying to install a cookbook for Oh My Zsh! This results in this bothersome error:

Failed to read the private key /etc/chef/client.pem: Errno::ENOENT: No such file or directory - /etc/chef/client.pem

Based on what I gathered, this is being caused because the recipe has this line, which is trying to do a search:

search( :users, "shell:*zsh" ).each do |u|

I haven't found a satisfactory solution on how to fix this.

As I am a bit new to Chef, I wonder what I should do? It looks like search operation requires Chef Client, but does this mean if I want to use OMZ, I cannot use Chef Solo?

like image 808
picardo Avatar asked Nov 25 '12 05:11

picardo


2 Answers

I ran into this problem today too. It seems like chef-solo doesn't support search() out of the box. Install https://github.com/edelight/chef-solo-search to fix the problem.

like image 189
Hongli Avatar answered Oct 02 '22 14:10

Hongli


You can (probably) also use chef-zero instead of chef-solo.

From the README of chef-solo-search:

deprecation warning

Now that Local Mode ("Zero") has been introduced to Chef (as of 11.8), which offers search out of the box, this repository is going to get a lot less love. I highly reccomend that you consider migrating from Chef Solo to Chef Zero and drop use of this library. That being said, if you're stuck using Chef Solo, little chef-solo-search will still be there for you.

Here's an article walking through the migration:
https://www.chef.io/blog/2014/06/24/from-solo-to-zero-migrating-to-chef-client-local-mode/

like image 30
Kenny Evitt Avatar answered Oct 02 '22 12:10

Kenny Evitt