chef 12.15.19-universal-mingw32 → 12.16.42-universal-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -1
  3. data/VERSION +1 -1
  4. data/acceptance/.shared/kitchen_acceptance/.kitchen.ec2.yml +3 -1
  5. data/acceptance/Gemfile.lock +14 -14
  6. data/acceptance/data-collector/test/integration/default/serverspec/default_spec.rb +3 -11
  7. data/distro/common/html/knife_bootstrap.html +1 -1
  8. data/distro/common/man/man1/README.md +2 -2
  9. data/distro/common/man/man1/knife-client.1 +1 -1
  10. data/lib/chef/application.rb +7 -15
  11. data/lib/chef/application/client.rb +2 -2
  12. data/lib/chef/application/solo.rb +1 -1
  13. data/lib/chef/chef_class.rb +1 -0
  14. data/lib/chef/chef_fs/file_system/chef_server/cookbook_file.rb +3 -7
  15. data/lib/chef/chef_fs/file_system/chef_server/versioned_cookbook_dir.rb +1 -1
  16. data/lib/chef/data_collector.rb +83 -9
  17. data/lib/chef/data_collector/messages.rb +2 -1
  18. data/lib/chef/dsl/core.rb +1 -1
  19. data/lib/chef/dsl/declare_resource.rb +10 -4
  20. data/lib/chef/dsl/method_missing.rb +1 -1
  21. data/lib/chef/dsl/recipe.rb +1 -1
  22. data/lib/chef/dsl/universal.rb +1 -1
  23. data/lib/chef/event_dispatch/base.rb +3 -0
  24. data/lib/chef/http.rb +3 -4
  25. data/lib/chef/knife.rb +20 -2
  26. data/lib/chef/knife/core/generic_presenter.rb +18 -4
  27. data/lib/chef/knife/node_show.rb +0 -5
  28. data/lib/chef/knife/osc_user_show.rb +0 -1
  29. data/lib/chef/knife/ssl_fetch.rb +9 -5
  30. data/lib/chef/mixin/powershell_out.rb +1 -1
  31. data/lib/chef/mixin/shell_out.rb +1 -1
  32. data/lib/chef/node.rb +1 -5
  33. data/lib/chef/node/attribute.rb +70 -98
  34. data/lib/chef/node/attribute_collections.rb +28 -19
  35. data/lib/chef/node/common_api.rb +0 -6
  36. data/lib/chef/node/immutable_collections.rb +16 -79
  37. data/lib/chef/node/mixin/deep_merge_cache.rb +61 -0
  38. data/lib/chef/node/mixin/immutablize_array.rb +67 -0
  39. data/lib/chef/node/mixin/immutablize_hash.rb +54 -0
  40. data/lib/chef/node/mixin/state_tracking.rb +93 -0
  41. data/lib/chef/property.rb +4 -4
  42. data/lib/chef/provider/cron.rb +1 -1
  43. data/lib/chef/provider/group/suse.rb +23 -4
  44. data/lib/chef/provider/package.rb +43 -5
  45. data/lib/chef/provider/package/apt.rb +20 -0
  46. data/lib/chef/provider/package/windows/exe.rb +4 -3
  47. data/lib/chef/provider/package/windows/msi.rb +4 -3
  48. data/lib/chef/provider/package/yum.rb +20 -0
  49. data/lib/chef/provider/package/zypper.rb +20 -0
  50. data/lib/chef/provider/ruby_block.rb +1 -1
  51. data/lib/chef/provider/service/upstart.rb +25 -9
  52. data/lib/chef/provider/user.rb +4 -6
  53. data/lib/chef/provider/user/dscl.rb +8 -3
  54. data/lib/chef/provider/user/solaris.rb +5 -12
  55. data/lib/chef/resource.rb +19 -0
  56. data/lib/chef/resource/file.rb +1 -1
  57. data/lib/chef/resource/package.rb +1 -1
  58. data/lib/chef/resource/scm.rb +1 -7
  59. data/lib/chef/resource/yum_repository.rb +1 -1
  60. data/lib/chef/rest.rb +1 -0
  61. data/lib/chef/run_context.rb +12 -0
  62. data/lib/chef/version.rb +1 -1
  63. data/spec/data/trusted_certs/example_no_cn.crt +36 -0
  64. data/spec/functional/resource/group_spec.rb +1 -0
  65. data/spec/functional/resource/user/useradd_spec.rb +4 -2
  66. data/spec/integration/knife/data_bag_create_spec.rb +0 -3
  67. data/spec/integration/knife/environment_show_spec.rb +24 -4
  68. data/spec/integration/knife/node_environment_set_spec.rb +4 -1
  69. data/spec/integration/recipes/accumulator_spec.rb +232 -0
  70. data/spec/integration/recipes/resource_action_spec.rb +1 -1
  71. data/spec/spec_helper.rb +2 -2
  72. data/spec/support/shared/context/client.rb +12 -3
  73. data/spec/support/shared/integration/app_server_support.rb +1 -1
  74. data/spec/support/shared/integration/knife_support.rb +4 -1
  75. data/spec/unit/data_collector/messages_spec.rb +2 -0
  76. data/spec/unit/data_collector_spec.rb +158 -21
  77. data/spec/unit/http_spec.rb +1 -1
  78. data/spec/unit/knife/core/gem_glob_loader_spec.rb +1 -1
  79. data/spec/unit/knife/core/ui_spec.rb +10 -0
  80. data/spec/unit/knife/ssl_fetch_spec.rb +38 -0
  81. data/spec/unit/knife_spec.rb +31 -0
  82. data/spec/unit/mixin/powershell_out_spec.rb +25 -1
  83. data/spec/unit/node/attribute_spec.rb +46 -1
  84. data/spec/unit/node/vivid_mash_spec.rb +27 -89
  85. data/spec/unit/node_spec.rb +134 -3
  86. data/spec/unit/provider/deploy_spec.rb +1 -1
  87. data/spec/unit/provider/group/suse_spec.rb +90 -0
  88. data/spec/unit/provider/package/apt_spec.rb +22 -0
  89. data/spec/unit/provider/package/windows/msi_spec.rb +13 -4
  90. data/spec/unit/provider/package/windows_spec.rb +3 -3
  91. data/spec/unit/provider/package/yum_spec.rb +18 -0
  92. data/spec/unit/provider/package/zypper_spec.rb +64 -0
  93. data/spec/unit/provider/package_spec.rb +58 -0
  94. data/spec/unit/provider/remote_file/content_spec.rb +1 -1
  95. data/spec/unit/provider/service/upstart_service_spec.rb +13 -6
  96. data/spec/unit/provider/user/solaris_spec.rb +36 -9
  97. data/spec/unit/provider/user_spec.rb +6 -0
  98. data/spec/unit/resource/apt_repository_spec.rb +1 -1
  99. metadata +12 -5
@@ -159,7 +159,7 @@ describe Chef::Provider::RemoteFile::Content do
159
159
 
160
160
  describe "when there is an array of sources and the first fails" do
161
161
 
162
- # https://github.com/opscode/chef/pull/1358#issuecomment-40853299
162
+ # https://github.com/chef/chef/pull/1358#issuecomment-40853299
163
163
  def create_exception(exception_class)
164
164
  if [ Net::HTTPServerException, Net::HTTPFatalError ].include? exception_class
165
165
  exception_class.new("message", { "something" => 1 })
@@ -278,18 +278,20 @@ describe Chef::Provider::Service::Upstart do
278
278
  end
279
279
 
280
280
  it "should call the start command if one is specified" do
281
+ @provider.upstart_service_running = false
281
282
  allow(@new_resource).to receive(:start_command).and_return("/sbin/rsyslog startyousillysally")
282
283
  expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog startyousillysally")
283
284
  @provider.start_service()
284
285
  end
285
286
 
286
287
  it "should call '/sbin/start service_name' if no start command is specified" do
288
+ @provider.upstart_service_running = false
287
289
  expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/start #{@new_resource.service_name}").and_return(shell_out_success)
288
290
  @provider.start_service()
289
291
  end
290
292
 
291
293
  it "should not call '/sbin/start service_name' if it is already running" do
292
- allow(@current_resource).to receive(:running).and_return(true)
294
+ @provider.upstart_service_running = true
293
295
  expect(@provider).not_to receive(:shell_out_with_systems_locale!)
294
296
  @provider.start_service()
295
297
  end
@@ -310,13 +312,16 @@ describe Chef::Provider::Service::Upstart do
310
312
  @provider.restart_service()
311
313
  end
312
314
 
313
- it "should call '/sbin/restart service_name' if no restart command is specified" do
314
- allow(@current_resource).to receive(:running).and_return(true)
315
- expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/restart #{@new_resource.service_name}").and_return(shell_out_success)
315
+ it "should call start/sleep/stop if no restart command is specified" do
316
+ @provider.upstart_service_running = true
317
+ expect(@provider).to receive(:stop_service)
318
+ expect(@provider).to receive(:sleep).with(1)
319
+ expect(@provider).to receive(:start_service)
316
320
  @provider.restart_service()
317
321
  end
318
322
 
319
323
  it "should call '/sbin/start service_name' if restart_service is called for a stopped service" do
324
+ @provider.upstart_service_running = false
320
325
  allow(@current_resource).to receive(:running).and_return(false)
321
326
  expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/start #{@new_resource.service_name}").and_return(shell_out_success)
322
327
  @provider.restart_service()
@@ -336,22 +341,24 @@ describe Chef::Provider::Service::Upstart do
336
341
  end
337
342
 
338
343
  it "should call the stop command if one is specified" do
339
- allow(@current_resource).to receive(:running).and_return(true)
344
+ @provider.upstart_service_running = true
340
345
  allow(@new_resource).to receive(:stop_command).and_return("/sbin/rsyslog stopyousillysally")
341
346
  expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/rsyslog stopyousillysally")
342
347
  @provider.stop_service()
343
348
  end
344
349
 
345
350
  it "should call '/sbin/stop service_name' if no stop command is specified" do
346
- allow(@current_resource).to receive(:running).and_return(true)
351
+ @provider.upstart_service_running = true
347
352
  expect(@provider).to receive(:shell_out_with_systems_locale!).with("/sbin/stop #{@new_resource.service_name}").and_return(shell_out_success)
348
353
  @provider.stop_service()
349
354
  end
350
355
 
351
356
  it "should not call '/sbin/stop service_name' if it is already stopped" do
357
+ @provider.upstart_service_running = false
352
358
  allow(@current_resource).to receive(:running).and_return(false)
353
359
  expect(@provider).not_to receive(:shell_out_with_systems_locale!).with("/sbin/stop #{@new_resource.service_name}")
354
360
  @provider.stop_service()
361
+ expect(@upstart_service_running).to be_falsey
355
362
  end
356
363
  end
357
364
  end
@@ -99,20 +99,43 @@ describe Chef::Provider::User::Solaris do
99
99
  end
100
100
 
101
101
  describe "when managing user locked status" do
102
+ let(:user_lock) { "adam:FOO:::::::" }
103
+ let(:shadow_file_contents) do
104
+ %W{
105
+ user1:LK:::::::
106
+ #{user_lock}
107
+ user2:NP:::::::
108
+ }
109
+ end
110
+
102
111
  describe "when determining if the user is locked" do
112
+ before do
113
+ allow(IO).to receive(:read).and_return(shadow_file_contents.join("\n"))
114
+ end
115
+
116
+ context "when user does not exist" do
117
+ let(:user_lock) { "other_user:FOO:::::::" }
118
+
119
+ it "should raise a sensible error" do
120
+ expect { provider.check_lock }.to raise_error(Chef::Exceptions::User)
121
+ end
122
+ end
103
123
 
104
124
  # locked shadow lines
105
125
  [
106
- "adam:LK:::::::",
107
126
  "adam:*LK*:::::::",
108
127
  "adam:*LK*foobar:::::::",
109
128
  "adam:*LK*bahamas10:::::::",
129
+ "adam:*LK*goonawaLK:::::::",
130
+ "adam:*LK*LKgir:::::::",
110
131
  "adam:*LK*L....:::::::",
111
132
  ].each do |shadow|
112
- it "should return true if user is locked with #{shadow}" do
113
- shell_return = shellcmdresult.new(shadow + "\n", "", 0)
114
- expect(provider).to receive(:shell_out!).with("getent", "shadow", "adam").and_return(shell_return)
115
- expect(provider.check_lock).to eql(true)
133
+ context "for user 'adam' with entry '#{shadow}'" do
134
+ let(:user_lock) { shadow }
135
+
136
+ it "should return true" do
137
+ expect(provider.check_lock).to eql(true)
138
+ end
116
139
  end
117
140
  end
118
141
 
@@ -122,12 +145,16 @@ describe Chef::Provider::User::Solaris do
122
145
  "adam:*NP*:::::::",
123
146
  "adam:foobar:::::::",
124
147
  "adam:bahamas10:::::::",
148
+ "adam:goonawaLK:::::::",
149
+ "adam:LKgir:::::::",
125
150
  "adam:L...:::::::",
126
151
  ].each do |shadow|
127
- it "should return false if user is unlocked with #{shadow}" do
128
- shell_return = shellcmdresult.new(shadow + "\n", "", 0)
129
- expect(provider).to receive(:shell_out!).with("getent", "shadow", "adam").and_return(shell_return)
130
- expect(provider.check_lock).to eql(false)
152
+ context "for user 'adam' with entry '#{shadow}'" do
153
+ let(:user_lock) { shadow }
154
+
155
+ it "should return false" do
156
+ expect(provider.check_lock).to eql(false)
157
+ end
131
158
  end
132
159
  end
133
160
  end
@@ -221,6 +221,12 @@ describe Chef::Provider::User do
221
221
  it "should return false if the objects are identical" do
222
222
  expect(@provider.compare_user).to eql(false)
223
223
  end
224
+
225
+ it "should ignore differences in trailing slash in home paths" do
226
+ @new_resource.home "/home/adam"
227
+ @current_resource.home "/home/adam/"
228
+ expect(@provider.compare_user).to eql(false)
229
+ end
224
230
  end
225
231
 
226
232
  describe "action_create" do
@@ -24,7 +24,7 @@ describe Chef::Resource::AptRepository do
24
24
  let(:run_context) { Chef::RunContext.new(node, {}, events) }
25
25
  let(:resource) { Chef::Resource::AptRepository.new("multiverse", run_context) }
26
26
 
27
- it "should create a new Chef::Resource::AptUpdate" do
27
+ it "should create a new Chef::Resource::AptRepository" do
28
28
  expect(resource).to be_a_kind_of(Chef::Resource)
29
29
  expect(resource).to be_a_kind_of(Chef::Resource::AptRepository)
30
30
  end
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: 12.15.19
4
+ version: 12.16.42
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: 2016-10-07 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-config
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 12.15.19
19
+ version: 12.16.42
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: 12.15.19
26
+ version: 12.16.42
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mixlib-cli
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -1344,6 +1344,10 @@ files:
1344
1344
  - lib/chef/node/attribute_collections.rb
1345
1345
  - lib/chef/node/common_api.rb
1346
1346
  - lib/chef/node/immutable_collections.rb
1347
+ - lib/chef/node/mixin/deep_merge_cache.rb
1348
+ - lib/chef/node/mixin/immutablize_array.rb
1349
+ - lib/chef/node/mixin/immutablize_hash.rb
1350
+ - lib/chef/node/mixin/state_tracking.rb
1347
1351
  - lib/chef/node_map.rb
1348
1352
  - lib/chef/null_logger.rb
1349
1353
  - lib/chef/org.rb
@@ -1996,6 +2000,7 @@ files:
1996
2000
  - spec/data/templates/chef-seattle20160930-4388-umeq2c.txt
1997
2001
  - spec/data/templates/seattle.txt
1998
2002
  - spec/data/trusted_certs/example.crt
2003
+ - spec/data/trusted_certs/example_no_cn.crt
1999
2004
  - spec/data/trusted_certs/intermediate.pem
2000
2005
  - spec/data/trusted_certs/opscode.pem
2001
2006
  - spec/data/trusted_certs/root.pem
@@ -2141,6 +2146,7 @@ files:
2141
2146
  - spec/integration/knife/serve_spec.rb
2142
2147
  - spec/integration/knife/show_spec.rb
2143
2148
  - spec/integration/knife/upload_spec.rb
2149
+ - spec/integration/recipes/accumulator_spec.rb
2144
2150
  - spec/integration/recipes/lwrp_inline_resources_spec.rb
2145
2151
  - spec/integration/recipes/lwrp_spec.rb
2146
2152
  - spec/integration/recipes/noop_resource_spec.rb
@@ -2489,6 +2495,7 @@ files:
2489
2495
  - spec/unit/provider/group/groupadd_spec.rb
2490
2496
  - spec/unit/provider/group/groupmod_spec.rb
2491
2497
  - spec/unit/provider/group/pw_spec.rb
2498
+ - spec/unit/provider/group/suse_spec.rb
2492
2499
  - spec/unit/provider/group/usermod_spec.rb
2493
2500
  - spec/unit/provider/group/windows_spec.rb
2494
2501
  - spec/unit/provider/group_spec.rb
@@ -2741,7 +2748,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
2741
2748
  version: '0'
2742
2749
  requirements: []
2743
2750
  rubyforge_project:
2744
- rubygems_version: 2.6.7
2751
+ rubygems_version: 2.6.8
2745
2752
  signing_key:
2746
2753
  specification_version: 4
2747
2754
  summary: A systems integration framework, built to bring the benefits of configuration