picardo
picardo

Reputation: 24886

Chef Solo - Chef::Exceptions::PrivateKeyMissing

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?

Upvotes: 6

Views: 3036

Answers (3)

Bharathi
Bharathi

Reputation: 501

You can use chef-client in local mode. This is already answered here chef solo private key missing when trying to use database cookbook

Upvotes: 0

Kenny Evitt
Kenny Evitt

Reputation: 9791

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/

Upvotes: 4

Hongli
Hongli

Reputation: 18924

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.

Upvotes: 9

Related Questions