chef 15.2.20-universal-mingw32 → 15.3.14-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -2
  3. data/chef.gemspec +3 -2
  4. data/lib/chef/application.rb +1 -1
  5. data/lib/chef/application/base.rb +7 -0
  6. data/lib/chef/application/client.rb +6 -2
  7. data/lib/chef/application/solo.rb +7 -1
  8. data/lib/chef/cookbook/gem_installer.rb +7 -2
  9. data/lib/chef/exceptions.rb +12 -0
  10. data/lib/chef/knife/bootstrap.rb +8 -1
  11. data/lib/chef/knife/bootstrap/templates/chef-full.erb +1 -1
  12. data/lib/chef/knife/bootstrap/train_connector.rb +3 -3
  13. data/lib/chef/knife/cookbook_metadata_from_file.rb +1 -1
  14. data/lib/chef/node.rb +0 -2
  15. data/lib/chef/policy_builder/expand_node_object.rb +1 -1
  16. data/lib/chef/policy_builder/policyfile.rb +4 -3
  17. data/lib/chef/provider.rb +4 -2
  18. data/lib/chef/provider/ifconfig.rb +5 -3
  19. data/lib/chef/provider/package/chocolatey.rb +12 -22
  20. data/lib/chef/provider/user.rb +1 -1
  21. data/lib/chef/provider/user/dscl.rb +2 -2
  22. data/lib/chef/provider/user/mac.rb +628 -0
  23. data/lib/chef/providers.rb +1 -0
  24. data/lib/chef/resource.rb +28 -20
  25. data/lib/chef/resource/chocolatey_feature.rb +1 -1
  26. data/lib/chef/resource/chocolatey_package.rb +2 -2
  27. data/lib/chef/resource/cron_d.rb +1 -1
  28. data/lib/chef/resource/ohai.rb +1 -1
  29. data/lib/chef/resource/resource_notification.rb +17 -13
  30. data/lib/chef/resource/ruby_block.rb +1 -1
  31. data/lib/chef/resource/service.rb +1 -1
  32. data/lib/chef/resource/user.rb +1 -0
  33. data/lib/chef/resource/user/dscl_user.rb +1 -1
  34. data/lib/chef/resource/user/mac_user.rb +119 -0
  35. data/lib/chef/resource/windows_ad_join.rb +1 -1
  36. data/lib/chef/resource_collection.rb +6 -0
  37. data/lib/chef/resources.rb +1 -0
  38. data/lib/chef/run_context.rb +61 -27
  39. data/lib/chef/runner.rb +50 -12
  40. data/lib/chef/version.rb +1 -1
  41. data/spec/functional/resource/chocolatey_package_spec.rb +19 -1
  42. data/spec/functional/resource/user/mac_user_spec.rb +207 -0
  43. data/spec/integration/client/client_spec.rb +22 -0
  44. data/spec/integration/knife/raw_spec.rb +39 -19
  45. data/spec/integration/knife/redirection_spec.rb +22 -13
  46. data/spec/integration/knife/serve_spec.rb +1 -2
  47. data/spec/integration/recipes/unified_mode_spec.rb +876 -0
  48. data/spec/spec_helper.rb +1 -0
  49. data/spec/support/platform_helpers.rb +10 -0
  50. data/spec/support/shared/integration/integration_helper.rb +1 -2
  51. data/spec/unit/application/client_spec.rb +5 -6
  52. data/spec/unit/application/solo_spec.rb +3 -8
  53. data/spec/unit/application_spec.rb +1 -1
  54. data/spec/unit/cookbook/gem_installer_spec.rb +22 -1
  55. data/spec/unit/knife/bootstrap/train_connector_spec.rb +20 -7
  56. data/spec/unit/knife/bootstrap_spec.rb +13 -5
  57. data/spec/unit/provider/ifconfig_spec.rb +11 -0
  58. data/spec/unit/provider/package/chocolatey_spec.rb +34 -30
  59. data/spec/unit/provider/user/dscl_spec.rb +1 -0
  60. data/spec/unit/provider/user/mac_spec.rb +38 -0
  61. data/spec/unit/provider/user_spec.rb +38 -22
  62. data/tasks/docs.rb +14 -10
  63. metadata +25 -13
  64. data/spec/support/shared/integration/app_server_support.rb +0 -39
@@ -35,6 +35,7 @@ describe Chef::Provider::User::Dscl do
35
35
  let(:node) do
36
36
  Chef::Node.new.tap do |node|
37
37
  node.automatic["os"] = "darwin"
38
+ node.automatic["platform_version"] = "10.13.0"
38
39
  end
39
40
  end
40
41
 
@@ -0,0 +1,38 @@
1
+ #
2
+ # Author:: Ryan Cragun (<ryan@chef.io>)
3
+ # Copyright:: Copyright (c) 2019 Chef Software, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require "spec_helper"
20
+
21
+ describe Chef::Provider::User::MacUser do
22
+ before do
23
+ allow(ChefConfig).to receive(:windows?) { false }
24
+ end
25
+
26
+ let(:new_resource) { Chef::Resource::User::MacUser.new("jane") }
27
+
28
+ let(:provider) do
29
+ node = Chef::Node.new
30
+ events = Chef::EventDispatch::Dispatcher.new
31
+ run_context = Chef::RunContext.new(node, {}, events)
32
+ described_class.new(new_resource, run_context)
33
+ end
34
+
35
+ it "responds to load_current_resource" do
36
+ expect(provider).to respond_to(:load_current_resource)
37
+ end
38
+ end
@@ -444,35 +444,51 @@ describe Chef::Provider::User do
444
444
 
445
445
  describe "convert_group_name" do
446
446
  before do
447
- @new_resource.gid("999")
448
447
  @group = EtcGrnamIsh.new("wheel", "*", 999, [])
449
448
  end
450
449
 
451
- it "should lookup the group name locally" do
452
- expect(Etc).to receive(:getgrnam).with("999").and_return(@group)
453
- expect(@provider.convert_group_name).to eq(999)
454
- end
450
+ context "when user passes group name in gid" do
451
+ before do
452
+ @new_resource.gid("wheel")
453
+ end
455
454
 
456
- it "should raise an error if we can't translate the group name during resource assertions" do
457
- expect(Etc).to receive(:getgrnam).and_raise(ArgumentError)
458
- @provider.action = :create
459
- @provider.define_resource_requirements
460
- @provider.convert_group_name
461
- expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::User)
462
- end
455
+ it "should lookup the group name locally" do
456
+ expect(Etc).to receive(:getgrnam).with("wheel").and_return(@group)
457
+ expect(@provider.convert_group_name).to eq(999)
458
+ end
459
+
460
+ it "should raise an error if we can't translate the group name during resource assertions" do
461
+ expect(Etc).to receive(:getgrnam).and_raise(ArgumentError)
462
+ @provider.action = :create
463
+ @provider.define_resource_requirements
464
+ @provider.convert_group_name
465
+ expect { @provider.process_resource_requirements }.to raise_error(Chef::Exceptions::User)
466
+ end
463
467
 
464
- it "does not raise an error if we can't translate the group name during resource assertions if we are removing the user" do
465
- expect(Etc).to receive(:getgrnam).and_raise(ArgumentError)
466
- @provider.action = :remove
467
- @provider.define_resource_requirements
468
- @provider.convert_group_name
469
- expect { @provider.process_resource_requirements }.not_to raise_error
468
+ it "does not raise an error if we can't translate the group name during resource assertions if we are removing the user" do
469
+ expect(Etc).to receive(:getgrnam).and_raise(ArgumentError)
470
+ @provider.action = :remove
471
+ @provider.define_resource_requirements
472
+ @provider.convert_group_name
473
+ expect { @provider.process_resource_requirements }.not_to raise_error
474
+ end
475
+
476
+ it "should set the new resources gid to the integerized version if available" do
477
+ expect(Etc).to receive(:getgrnam).with("wheel").and_return(@group)
478
+ @provider.convert_group_name
479
+ expect(@new_resource.gid).to eq(999)
480
+ end
470
481
  end
471
482
 
472
- it "should set the new resources gid to the integerized version if available" do
473
- expect(Etc).to receive(:getgrnam).with("999").and_return(@group)
474
- @provider.convert_group_name
475
- expect(@new_resource.gid).to eq(999)
483
+ context "when user passes group id in gid" do
484
+ before do
485
+ @new_resource.gid(999)
486
+ end
487
+
488
+ it "should not call getgrnam" do
489
+ expect(Etc).not_to receive(:getgrnam)
490
+ @provider.convert_group_name
491
+ end
476
492
  end
477
493
  end
478
494
  end
@@ -156,6 +156,7 @@ namespace :docs_site do
156
156
 
157
157
  Notifications
158
158
  -----------------------------------------------------
159
+
159
160
  ``notifies``
160
161
  **Ruby Type:** Symbol, 'Chef::Resource[String]'
161
162
 
@@ -167,13 +168,13 @@ namespace :docs_site do
167
168
 
168
169
  .. tag resources_common_notification_timers
169
170
 
170
- A timer specifies the point during the Chef Infra Client run at which a notification is run. The following timers are available:
171
+ A timer specifies the point during a Chef Infra Client run at which a notification is run. The following timers are available:
171
172
 
172
173
  ``:before``
173
174
  Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
174
175
 
175
176
  ``:delayed``
176
- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Infra Client run.
177
+ Default. Specifies that a notification should be queued up, and then executed at the end of a Chef Infra Client run.
177
178
 
178
179
  ``:immediate``, ``:immediately``
179
180
  Specifies that a notification should be run immediately, per resource notified.
@@ -216,13 +217,13 @@ namespace :docs_site do
216
217
 
217
218
  .. tag resources_common_notification_timers
218
219
 
219
- A timer specifies the point during the Chef Infra Client run at which a notification is run. The following timers are available:
220
+ A timer specifies the point during a Chef Infra Client run at which a notification is run. The following timers are available:
220
221
 
221
222
  ``:before``
222
223
  Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
223
224
 
224
225
  ``:delayed``
225
- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Infra Client run.
226
+ Default. Specifies that a notification should be queued up, and then executed at the end of a Chef Infra Client run.
226
227
 
227
228
  ``:immediate``, ``:immediately``
228
229
  Specifies that a notification should be run immediately, per resource notified.
@@ -244,17 +245,20 @@ namespace :docs_site do
244
245
 
245
246
  .. tag resources_common_guards
246
247
 
247
- A guard property can be used to evaluate the state of a node during the execution phase of the Chef Infra Client run. Based on the results of this evaluation, a guard property is then used to tell the Chef Infra Client if it should continue executing a resource. A guard property accepts either a string value or a Ruby block value:
248
+ A guard property can be used to evaluate the state of a node during the execution phase of a Chef Infra Client run. Based on the results of this evaluation, a guard property is then used to tell Chef Infra Client if it should continue executing a resource. A guard property accepts either a string value or a Ruby block value:
248
249
 
249
250
  * A string is executed as a shell command. If the command returns ``0``, the guard is applied. If the command returns any other value, then the guard property is not applied. String guards in a **powershell_script** run Windows PowerShell commands and may return ``true`` in addition to ``0``.
250
251
  * A block is executed as Ruby code that must return either ``true`` or ``false``. If the block returns ``true``, the guard property is applied. If the block returns ``false``, the guard property is not applied.
251
252
 
252
- A guard property is useful for ensuring that a resource is idempotent by allowing that resource to test for the desired state as it is being executed, and then if the desired state is present, for the Chef Infra Client to do nothing.
253
+ A guard property is useful for ensuring that a resource is idempotent by allowing that resource to test for the desired state as it is being executed, and then if the desired state is present, for Chef Infra Client to do nothing.
253
254
 
254
255
  .. end_tag
256
+
257
+ **Properties**
258
+
255
259
  .. tag resources_common_guards_properties
256
260
 
257
- The following properties can be used to define a guard that is evaluated during the execution phase of the Chef Infra Client run:
261
+ The following properties can be used to define a guard that is evaluated during the execution phase of a Chef Infra Client run:
258
262
 
259
263
  ``not_if``
260
264
  Prevent a resource from executing when the condition returns ``true``.
@@ -305,7 +309,7 @@ The <%= @name %> resource has the following actions:
305
309
  ``:nothing``
306
310
  .. tag resources_common_actions_nothing
307
311
 
308
- This resource block does not act unless notified by another resource to take action. Once notified, this resource block either runs immediately or is queued up to run at the end of the Chef Infra Client run.
312
+ This resource block does not act unless notified by another resource to take action. Once notified, this resource block either runs immediately or is queued up to run at the end of a Chef Infra Client run.
309
313
 
310
314
  .. end_tag
311
315
 
@@ -317,8 +321,8 @@ The <%= @name %> resource has the following properties:
317
321
  ``<%= p['name'] %>``
318
322
  **Ruby Type:** <%= friendly_types_list(p['is']) %><% unless pretty_default(p['default']).nil? %> | **Default Value:** ``<%= pretty_default(p['default']) %>``<% end %><% if p['required'] %> | ``REQUIRED``<% end %><% if p['deprecated'] %> | ``DEPRECATED``<% end %><% if p['name_property'] %> | **Default Value:** ``The resource block's name``<% end %>
319
323
 
320
- <%= p['description'] %>
321
- <% unless p['introduced'].nil? -%>\n *New in <%= branded_chef_client_name(@introduced) %> <%= p['introduced'] -%>.*<% end -%>
324
+ <% unless p['description'].nil? %> <%= p['description'].strip %><% end %>
325
+ <% unless p['introduced'].nil? -%>\n\n *New in <%= branded_chef_client_name(p['introduced']) %> <%= p['introduced'] -%>.*\n<% end -%>
322
326
  <% end %>
323
327
  <% if @properties.empty? %>This resource does not have any properties.\n<% end -%>
324
328
  <%= boilerplate_content %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 15.2.20
4
+ version: 15.3.14
5
5
  platform: universal-mingw32
6
6
  authors:
7
7
  - Adam Jacob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-08 00:00:00.000000000 Z
11
+ date: 2019-09-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,34 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 15.2.20
19
+ version: 15.3.14
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 15.2.20
26
+ version: 15.3.14
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: train-core
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 2.0.12
33
+ version: '3.0'
37
34
  type: :runtime
38
35
  prerelease: false
39
36
  version_requirements: !ruby/object:Gem::Requirement
40
37
  requirements:
41
38
  - - "~>"
42
39
  - !ruby/object:Gem::Version
43
- version: '2.0'
40
+ version: '3.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: train-winrm
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
44
45
  - - ">="
45
46
  - !ruby/object:Gem::Version
46
- version: 2.0.12
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
47
55
  - !ruby/object:Gem::Dependency
48
56
  name: license-acceptance
49
57
  requirement: !ruby/object:Gem::Requirement
@@ -124,7 +132,7 @@ dependencies:
124
132
  requirements:
125
133
  - - ">="
126
134
  - !ruby/object:Gem::Version
127
- version: '2.4'
135
+ version: 3.0.3
128
136
  - - "<"
129
137
  - !ruby/object:Gem::Version
130
138
  version: '4.0'
@@ -134,7 +142,7 @@ dependencies:
134
142
  requirements:
135
143
  - - ">="
136
144
  - !ruby/object:Gem::Version
137
- version: '2.4'
145
+ version: 3.0.3
138
146
  - - "<"
139
147
  - !ruby/object:Gem::Version
140
148
  version: '4.0'
@@ -1297,6 +1305,7 @@ files:
1297
1305
  - lib/chef/provider/user/aix.rb
1298
1306
  - lib/chef/provider/user/dscl.rb
1299
1307
  - lib/chef/provider/user/linux.rb
1308
+ - lib/chef/provider/user/mac.rb
1300
1309
  - lib/chef/provider/user/pw.rb
1301
1310
  - lib/chef/provider/user/solaris.rb
1302
1311
  - lib/chef/provider/user/windows.rb
@@ -1429,6 +1438,7 @@ files:
1429
1438
  - lib/chef/resource/user/aix_user.rb
1430
1439
  - lib/chef/resource/user/dscl_user.rb
1431
1440
  - lib/chef/resource/user/linux_user.rb
1441
+ - lib/chef/resource/user/mac_user.rb
1432
1442
  - lib/chef/resource/user/pw_user.rb
1433
1443
  - lib/chef/resource/user/solaris_user.rb
1434
1444
  - lib/chef/resource/user/windows_user.rb
@@ -2028,6 +2038,7 @@ files:
2028
2038
  - spec/functional/resource/template_spec.rb
2029
2039
  - spec/functional/resource/timezone_spec.rb
2030
2040
  - spec/functional/resource/user/dscl_spec.rb
2041
+ - spec/functional/resource/user/mac_user_spec.rb
2031
2042
  - spec/functional/resource/user/windows_spec.rb
2032
2043
  - spec/functional/resource/windows_certificate_spec.rb
2033
2044
  - spec/functional/resource/windows_env_spec.rb
@@ -2129,6 +2140,7 @@ files:
2129
2140
  - spec/integration/recipes/resource_action_spec.rb
2130
2141
  - spec/integration/recipes/resource_converge_if_changed_spec.rb
2131
2142
  - spec/integration/recipes/resource_load_spec.rb
2143
+ - spec/integration/recipes/unified_mode_spec.rb
2132
2144
  - spec/integration/solo/solo_spec.rb
2133
2145
  - spec/rcov.opts
2134
2146
  - spec/scripts/ssl-serve.rb
@@ -2167,7 +2179,6 @@ files:
2167
2179
  - spec/support/shared/functional/securable_resource_with_reporting.rb
2168
2180
  - spec/support/shared/functional/win32_service.rb
2169
2181
  - spec/support/shared/functional/windows_script.rb
2170
- - spec/support/shared/integration/app_server_support.rb
2171
2182
  - spec/support/shared/integration/integration_helper.rb
2172
2183
  - spec/support/shared/integration/knife_support.rb
2173
2184
  - spec/support/shared/matchers/exit_with_code.rb
@@ -2545,6 +2556,7 @@ files:
2545
2556
  - spec/unit/provider/user/aix_spec.rb
2546
2557
  - spec/unit/provider/user/dscl_spec.rb
2547
2558
  - spec/unit/provider/user/linux_spec.rb
2559
+ - spec/unit/provider/user/mac_spec.rb
2548
2560
  - spec/unit/provider/user/pw_spec.rb
2549
2561
  - spec/unit/provider/user/solaris_spec.rb
2550
2562
  - spec/unit/provider/user/windows_spec.rb
@@ -1,39 +0,0 @@
1
- #
2
- # Author:: John Keiser (<jkeiser@chef.io>)
3
- # Author:: Ho-Sheng Hsiao (<hosh@chef.io>)
4
- # Copyright:: Copyright 2012-2018, Chef Software Inc.
5
- # License:: Apache License, Version 2.0
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- require "rack"
21
- require "stringio"
22
-
23
- module AppServerSupport
24
- def start_app_server(app, port)
25
- server = nil
26
- thread = Thread.new do
27
- Rack::Handler::WEBrick.run(app,
28
- Port: 9018,
29
- AccessLog: [],
30
- Logger: WEBrick::Log.new(StringIO.new, 7)) do |found_server|
31
- server = found_server
32
- end
33
- end
34
- Timeout.timeout(30) do
35
- sleep(0.01) until server && server.status == :Running
36
- end
37
- thread
38
- end
39
- end