chef-zero 13.0.0 → 13.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 396ae8f8740ff30a19cf21a04cf020be332b9f9e
4
- data.tar.gz: e9d0bab91a60b421e3e17b69488ff377777bdeb3
3
+ metadata.gz: f5d647a2d5e5efa6c92eb7c4285f529b35aef7a5
4
+ data.tar.gz: ec2f33f80f230f44228b24c3ea308918e823b7e3
5
5
  SHA512:
6
- metadata.gz: a059d4ae5e327a1e9b1d6c1bfb1ba5a0585483935b3499c83167c580daf1fc7300ad378e236276a05555e4f9feb0629b40899f5ccfcc86aff09f7a4acefdf82d
7
- data.tar.gz: 5a160f7e546ab7242335f0416ed2443d0d64c0d19547c26f1796cac9c4078c865b092e7172c221c8c180ac882b938c7af7d354f4af6b17bf473d3b323a899536
6
+ metadata.gz: cb417d730349ccd4d32e5bd4b87fdd1e0469118da5cc08d58604759b1f78069dd5a7fbbc65fa33189d1749002d36a4962773ec3d856bf1b4ef8b0b5709b5f09f
7
+ data.tar.gz: 6a0b06a288410ffad9f2f8af5f061964292f77a130c1b0c1f68fe0dab319bd1056c86c2a430a13dbd1203f55e3ea084b4bef5af1b46f32f28bc452317cdd91e3
data/Gemfile CHANGED
@@ -15,7 +15,7 @@ group :development, :test do
15
15
  gem "chefstyle", "= 0.3.1"
16
16
  end
17
17
 
18
- gem "chef"
18
+ gem "chef", "~> 13"
19
19
 
20
20
  if ENV["GEMFILE_MOD"]
21
21
  puts "GEMFILE_MOD: #{ENV['GEMFILE_MOD']}"
@@ -13,7 +13,7 @@ module ChefZero
13
13
  if value = request.query_params["external_authentication_uid"]
14
14
  response[2] = filter("external_authentication_uid", value, request, response[2])
15
15
  elsif value = request.query_params["email"]
16
- response[2] = filter("email", value, request, response[2])
16
+ response[2] = filter("email", value, request, response[2], insensitive: true)
17
17
  end
18
18
 
19
19
  if request.query_params["verbose"]
@@ -83,18 +83,22 @@ module ChefZero
83
83
 
84
84
  private
85
85
 
86
- def filter(key, value, request, resp)
86
+ def filter(key, value, request, resp, opts = {})
87
87
  results = parse_json(resp)
88
88
  new_results = {}
89
89
  results.each do |name, url|
90
90
  record = get_data(request, request.rest_path + [ name ], :nil)
91
91
  if record
92
92
  record = parse_json(record)
93
- new_results[name] = url if record[key] == value
93
+ new_results[name] = url if record[key] && is_equal(record[key], value, opts[:insensitive])
94
94
  end
95
95
  end
96
96
  to_json(new_results)
97
97
  end
98
+
99
+ def is_equal(a, b, ignore_case)
100
+ ignore_case ? a.casecmp(b).zero? : a == b
101
+ end
98
102
  end
99
103
  end
100
104
  end
@@ -23,6 +23,22 @@ module ChefZero
23
23
  results
24
24
  end
25
25
 
26
+ def format_universe_list(request, cookbooks_list)
27
+ results = {}
28
+ cookbooks_list.each do |name, versions|
29
+ results[name] ||= {}
30
+ versions.each do |version|
31
+ cookbook_data = FFI_Yajl::Parser.parse(get_data(request, request.rest_path[0..1] + [ "cookbooks", name, version ], :nil))
32
+ results[name][version] ||= {
33
+ "dependencies" => cookbook_data["metadata"]["dependencies"],
34
+ "location_path" => build_uri(request.base_uri, request.rest_path[0..1] + ["cookbooks", name, version]),
35
+ "location_type" => "chef_server",
36
+ }
37
+ end
38
+ end
39
+ results
40
+ end
41
+
26
42
  def all_cookbooks_list(request)
27
43
  result = {}
28
44
  # Race conditions exist here (if someone deletes while listing). I don't care.
@@ -20,6 +20,10 @@ module ChefZero
20
20
  super(request)
21
21
  end
22
22
 
23
+ def head(request)
24
+ head_request(request)
25
+ end
26
+
23
27
  def populate_defaults(request, response_json)
24
28
  node = FFI_Yajl::Parser.parse(response_json)
25
29
  node = ChefData::DataNormalizer.normalize_node(node, request.rest_path[3])
@@ -0,0 +1,15 @@
1
+ require "ffi_yajl"
2
+ require "chef_zero/endpoints/rest_object_endpoint"
3
+ require "chef_zero/chef_data/data_normalizer"
4
+
5
+ module ChefZero
6
+ module Endpoints
7
+ # /universe
8
+ class UniverseEndpoint < CookbooksBase
9
+
10
+ def get(request)
11
+ json_response(200, format_universe_list(request, all_cookbooks_list(request)))
12
+ end
13
+ end
14
+ end
15
+ end
@@ -231,6 +231,16 @@ module ChefZero
231
231
  [response_code, { "Content-Type" => "text/plain" }, text]
232
232
  end
233
233
 
234
+ # rfc090 returns 404 error or 200 with an emtpy body
235
+ # @param [ChefZero::RestRequest] request The HTTP request object
236
+ #
237
+ # @return (see #json_response)
238
+ #
239
+ def head_request(request)
240
+ get_data(request) # will raise 404 if non-existant
241
+ json_response(200, nil)
242
+ end
243
+
234
244
  # Returns an Array with the response code, HTTP headers, and JSON body.
235
245
  #
236
246
  # @param [Fixnum] response_code The HTTP response code
@@ -1,6 +1,6 @@
1
1
  #
2
2
  # Author:: John Keiser (<jkeiser@opscode.com>)
3
- # Copyright:: Copyright (c) 2012 Opscode, Inc.
3
+ # Copyright:: Copyright (c) 2012-2017, Chef Software Inc.
4
4
  # License:: Apache License, Version 2.0
5
5
  #
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
@@ -105,6 +105,7 @@ require "chef_zero/endpoints/file_store_file_endpoint"
105
105
  require "chef_zero/endpoints/not_found_endpoint"
106
106
  require "chef_zero/endpoints/version_endpoint"
107
107
  require "chef_zero/endpoints/server_api_version_endpoint"
108
+ require "chef_zero/endpoints/universe_endpoint"
108
109
 
109
110
  module ChefZero
110
111
 
@@ -623,6 +624,7 @@ module ChefZero
623
624
  [ "/organizations/*/sandboxes/*", SandboxEndpoint.new(self) ],
624
625
  [ "/organizations/*/search", SearchesEndpoint.new(self) ],
625
626
  [ "/organizations/*/search/*", SearchEndpoint.new(self) ],
627
+ [ "/organizations/*/universe", UniverseEndpoint.new(self) ],
626
628
  [ "/version", VersionEndpoint.new(self) ],
627
629
  [ "/server_api_version", ServerAPIVersionEndpoint.new(self) ],
628
630
 
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = "13.0.0"
2
+ VERSION = "13.1.0"
3
3
  end
@@ -130,12 +130,6 @@ begin
130
130
  "--skip-organizations",
131
131
  "--skip-multiuser",
132
132
  "--skip-user-keys",
133
-
134
- # chef-zero has some non-removable quirks, such as the fact that files
135
- # with 255-character names cannot be stored in local mode. This is
136
- # reserved only for quirks that are *irrevocable* and by design; and
137
- # should barely be used at all.
138
- "--skip-chef-zero-quirks",
139
133
  ]
140
134
  else
141
135
  []
@@ -167,6 +161,10 @@ begin
167
161
  # Chef Zero does not intend to support authorization the way erchef does.
168
162
  "--skip-authorization",
169
163
 
164
+ # Chef Zero does not intend to support oc_id authentication/authorization
165
+ # the way erchef does.
166
+ "--skip-oc_id",
167
+
170
168
  # Omnibus tests depend on erchef features that are specific to erchef and
171
169
  # bundled in the omnibus package. Currently the only test in this category
172
170
  # is for the search reindexing script.
@@ -181,8 +179,13 @@ begin
181
179
 
182
180
  # Chef 12 features not yet 100% supported by Chef Zero
183
181
 
184
- # The universe endpoint is unlikely to ever make sense for Chef Zero
185
- "--skip-universe",
182
+ # chef-zero has some non-removable quirks, such as the fact that files
183
+ # with 255-character names cannot be stored in local mode. This is
184
+ # reserved only for quirks that are *irrevocable* and by design; and
185
+ # should barely be used at all. This is also used to skip the user acl
186
+ # tests from chef-server as the user acls are not supported in chef-zero
187
+ # at this time.
188
+ "--skip-chef-zero-quirks",
186
189
  ]
187
190
 
188
191
  # The knife tests are very slow and don't give us a lot of extra coverage,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.0.0
4
+ version: 13.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2017-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -253,6 +253,7 @@ files:
253
253
  - lib/chef_zero/endpoints/searches_endpoint.rb
254
254
  - lib/chef_zero/endpoints/server_api_version_endpoint.rb
255
255
  - lib/chef_zero/endpoints/system_recovery_endpoint.rb
256
+ - lib/chef_zero/endpoints/universe_endpoint.rb
256
257
  - lib/chef_zero/endpoints/user_association_request_endpoint.rb
257
258
  - lib/chef_zero/endpoints/user_association_requests_count_endpoint.rb
258
259
  - lib/chef_zero/endpoints/user_association_requests_endpoint.rb