chef-zero 4.4.2 → 4.5.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: b00b9dd1a0418e42c1982b8724f0f37f636d8370
4
- data.tar.gz: eae57d6dae04d8e748f2d4d11f880c50263d3cf3
3
+ metadata.gz: 6cc5716f0bde147efc79fb02be61275ea01aa654
4
+ data.tar.gz: d1a2c69275d9a2bc901f5024f47be5b821320e98
5
5
  SHA512:
6
- metadata.gz: 3ceb0e894eb2bf6a7d72eed6817d6fe472f7540d8eb78d677f9b0df327ce219a4d3d996017bcf19c5129fc477bf2a18f96ef24e2248bbbbc4c6343ee910cc1af
7
- data.tar.gz: be1e03b074776f923a76a81dfdc031f87de2491488e8fbc6f01a47d4e8dcf22c619b6ec2ae07b9630f9a9c88564fa9227cbdd0b526fb0f07523f92f427bd4523
6
+ metadata.gz: e0c7757da8314dad7ff5f58fe4423c7ee816b32138f59b16fcf9073e8b8fffc045b819781e81e119f85c553d44b6336e678c37d8aed0d729aae3f54ebbc48f3f
7
+ data.tar.gz: a606ffcd42a0001e1f1a43854d9f373e15f6000a29eb52129a0b5a0298eeff28675bb6d8d4e6991c179fd4b24e0a241623f9388b0d1e733f1e1a254cb9c13272
data/Gemfile CHANGED
@@ -1,14 +1,16 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
- gem 'rest-client', :github => 'chef/rest-client'
4
+ # gem 'rest-client', :github => 'chef/rest-client'
5
5
 
6
- gem 'oc-chef-pedant', :github => 'chef/chef-server'
7
-
8
- # gem 'oc-chef-pedant', :path => "../chef-server"
6
+ gem 'oc-chef-pedant', :github => 'chef/chef-server', :branch => "jk/authorization-tags"
9
7
 
10
8
  # bundler resolve failure on "rspec_junit_formatter"
11
9
  # gem 'chef-pedant', :github => 'opscode/chef-pedant', :ref => "server-cli-option"
12
10
 
13
- gem 'chef', :github => 'chef/chef'
14
- # gem 'chef', :path => "../chef"
11
+ # gem 'chef', :github => 'chef/chef', :branch => 'jk/policies-acls'
12
+
13
+ if ENV['GEMFILE_MOD']
14
+ puts "GEMFILE_MOD: #{ENV['GEMFILE_MOD']}"
15
+ instance_eval(ENV['GEMFILE_MOD'])
16
+ end
data/Rakefile CHANGED
@@ -45,7 +45,6 @@ end
45
45
  require 'github_changelog_generator/task'
46
46
 
47
47
  GitHubChangelogGenerator::RakeTask.new :changelog do |config|
48
- config.token = ENV['GITHUB_CHANGELOG_TOKEN']
49
48
  # config.future_release = ChefZero::VERSION
50
49
  config.enhancement_labels = "enhancement,Enhancement,New Feature".split(',')
51
50
  config.bug_labels = "bug,Bug,Improvement,Upstream Bug".split(',')
@@ -24,6 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_development_dependency 'rake'
25
25
  s.add_development_dependency 'rspec'
26
26
  s.add_development_dependency 'github_changelog_generator'
27
+ s.add_development_dependency 'chef'
27
28
 
28
29
  s.bindir = 'bin'
29
30
  s.executables = ['chef-zero']
@@ -13,7 +13,8 @@ module ChefZero
13
13
  # specified on X, they are not inherited from X's parent
14
14
  # - stop adding pivotal to acls (he already has access to what he needs)
15
15
  module AclPath
16
- ORG_DATA_TYPES = %w(clients cookbooks containers data environments groups nodes roles sandboxes)
16
+ ORG_DATA_TYPES = %w(clients cookbook_artifacts cookbooks containers data environments groups
17
+ nodes policies policy_groups roles sandboxes)
17
18
  TOP_DATA_TYPES = %w(containers organizations users)
18
19
 
19
20
  # ACL data paths for a partition are:
@@ -8,7 +8,7 @@ module ChefZero
8
8
  def self.normalize_acls(acls)
9
9
  ChefData::DefaultCreator::PERMISSIONS.each do |perm|
10
10
  acls[perm] ||= {}
11
- acls[perm]['actors'] ||= []
11
+ (acls[perm]['actors'] ||= []).uniq! # this gets doubled sometimes, for reasons.
12
12
  acls[perm]['groups'] ||= []
13
13
  end
14
14
  acls
@@ -148,6 +148,7 @@ module ChefZero
148
148
 
149
149
  DEFAULT_ORG_SPINE = {
150
150
  'clients' => {},
151
+ 'cookbook_artifacts' => {},
151
152
  'cookbooks' => {},
152
153
  'data' => {},
153
154
  'environments' => %w(_default),
@@ -162,7 +163,7 @@ module ChefZero
162
163
  'users' => {},
163
164
 
164
165
  'org' => {},
165
- 'containers' => %w(clients containers cookbooks data environments groups nodes roles sandboxes policies cookbook_artifacts),
166
+ 'containers' => %w(clients containers cookbook_artifacts cookbooks data environments groups nodes policies policy_groups roles sandboxes),
166
167
  'groups' => %w(admins billing-admins clients users),
167
168
  'association_requests' => {}
168
169
  }
@@ -281,7 +282,7 @@ module ChefZero
281
282
  'delete' => { 'groups' => %w(admins) },
282
283
  'grant' => { 'groups' => %w(admins) },
283
284
  }
284
- when 'containers/cookbooks', 'containers/environments', 'containers/roles'
285
+ when 'containers/environments', 'containers/roles', 'containers/policy_groups', 'containers/policies'
285
286
  {
286
287
  'create' => { 'groups' => %w(admins users) },
287
288
  'read' => { 'groups' => %w(admins users clients) },
@@ -289,7 +290,7 @@ module ChefZero
289
290
  'delete' => { 'groups' => %w(admins users) },
290
291
  'grant' => { 'groups' => %w(admins) },
291
292
  }
292
- when 'containers/cookbooks', 'containers/data'
293
+ when 'containers/cookbooks', 'containers/cookbook_artifacts', 'containers/data'
293
294
  {
294
295
  'create' => { 'groups' => %w(admins users clients) },
295
296
  'read' => { 'groups' => %w(admins users clients) },
@@ -439,7 +440,7 @@ module ChefZero
439
440
  when 4
440
441
  return path[0] == 'organizations' && (
441
442
  (path[2] == 'acls' && path[1] != 'root') ||
442
- %w(cookbooks data).include?(path[2]))
443
+ %w(cookbooks cookbook_artifacts data policies policy_groups).include?(path[2]))
443
444
  else
444
445
  return false
445
446
  end
@@ -62,7 +62,7 @@ module ChefZero
62
62
  end
63
63
 
64
64
  options_hash = options.last.is_a?(Hash) ? options.last : {}
65
- default_creator.created(path + [ name ], options_hash[:requestor], options.include?(:recursive))
65
+ default_creator.created(path + [ name ], options_hash[:requestor], options.include?(:create_dir))
66
66
  end
67
67
 
68
68
  def get(path, request=nil)
@@ -8,6 +8,18 @@ module ChefZero
8
8
  def initialize(server)
9
9
  super(server, %w(id containername))
10
10
  end
11
+
12
+ # create a container.
13
+ # input: {"containername"=>"new-container", "containerpath"=>"/"}
14
+ def post(request)
15
+ data = parse_json(request.body)
16
+ # if they don't match, id wins.
17
+ container_name = data["id"] || data["containername"]
18
+ container_path_suffix = data["containerpath"].split("/").reject { |o| o.empty? }
19
+ create_data(request, request.rest_path, container_name, to_json({}), :create_dir)
20
+
21
+ json_response(201, { uri: build_uri(request.base_uri, request.rest_path + container_path_suffix + [container_name]) })
22
+ end
11
23
  end
12
24
  end
13
25
  end
@@ -0,0 +1,15 @@
1
+ module ChefZero
2
+ module Endpoints
3
+ # /organizations/ORG/controls
4
+ class ControlsEndpoint < RestBase
5
+ # ours is not to wonder why; ours is but to make the pedant specs pass.
6
+ def get(request)
7
+ error(410, "Server says 410, chef-zero says 410.")
8
+ end
9
+
10
+ def post(request)
11
+ error(410, "Server says 410, chef-zero says 410.")
12
+ end
13
+ end
14
+ end
15
+ end
@@ -56,7 +56,7 @@ module ChefZero
56
56
  # group.
57
57
  # Storage: /organizations/ORG/policies/POLICY/revisions/REVISION
58
58
  response_code = exists_data?(request) ? 200 : 201
59
- set_data(request, nil, to_json(revision_id), :create_dir)
59
+ set_data(request, nil, to_json(revision_id), :create, :create_dir)
60
60
 
61
61
  already_json_response(response_code, request.body)
62
62
  end
@@ -200,7 +200,7 @@ module ChefZero
200
200
  end
201
201
 
202
202
  def json_response(response_code, json, request_version=0, response_version=0, opts={pretty: true})
203
- do_pretty_json = opts[:pretty] && true
203
+ do_pretty_json = !!opts[:pretty] # make sure we have a proper Boolean.
204
204
  already_json_response(response_code, FFI_Yajl::Encoder.encode(json, :pretty => do_pretty_json), request_version, response_version)
205
205
  end
206
206
 
@@ -50,6 +50,7 @@ require 'chef_zero/endpoints/cookbook_artifact_endpoint'
50
50
  require 'chef_zero/endpoints/cookbook_artifact_identifier_endpoint'
51
51
  require 'chef_zero/endpoints/containers_endpoint'
52
52
  require 'chef_zero/endpoints/container_endpoint'
53
+ require 'chef_zero/endpoints/controls_endpoint'
53
54
  require 'chef_zero/endpoints/dummy_endpoint'
54
55
  require 'chef_zero/endpoints/data_bags_endpoint'
55
56
  require 'chef_zero/endpoints/data_bag_endpoint'
@@ -563,6 +564,7 @@ module ChefZero
563
564
  [ "/dummy", DummyEndpoint.new(self) ],
564
565
  [ "/organizations/*/clients", ActorsEndpoint.new(self) ],
565
566
  [ "/organizations/*/clients/*", ActorEndpoint.new(self) ],
567
+ [ "/organizations/*/controls", ControlsEndpoint.new(self) ],
566
568
  [ "/organizations/*/cookbooks", CookbooksEndpoint.new(self) ],
567
569
  [ "/organizations/*/cookbooks/*", CookbookEndpoint.new(self) ],
568
570
  [ "/organizations/*/cookbooks/*/*", CookbookVersionEndpoint.new(self) ],
@@ -1,3 +1,3 @@
1
1
  module ChefZero
2
- VERSION = '4.4.2'
2
+ VERSION = '4.5.0'
3
3
  end
@@ -84,21 +84,27 @@ begin
84
84
  '--skip-organizations',
85
85
  '--skip-multiuser',
86
86
 
87
- # will be supported.
88
- '--skip-policies',
89
- '--skip-cookbook-artifacts',
87
+ # chef-zero has some non-removable quirks, such as the fact that files
88
+ # with 255-character names cannot be stored in local mode. This is
89
+ # reserved only for quirks that are *irrevocable* and by design; and
90
+ # should barely be used at all.
91
+ '--skip-chef-zero-quirks',
90
92
  ]
91
93
  else
92
94
  []
93
95
  end
94
-
95
- # "the goal is that only authorization, authentication and validation tests are turned off" - @jkeiser
96
- Pedant.setup([
97
- '--skip-knife',
96
+ # The latest released Chef doesn't do ACLs, Cookbook Artifacts or Policies yet
97
+ chef_fs_skips << '--skip-acl'
98
+ chef_fs_skips << '--skip-cookbook-artifacts'
99
+ chef_fs_skips << '--skip-policies'
100
+
101
+ # These things aren't supported by Chef Zero in any mode of operation:
102
+ default_skips = [
103
+ # "the goal is that only authorization, authentication and validation tests
104
+ # are turned off" - @jkeiser
105
+ #
106
+ # ...but we're not there yet
98
107
  '--skip-keys',
99
- '--skip-controls',
100
- '--skip-acl',
101
- '--skip-headers',
102
108
 
103
109
  # Chef Zero does not intend to support validation the way erchef does.
104
110
  '--skip-validation',
@@ -122,15 +128,25 @@ begin
122
128
  '--skip-usags',
123
129
 
124
130
  # Chef 12 features not yet 100% supported by Chef Zero
125
- '--skip-containers',
126
131
  '--skip-api-v1',
127
132
 
128
133
  # The universe endpoint is unlikely to ever make sense for Chef Zero
129
- '--skip-universe'
130
- ] + chef_fs_skips)
134
+ '--skip-universe',
135
+ ]
136
+
137
+ # The knife tests are very slow and don't give us a lot of extra coverage,
138
+ # so we run them in a different entry in the travis test matrix.
139
+ pedant_args =
140
+ if ENV["PEDANT_KNIFE_TESTS"]
141
+ default_skips + %w{ --focus-knife }
142
+ else
143
+ default_skips + chef_fs_skips + %w{ --skip-knife }
144
+ end
145
+
146
+ Pedant.setup(pedant_args)
131
147
 
132
- fail_fast = []
133
- # fail_fast = ["--fail-fast"]
148
+ fail_fast = %w()#--fail-fast)
149
+ #fail_fast = ["--fail-fast"]
134
150
 
135
151
  result = RSpec::Core::Runner.run(Pedant.config.rspec_args + fail_fast)
136
152
 
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: 4.4.2
4
+ version: 4.5.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: 2016-01-15 00:00:00.000000000 Z
11
+ date: 2016-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mixlib-log
@@ -170,6 +170,20 @@ dependencies:
170
170
  - - ">="
171
171
  - !ruby/object:Gem::Version
172
172
  version: '0'
173
+ - !ruby/object:Gem::Dependency
174
+ name: chef
175
+ requirement: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ type: :development
181
+ prerelease: false
182
+ version_requirements: !ruby/object:Gem::Requirement
183
+ requirements:
184
+ - - ">="
185
+ - !ruby/object:Gem::Version
186
+ version: '0'
173
187
  description: Self-contained, easy-setup, fast-start in-memory Chef server for testing
174
188
  and solo setup purposes
175
189
  email: jkeiser@opscode.com
@@ -207,6 +221,7 @@ files:
207
221
  - lib/chef_zero/endpoints/authenticate_user_endpoint.rb
208
222
  - lib/chef_zero/endpoints/container_endpoint.rb
209
223
  - lib/chef_zero/endpoints/containers_endpoint.rb
224
+ - lib/chef_zero/endpoints/controls_endpoint.rb
210
225
  - lib/chef_zero/endpoints/cookbook_artifact_endpoint.rb
211
226
  - lib/chef_zero/endpoints/cookbook_artifact_identifier_endpoint.rb
212
227
  - lib/chef_zero/endpoints/cookbook_artifacts_endpoint.rb
@@ -309,7 +324,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
309
324
  version: '0'
310
325
  requirements: []
311
326
  rubyforge_project:
312
- rubygems_version: 2.5.0
327
+ rubygems_version: 2.4.5.1
313
328
  signing_key:
314
329
  specification_version: 4
315
330
  summary: Self-contained, easy-setup, fast-start in-memory Chef server for testing