Quickly check if a runlist's cookbook version constraints are satisfied?

Hi all.

Is there some nice convenient way to check whether cookbook constraints can
be satisfied for a given runlist in a given environment?

I’m trying to add a lot of new constraints to an environment that has had
almost none for quite a while. At first I just added a simple constraint
for every cookbook to specify that each one must be the latest available
version, but I quickly found that made the dependencies unsolvable for some
runlists, as some cookbooks (eg. the nginx community cookbook) have
pessimistic version constraints.

I would like to check that the dependencies are solvable without having to
actually verify a real convergence on every single runlist (there are a lot
of them). Is there some easy way to exercise that dependency resolution
process on its own?

Thanks.

Harry

Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions
Worldwide http://www.mdsol.com
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk http://twitter.com/#!/harwilk

The information in this transmittal and any attachments are confidential
and intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the sender.

Hi,

Using just knife:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_a"])'

Where prod would be replaced by the environment and cookbook_a and
cookbook_b represent cookbooks in your runlist. The API signature is
a little odd as the thing it calls a run_list only wants cookbooks and
not fully qualified recipe names. If it returns successfully
(outputing nothing), the dependencies were resolvable. If it
explodes, they were not:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_c"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no such
cookbook cookbook_c.", "non_existent_cookbooks"=>["cookbook_c"],
"cookbooks_with_no_versions"=>}

knife exec -E 'api.post("environments/prod/cookbook_versions", :run_list => ["cookbook_b", "cookbook_a"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no versions
match the constraints on cookbook (cookbook_a >= 0.0.0).",
"non_existent_cookbooks"=>,
"cookbooks_with_no_versions"=>["(cookbook_a >= 0.0.0)"]}

Noah wrote a plugin that also might be of interest:

On Wed, Feb 11, 2015 at 1:10 PM, Harry Wilkinson hwilkinson@mdsol.com wrote:

Hi all.

Is there some nice convenient way to check whether cookbook constraints can
be satisfied for a given runlist in a given environment?

I'm trying to add a lot of new constraints to an environment that has had
almost none for quite a while. At first I just added a simple constraint for
every cookbook to specify that each one must be the latest available
version, but I quickly found that made the dependencies unsolvable for some
runlists, as some cookbooks (eg. the nginx community cookbook) have
pessimistic version constraints.

I would like to check that the dependencies are solvable without having to
actually verify a real convergence on every single runlist (there are a lot
of them). Is there some easy way to exercise that dependency resolution
process on its own?

Thanks.

Harry

Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions Worldwide
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk

The information in this transmittal and any attachments are confidential and
intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the sender.

Whoa, that is an awesome answer, thank you!

On 11 February 2015 at 14:12, Steven Danna steve@chef.io wrote:

Hi,

Using just knife:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_a"])'

Where prod would be replaced by the environment and cookbook_a and
cookbook_b represent cookbooks in your runlist. The API signature is
a little odd as the thing it calls a run_list only wants cookbooks and
not fully qualified recipe names. If it returns successfully
(outputing nothing), the dependencies were resolvable. If it
explodes, they were not:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_c"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no such
cookbook cookbook_c.", "non_existent_cookbooks"=>["cookbook_c"],
"cookbooks_with_no_versions"=>}

knife exec -E 'api.post("environments/prod/cookbook_versions", :run_list
=> ["cookbook_b", "cookbook_a"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no versions
match the constraints on cookbook (cookbook_a >= 0.0.0).",
"non_existent_cookbooks"=>,
"cookbooks_with_no_versions"=>["(cookbook_a >= 0.0.0)"]}

Noah wrote a plugin that also might be of interest:

GitHub - coderanger/knife-solve: A knife plugin to see the Chef Server version solver solution for a given set of cookbooks.

On Wed, Feb 11, 2015 at 1:10 PM, Harry Wilkinson hwilkinson@mdsol.com
wrote:

Hi all.

Is there some nice convenient way to check whether cookbook constraints
can
be satisfied for a given runlist in a given environment?

I'm trying to add a lot of new constraints to an environment that has had
almost none for quite a while. At first I just added a simple constraint
for
every cookbook to specify that each one must be the latest available
version, but I quickly found that made the dependencies unsolvable for
some
runlists, as some cookbooks (eg. the nginx community cookbook) have
pessimistic version constraints.

I would like to check that the dependencies are solvable without having
to
actually verify a real convergence on every single runlist (there are a
lot
of them). Is there some easy way to exercise that dependency resolution
process on its own?

Thanks.

Harry

Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions
Worldwide
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk

The information in this transmittal and any attachments are confidential
and
intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the sender.

--
Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions
Worldwide http://www.mdsol.com
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk http://twitter.com/#!/harwilk

The information in this transmittal and any attachments are confidential
and intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the sender.

Ah, was about to suggest knife-solve but I see Steven beat me to it :slight_smile:
On Feb 11, 2015 6:37 AM, "Harry Wilkinson" hwilkinson@mdsol.com wrote:

Whoa, that is an awesome answer, thank you!

On 11 February 2015 at 14:12, Steven Danna steve@chef.io wrote:

Hi,

Using just knife:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_a"])'

Where prod would be replaced by the environment and cookbook_a and
cookbook_b represent cookbooks in your runlist. The API signature is
a little odd as the thing it calls a run_list only wants cookbooks and
not fully qualified recipe names. If it returns successfully
(outputing nothing), the dependencies were resolvable. If it
explodes, they were not:

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_c"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no such
cookbook cookbook_c.", "non_existent_cookbooks"=>["cookbook_c"],
"cookbooks_with_no_versions"=>}

knife exec -E 'api.post("environments/prod/cookbook_versions",
:run_list => ["cookbook_b", "cookbook_a"])'
ERROR: Precondition Failed
Response: {"message"=>"Run list contains invalid items: no versions
match the constraints on cookbook (cookbook_a >= 0.0.0).",
"non_existent_cookbooks"=>,
"cookbooks_with_no_versions"=>["(cookbook_a >= 0.0.0)"]}

Noah wrote a plugin that also might be of interest:

GitHub - coderanger/knife-solve: A knife plugin to see the Chef Server version solver solution for a given set of cookbooks.

On Wed, Feb 11, 2015 at 1:10 PM, Harry Wilkinson hwilkinson@mdsol.com
wrote:

Hi all.

Is there some nice convenient way to check whether cookbook constraints
can
be satisfied for a given runlist in a given environment?

I'm trying to add a lot of new constraints to an environment that has
had
almost none for quite a while. At first I just added a simple
constraint for
every cookbook to specify that each one must be the latest available
version, but I quickly found that made the dependencies unsolvable for
some
runlists, as some cookbooks (eg. the nginx community cookbook) have
pessimistic version constraints.

I would like to check that the dependencies are solvable without having
to
actually verify a real convergence on every single runlist (there are a
lot
of them). Is there some easy way to exercise that dependency resolution
process on its own?

Thanks.

Harry

Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions
Worldwide
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk

The information in this transmittal and any attachments are
confidential and
intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the
sender.

--
Harry Wilkinson | Manager, Cloud Engineering | Medidata Solutions
Worldwide http://www.mdsol.com
Metro Building, 1 Butterwick, Hammersmith, London W6 8DL
Twitter: @harwilk http://twitter.com/#!/harwilk

The information in this transmittal and any attachments are confidential
and intended only for the recipient(s) listed above.
You are hereby notified that any unauthorized distribution or copying of
this transmittal or its attachments is prohibited.
If you have received this transmittal in error, please notify the sender.