diff options
author | Lamont Granquist <lamont@scriptkiddie.org> | 2013-10-28 13:35:54 -0700 |
---|---|---|
committer | Lamont Granquist <lamont@scriptkiddie.org> | 2013-10-28 13:35:54 -0700 |
commit | 6bcb8976383fc8949a6c664a97167928cb406711 (patch) | |
tree | 5be5da5478e000f9b636e4be7c60f7c07ccc2e32 | |
parent | 24f5669b95c1fcc035e77d88d00c6e92e94a801a (diff) | |
download | chef-zero-6bcb8976383fc8949a6c664a97167928cb406711.tar.gz |
improve depsolver error message
- at least return the last cookbook that failed inside the recursive
bowels of the depsolver. not sure if this will produce a slightly
misleading error messge in the case of a cookbook resolution failure,
but it should give at least point at a cookbook that has a problem.
-rw-r--r-- | lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb index efd21a4..dbc2f98 100644 --- a/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +++ b/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb @@ -6,6 +6,7 @@ module ChefZero module Endpoints # /environments/NAME/cookbook_versions class EnvironmentCookbookVersionsEndpoint < RestBase + def post(request) cookbook_names = list_data(request, ['cookbooks']) @@ -35,7 +36,11 @@ module ChefZero # Depsolve! solved = depsolve(request, desired_versions.keys, desired_versions, environment_constraints) if !solved - return raise RestErrorResponse.new(412, "Unsolvable versions!") + if @last_missing_dep && !cookbook_names.include?(@last_missing_dep) + return raise RestErrorResponse.new(412, "No such cookbook: #{@last_missing_dep}") + else + return raise RestErrorResponse.new(412, "Unsolvable versions!") + end end result = {} @@ -72,6 +77,7 @@ module ChefZero new_unsolved = new_unsolved + [dep_name] # If the dep is missing, we will try other versions of the cookbook that might not have the bad dep. if !exists_data_dir?(request, ['cookbooks', dep_name]) + @last_missing_dep = dep_name.to_s dep_not_found = true break end |