chef-zero 0.9.6 → 0.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,7 +34,7 @@ module ChefZero
34
34
 
35
35
  # Filter by environment constraints
36
36
  environment = JSON.parse(get_data(request, request.rest_path[0..1]), :create_additions => false)
37
- environment_constraints = environment['cookbook_versions']
37
+ environment_constraints = environment['cookbook_versions'] || {}
38
38
 
39
39
  desired_versions.each_key do |name|
40
40
  desired_versions = filter_by_constraint(desired_versions, name, environment_constraints[name])
@@ -48,7 +48,8 @@ module ChefZero
48
48
 
49
49
  result = {}
50
50
  solved.each_pair do |name, versions|
51
- result[name] = JSON.parse(data['cookbooks'][name][versions[0]], :create_additions => false)
51
+ cookbook = JSON.parse(data['cookbooks'][name][versions[0]], :create_additions => false)
52
+ result[name] = DataNormalizer.normalize_cookbook(cookbook, name, versions[0], request.base_uri, 'GET')
52
53
  end
53
54
  json_response(200, result)
54
55
  end
@@ -69,8 +70,10 @@ module ChefZero
69
70
 
70
71
  # Pick this cookbook, and add dependencies
71
72
  cookbook_obj = JSON.parse(cookbooks[solve_for][desired_version], :create_additions => false)
73
+ cookbook_metadata = cookbook_obj['metadata'] || {}
74
+ cookbook_dependencies = cookbook_metadata['dependencies'] || {}
72
75
  dep_not_found = false
73
- cookbook_obj['metadata']['dependencies'].each_pair do |dep_name, dep_constraint|
76
+ cookbook_dependencies.each_pair do |dep_name, dep_constraint|
74
77
  # If the dep is not already in the list, add it to the list to solve
75
78
  # and bring in all environment-allowed cookbook versions to desired_versions
76
79
  if !new_desired_versions.has_key?(dep_name)
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '0.9.6'
2
+ VERSION = '0.9.7'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.6
4
+ version: 0.9.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: