chef-zero 1.1.2 → 1.1.3
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.
- data/lib/chef_zero/data_normalizer.rb +21 -8
 - data/lib/chef_zero/endpoints/cookbook_version_endpoint.rb +1 -1
 - data/lib/chef_zero/endpoints/cookbooks_endpoint.rb +8 -1
 - data/lib/chef_zero/endpoints/environment_cookbook_versions_endpoint.rb +1 -1
 - data/lib/chef_zero/endpoints/sandbox_endpoint.rb +7 -0
 - data/lib/chef_zero/version.rb +1 -1
 - metadata +2 -2
 
| 
         @@ -69,17 +69,30 @@ module ChefZero 
     | 
|
| 
       69 
69 
     | 
    
         
             
                        end
         
     | 
| 
       70 
70 
     | 
    
         
             
                      end
         
     | 
| 
       71 
71 
     | 
    
         
             
                    end
         
     | 
| 
      
 72 
     | 
    
         
            +
                    cookbook['name'] ||= "#{name}-#{version}"
         
     | 
| 
      
 73 
     | 
    
         
            +
                    # TODO this feels wrong, but the real chef server doesn't expand this default
         
     | 
| 
      
 74 
     | 
    
         
            +
              #      cookbook['version'] ||= version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    cookbook['cookbook_name'] ||= name
         
     | 
| 
      
 76 
     | 
    
         
            +
                    cookbook['frozen?'] ||= false
         
     | 
| 
      
 77 
     | 
    
         
            +
                    cookbook['metadata'] ||= {}
         
     | 
| 
      
 78 
     | 
    
         
            +
                    cookbook['metadata']['version'] ||= version
         
     | 
| 
      
 79 
     | 
    
         
            +
                    # Sad to not be expanding defaults just because Chef doesn't :(
         
     | 
| 
      
 80 
     | 
    
         
            +
            #        cookbook['metadata']['name'] ||= name
         
     | 
| 
      
 81 
     | 
    
         
            +
            #        cookbook['metadata']['description'] ||= "A fabulous new cookbook"
         
     | 
| 
      
 82 
     | 
    
         
            +
                    cookbook['metadata']['long_description'] ||= ""
         
     | 
| 
      
 83 
     | 
    
         
            +
            #        cookbook['metadata']['maintainer'] ||= "YOUR_COMPANY_NAME"
         
     | 
| 
      
 84 
     | 
    
         
            +
            #        cookbook['metadata']['maintainer_email'] ||= "YOUR_EMAIL"
         
     | 
| 
      
 85 
     | 
    
         
            +
            #        cookbook['metadata']['license'] ||= "none"
         
     | 
| 
      
 86 
     | 
    
         
            +
                    cookbook['metadata']['dependencies'] ||= {}
         
     | 
| 
      
 87 
     | 
    
         
            +
                    cookbook['metadata']['attributes'] ||= {}
         
     | 
| 
      
 88 
     | 
    
         
            +
                    cookbook['metadata']['recipes'] ||= {}
         
     | 
| 
       72 
89 
     | 
    
         
             
                  end
         
     | 
| 
       73 
     | 
    
         
            -
                  cookbook['name'] ||= "#{name}-#{version}"
         
     | 
| 
       74 
     | 
    
         
            -
                  # TODO this feels wrong, but the real chef server doesn't expand this default
         
     | 
| 
       75 
     | 
    
         
            -
            #      cookbook['version'] ||= version
         
     | 
| 
       76 
     | 
    
         
            -
                  cookbook['cookbook_name'] ||= name
         
     | 
| 
       77 
90 
     | 
    
         
             
                  cookbook['json_class'] ||= 'Chef::CookbookVersion'
         
     | 
| 
       78 
91 
     | 
    
         
             
                  cookbook['chef_type'] ||= 'cookbook_version'
         
     | 
| 
       79 
     | 
    
         
            -
                   
     | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
             
     | 
| 
       82 
     | 
    
         
            -
                   
     | 
| 
      
 92 
     | 
    
         
            +
                  if method == 'MIN'
         
     | 
| 
      
 93 
     | 
    
         
            +
                    cookbook['metadata'].delete('attributes')
         
     | 
| 
      
 94 
     | 
    
         
            +
                    cookbook['metadata'].delete('long_description')
         
     | 
| 
      
 95 
     | 
    
         
            +
                  end
         
     | 
| 
       83 
96 
     | 
    
         
             
                  cookbook
         
     | 
| 
       84 
97 
     | 
    
         
             
                end
         
     | 
| 
       85 
98 
     | 
    
         | 
| 
         @@ -5,7 +5,14 @@ module ChefZero 
     | 
|
| 
       5 
5 
     | 
    
         
             
                # /cookbooks
         
     | 
| 
       6 
6 
     | 
    
         
             
                class CookbooksEndpoint < CookbooksBase
         
     | 
| 
       7 
7 
     | 
    
         
             
                  def get(request)
         
     | 
| 
       8 
     | 
    
         
            -
                     
     | 
| 
      
 8 
     | 
    
         
            +
                    if request.query_params['num_versions'] == 'all'
         
     | 
| 
      
 9 
     | 
    
         
            +
                      num_versions = nil
         
     | 
| 
      
 10 
     | 
    
         
            +
                    elsif request.query_params['num_versions']
         
     | 
| 
      
 11 
     | 
    
         
            +
                      num_versions = request.query_params['num_versions'].to_i
         
     | 
| 
      
 12 
     | 
    
         
            +
                    else
         
     | 
| 
      
 13 
     | 
    
         
            +
                      num_versions = 1
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
                    json_response(200, format_cookbooks_list(request, all_cookbooks_list, {}, num_versions))
         
     | 
| 
       9 
16 
     | 
    
         
             
                  end
         
     | 
| 
       10 
17 
     | 
    
         
             
                end
         
     | 
| 
       11 
18 
     | 
    
         
             
              end
         
     | 
| 
         @@ -41,7 +41,7 @@ module ChefZero 
     | 
|
| 
       41 
41 
     | 
    
         
             
                    result = {}
         
     | 
| 
       42 
42 
     | 
    
         
             
                    solved.each_pair do |name, versions|
         
     | 
| 
       43 
43 
     | 
    
         
             
                      cookbook = JSON.parse(get_data(request, ['cookbooks', name, versions[0]]), :create_additions => false)
         
     | 
| 
       44 
     | 
    
         
            -
                      result[name] = DataNormalizer.normalize_cookbook(cookbook, name, versions[0], request.base_uri, ' 
     | 
| 
      
 44 
     | 
    
         
            +
                      result[name] = DataNormalizer.normalize_cookbook(cookbook, name, versions[0], request.base_uri, 'MIN')
         
     | 
| 
       45 
45 
     | 
    
         
             
                    end
         
     | 
| 
       46 
46 
     | 
    
         
             
                    json_response(200, result)
         
     | 
| 
       47 
47 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -1,4 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'chef_zero/rest_base'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'chef_zero/rest_error_response'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'json'
         
     | 
| 
       2 
4 
     | 
    
         | 
| 
       3 
5 
     | 
    
         
             
            module ChefZero
         
     | 
| 
       4 
6 
     | 
    
         
             
              module Endpoints
         
     | 
| 
         @@ -6,6 +8,11 @@ module ChefZero 
     | 
|
| 
       6 
8 
     | 
    
         
             
                class SandboxEndpoint < RestBase
         
     | 
| 
       7 
9 
     | 
    
         
             
                  def put(request)
         
     | 
| 
       8 
10 
     | 
    
         
             
                    existing_sandbox = JSON.parse(get_data(request), :create_additions => false)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    existing_sandbox['checksums'].each do |checksum|
         
     | 
| 
      
 12 
     | 
    
         
            +
                      if !exists_data?(request, ['file_store', 'checksums', checksum])
         
     | 
| 
      
 13 
     | 
    
         
            +
                        raise RestErrorResponse.new(503, "Checksum not uploaded: #{checksum}")
         
     | 
| 
      
 14 
     | 
    
         
            +
                      end
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
       9 
16 
     | 
    
         
             
                    delete_data(request)
         
     | 
| 
       10 
17 
     | 
    
         
             
                    json_response(200, {
         
     | 
| 
       11 
18 
     | 
    
         
             
                      :guid => request.rest_path[1],
         
     | 
    
        data/lib/chef_zero/version.rb
    CHANGED
    
    
    
        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: 1.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.3
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2013-05- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2013-05-30 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: puma
         
     |