aliusa
aliusa

Reputation: 21

How to list recipes available under a chef environment

Is there a knife command I can issue that will list recipes available under a chef environment (based on the Cookbook Version Constraints)?

Adding additional information:

In the chef server interface, when you edit the node run list, I see when you select the environment from the drop down it makes a rest call:

/environments/development/recipes

Which returns an array of recipes. So there's no way to run a search query through knife to do the same?

Upvotes: 2

Views: 1298

Answers (3)

aliusa
aliusa

Reputation: 21

So there's no single command:

To get the available recipes for an environment using knife:

  1. knife cookbook list -E development
  2. Loop through result list from step
    a. knife cookbook show cookbook_name version

Upvotes: 0

Tejay Cardon
Tejay Cardon

Reputation: 4223

I assume the notion here is that some recipes are not available in earlier versions of a cookbook. Unfortunately, I'm now aware of any command that can list the recipes in a particular cookbook version, short of downloading the version and doing an ls recipes on it. Likewise, there is not a knife command that can do this across all cookbooks/versions available to a given environment.

Upvotes: 0

coderanger
coderanger

Reputation: 54267

All recipes are always available per se, just a question of what versions things will resolve to. You can use the knife-solve gem to see version solutions fro your workstation.

Upvotes: 1

Related Questions