chef 11.16.4 → 11.18.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/chef_fs/chef_fs_data_store.rb +3 -2
- data/lib/chef/chef_fs/command_line.rb +3 -2
- data/lib/chef/chef_fs/data_handler/group_data_handler.rb +5 -1
- data/lib/chef/chef_fs/file_system/acl_entry.rb +2 -1
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +2 -1
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +3 -2
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +5 -4
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +4 -4
- data/lib/chef/cookbook/metadata.rb +1 -1
- data/lib/chef/cookbook_version.rb +2 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +3 -3
- data/lib/chef/environment.rb +1 -1
- data/lib/chef/exceptions.rb +19 -2
- data/lib/chef/json_compat.rb +64 -45
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/bootstrap/archlinux-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/centos5-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-aix.erb +2 -2
- data/lib/chef/knife/bootstrap/chef-full.erb +2 -2
- data/lib/chef/knife/bootstrap/fedora13-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu10.04-gems.erb +2 -2
- data/lib/chef/knife/bootstrap/ubuntu12.04-gems.erb +2 -2
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- data/lib/chef/knife/cookbook_site_install.rb +34 -10
- data/lib/chef/knife/cookbook_site_list.rb +1 -1
- data/lib/chef/knife/cookbook_site_search.rb +1 -1
- data/lib/chef/knife/cookbook_site_share.rb +2 -2
- data/lib/chef/knife/cookbook_site_show.rb +3 -3
- data/lib/chef/knife/cookbook_site_unshare.rb +1 -1
- data/lib/chef/knife/core/subcommand_loader.rb +24 -0
- data/lib/chef/knife/deps.rb +3 -2
- data/lib/chef/node.rb +1 -1
- data/lib/chef/provider/deploy/revision.rb +1 -1
- data/lib/chef/provider/dsc_script.rb +32 -5
- data/lib/chef/provider/env.rb +25 -10
- data/lib/chef/provider/remote_file/cache_control_data.rb +1 -1
- data/lib/chef/resource.rb +1 -1
- data/lib/chef/resource/dsc_script.rb +2 -16
- data/lib/chef/resource_collection.rb +1 -1
- data/lib/chef/resource_reporter.rb +3 -3
- data/lib/chef/role.rb +1 -1
- data/lib/chef/run_list.rb +1 -1
- data/lib/chef/user.rb +1 -1
- data/lib/chef/util/dsc/local_configuration_manager.rb +15 -11
- data/lib/chef/util/powershell/cmdlet_result.rb +2 -2
- data/lib/chef/version.rb +1 -2
- data/spec/data/bootstrap/test-hints.erb +1 -1
- data/spec/data/bootstrap/test.erb +1 -1
- data/spec/functional/knife/cookbook_delete_spec.rb +3 -3
- data/spec/functional/knife/exec_spec.rb +1 -1
- data/spec/functional/resource/dsc_script_spec.rb +92 -47
- data/spec/functional/resource/env_spec.rb +3 -4
- data/spec/functional/util/powershell/cmdlet_spec.rb +1 -2
- data/spec/integration/knife/chef_fs_data_store_spec.rb +1 -1
- data/spec/integration/knife/chef_repo_path_spec.rb +6 -1
- data/spec/integration/knife/chef_repository_file_system_spec.rb +1 -1
- data/spec/integration/knife/chefignore_spec.rb +1 -1
- data/spec/integration/knife/common_options_spec.rb +1 -1
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +1 -1
- data/spec/integration/knife/delete_spec.rb +1 -1
- data/spec/integration/knife/deps_spec.rb +1 -1
- data/spec/integration/knife/diff_spec.rb +3 -3
- data/spec/integration/knife/download_spec.rb +3 -3
- data/spec/integration/knife/list_spec.rb +1 -1
- data/spec/integration/knife/raw_spec.rb +11 -1
- data/spec/integration/knife/redirection_spec.rb +1 -1
- data/spec/integration/knife/serve_spec.rb +1 -1
- data/spec/integration/knife/show_spec.rb +1 -1
- data/spec/integration/knife/upload_spec.rb +9 -9
- data/spec/spec_helper.rb +6 -0
- data/spec/support/shared/integration/integration_helper.rb +1 -2
- data/spec/support/shared/shared_examples.rb +10 -0
- data/spec/tiny_server.rb +2 -1
- data/spec/unit/api_client_spec.rb +3 -3
- data/spec/unit/chef_fs/data_handler/group_handler_spec.rb +63 -0
- data/spec/unit/config_fetcher_spec.rb +1 -1
- data/spec/unit/cookbook/metadata_spec.rb +7 -3
- data/spec/unit/cookbook_loader_spec.rb +1 -1
- data/spec/unit/cookbook_version_spec.rb +4 -0
- data/spec/unit/data_bag_item_spec.rb +5 -1
- data/spec/unit/data_bag_spec.rb +5 -1
- data/spec/unit/deprecation_spec.rb +1 -1
- data/spec/unit/encrypted_data_bag_item_spec.rb +14 -7
- data/spec/unit/environment_spec.rb +7 -3
- data/spec/unit/exceptions_spec.rb +6 -0
- data/spec/unit/json_compat_spec.rb +58 -17
- data/spec/unit/knife/cookbook_metadata_from_file_spec.rb +0 -1
- data/spec/unit/knife/cookbook_site_download_spec.rb +2 -1
- data/spec/unit/knife/cookbook_site_install_spec.rb +161 -116
- data/spec/unit/knife/cookbook_site_share_spec.rb +6 -6
- data/spec/unit/knife/core/bootstrap_context_spec.rb +2 -2
- data/spec/unit/knife/core/subcommand_loader_spec.rb +66 -1
- data/spec/unit/knife/data_bag_from_file_spec.rb +1 -2
- data/spec/unit/node_spec.rb +4 -0
- data/spec/unit/provider/dsc_script_spec.rb +134 -105
- data/spec/unit/provider/env/windows_spec.rb +2 -2
- data/spec/unit/provider/env_spec.rb +76 -11
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +1 -1
- data/spec/unit/resource/dsc_script_spec.rb +0 -29
- data/spec/unit/resource_collection_spec.rb +5 -1
- data/spec/unit/resource_reporter_spec.rb +3 -3
- data/spec/unit/resource_spec.rb +5 -1
- data/spec/unit/role_spec.rb +4 -0
- data/spec/unit/run_list_spec.rb +5 -1
- data/spec/unit/user_spec.rb +5 -1
- data/spec/unit/util/dsc/local_configuration_manager_spec.rb +15 -10
- metadata +11 -9
@@ -95,33 +95,4 @@ describe Chef::Resource::DscScript do
|
|
95
95
|
expect { dsc_test_resource.configuration_data_script(configuration_data_script) }.to raise_error(ArgumentError)
|
96
96
|
end
|
97
97
|
end
|
98
|
-
|
99
|
-
context 'when Powershell does not supported Dsc' do
|
100
|
-
['1.0', '2.0', '3.0'].each do |version|
|
101
|
-
it "raises an exception for powershell version '#{version}'" do
|
102
|
-
node = Chef::Node.new
|
103
|
-
node.automatic[:languages][:powershell][:version] = version
|
104
|
-
empty_events = Chef::EventDispatch::Dispatcher.new
|
105
|
-
dsc_test_run_context = Chef::RunContext.new(node, {}, empty_events)
|
106
|
-
|
107
|
-
expect {
|
108
|
-
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
|
109
|
-
}.to raise_error(Chef::Exceptions::NoProviderAvailable)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
context 'when Powershell is not present' do
|
115
|
-
let (:dsc_test_run_context) {
|
116
|
-
node = Chef::Node.new
|
117
|
-
empty_events = Chef::EventDispatch::Dispatcher.new
|
118
|
-
dsc_test_run_context = Chef::RunContext.new(node, {}, empty_events)
|
119
|
-
}
|
120
|
-
|
121
|
-
it 'raises an exception if powershell is not present' do
|
122
|
-
expect {
|
123
|
-
Chef::Resource::DscScript.new(dsc_test_resource_name, dsc_test_run_context)
|
124
|
-
}.to raise_error(Chef::Exceptions::NoProviderAvailable)
|
125
|
-
end
|
126
|
-
end
|
127
98
|
end
|
@@ -245,12 +245,16 @@ describe Chef::ResourceCollection do
|
|
245
245
|
json.should =~ /json_class/
|
246
246
|
json.should =~ /instance_vars/
|
247
247
|
end
|
248
|
+
|
249
|
+
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
250
|
+
let(:subject) { @rc }
|
251
|
+
end
|
248
252
|
end
|
249
253
|
|
250
254
|
describe "self.from_json" do
|
251
255
|
it "should deserialize itself from json" do
|
252
256
|
@rc << @resource
|
253
|
-
json = @rc
|
257
|
+
json = Chef::JSONCompat.to_json(@rc)
|
254
258
|
s_rc = Chef::JSONCompat.from_json(json)
|
255
259
|
s_rc.should be_a_kind_of(Chef::ResourceCollection)
|
256
260
|
s_rc[0].name.should eql(@resource.name)
|
@@ -421,7 +421,7 @@ describe Chef::ResourceReporter do
|
|
421
421
|
|
422
422
|
it "includes the run_list" do
|
423
423
|
@report.should have_key("run_list")
|
424
|
-
@report["run_list"].should == @run_status.node.run_list
|
424
|
+
@report["run_list"].should == Chef::JSONCompat.to_json(@run_status.node.run_list)
|
425
425
|
end
|
426
426
|
|
427
427
|
it "includes the end_time" do
|
@@ -484,7 +484,7 @@ describe Chef::ResourceReporter do
|
|
484
484
|
|
485
485
|
it "includes the exception trace in the event data" do
|
486
486
|
@report["data"]["exception"].should have_key("backtrace")
|
487
|
-
@report["data"]["exception"]["backtrace"].should == @backtrace
|
487
|
+
@report["data"]["exception"]["backtrace"].should == Chef::JSONCompat.to_json(@backtrace)
|
488
488
|
end
|
489
489
|
|
490
490
|
it "includes the error inspector output in the event data" do
|
@@ -701,7 +701,7 @@ describe Chef::ResourceReporter do
|
|
701
701
|
})
|
702
702
|
data_stream = Zlib::GzipReader.new(StringIO.new(data))
|
703
703
|
data = data_stream.read
|
704
|
-
data.should eq(@expected_data
|
704
|
+
data.should eq(Chef::JSONCompat.to_json(@expected_data))
|
705
705
|
response
|
706
706
|
end
|
707
707
|
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -336,6 +336,10 @@ describe Chef::Resource do
|
|
336
336
|
json.should =~ /json_class/
|
337
337
|
json.should =~ /instance_vars/
|
338
338
|
end
|
339
|
+
|
340
|
+
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
341
|
+
let(:subject) { @resource }
|
342
|
+
end
|
339
343
|
end
|
340
344
|
|
341
345
|
describe "to_hash" do
|
@@ -354,7 +358,7 @@ describe Chef::Resource do
|
|
354
358
|
|
355
359
|
describe "self.json_create" do
|
356
360
|
it "should deserialize itself from json" do
|
357
|
-
json = @resource
|
361
|
+
json = Chef::JSONCompat.to_json(@resource)
|
358
362
|
serialized_node = Chef::JSONCompat.from_json(json)
|
359
363
|
serialized_node.should be_a_kind_of(Chef::Resource)
|
360
364
|
serialized_node.name.should eql(@resource.name)
|
data/spec/unit/role_spec.rb
CHANGED
data/spec/unit/run_list_spec.rb
CHANGED
@@ -304,7 +304,11 @@ describe Chef::RunList do
|
|
304
304
|
end
|
305
305
|
|
306
306
|
it "converts to json by converting its array form" do
|
307
|
-
@run_list.
|
307
|
+
Chef::JSONCompat.to_json(@run_list).should == Chef::JSONCompat.to_json(["recipe[nagios::client]", "role[production]", "recipe[apache2]"])
|
308
|
+
end
|
309
|
+
|
310
|
+
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
311
|
+
let(:subject) { @run_list }
|
308
312
|
end
|
309
313
|
|
310
314
|
end
|
data/spec/unit/user_spec.rb
CHANGED
@@ -154,6 +154,10 @@ describe Chef::User do
|
|
154
154
|
it "does not include the password if not present" do
|
155
155
|
@json.should_not include("password")
|
156
156
|
end
|
157
|
+
|
158
|
+
include_examples "to_json equalivent to Chef::JSONCompat.to_json" do
|
159
|
+
let(:subject) { @user }
|
160
|
+
end
|
157
161
|
end
|
158
162
|
|
159
163
|
describe "when deserializing from JSON" do
|
@@ -163,7 +167,7 @@ describe Chef::User do
|
|
163
167
|
"private_key" => "pandas",
|
164
168
|
"password" => "password",
|
165
169
|
"admin" => true }
|
166
|
-
@user = Chef::User.from_json(
|
170
|
+
@user = Chef::User.from_json(Chef::JSONCompat.to_json(user))
|
167
171
|
end
|
168
172
|
|
169
173
|
it "should deserialize to a Chef::User object" do
|
@@ -32,7 +32,7 @@ EOH
|
|
32
32
|
}
|
33
33
|
|
34
34
|
let(:no_whatif_lcm_output) { <<-EOH
|
35
|
-
Start-DscConfiguration : A parameter cannot be found that matches parameter name 'whatif'.
|
35
|
+
Start-DscConfiguration : A parameter cannot be found\r\n that matches parameter name 'whatif'.
|
36
36
|
At line:1 char:123
|
37
37
|
+ run-somecommand -whatif
|
38
38
|
+ ~~~~~~~~
|
@@ -77,8 +77,13 @@ EOH
|
|
77
77
|
let(:lcm_standard_error) { no_whatif_lcm_output }
|
78
78
|
let(:lcm_cmdlet_success) { false }
|
79
79
|
|
80
|
+
it 'returns true when passed to #whatif_not_supported?' do
|
81
|
+
expect(lcm.send(:whatif_not_supported?, no_whatif_lcm_output)).to be_true
|
82
|
+
end
|
83
|
+
|
80
84
|
it 'should should return a (possibly empty) array of ResourceInfo instances' do
|
81
85
|
expect(Chef::Log).to receive(:warn)
|
86
|
+
expect(lcm).to receive(:whatif_not_supported?).and_call_original
|
82
87
|
test_configuration_result = nil
|
83
88
|
expect {test_configuration_result = lcm.test_configuration('config')}.not_to raise_error
|
84
89
|
expect(test_configuration_result.class).to be(Array)
|
@@ -92,7 +97,7 @@ EOH
|
|
92
97
|
|
93
98
|
it 'should log a warning if the message is formatted as expected when a resource import failure occurs' do
|
94
99
|
expect(Chef::Log).to receive(:warn)
|
95
|
-
expect(lcm).to receive(:
|
100
|
+
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
|
96
101
|
test_configuration_result = nil
|
97
102
|
expect {test_configuration_result = lcm.test_configuration('config')}.not_to raise_error
|
98
103
|
end
|
@@ -105,29 +110,29 @@ EOH
|
|
105
110
|
end
|
106
111
|
end
|
107
112
|
|
108
|
-
context 'that fails due to an PowerShell cmdlet error
|
113
|
+
context 'that fails due to an unknown PowerShell cmdlet error' do
|
109
114
|
let(:lcm_standard_output) { 'some output' }
|
110
115
|
let(:lcm_standard_error) { 'Abort, Retry, Fail?' }
|
111
116
|
let(:lcm_cmdlet_success) { false }
|
112
117
|
|
113
|
-
it 'should
|
114
|
-
expect(Chef::Log).
|
115
|
-
expect(lcm).to receive(:
|
116
|
-
expect {lcm.test_configuration('config')}.
|
118
|
+
it 'should log a warning' do
|
119
|
+
expect(Chef::Log).to receive(:warn)
|
120
|
+
expect(lcm).to receive(:dsc_module_import_failure?).and_call_original
|
121
|
+
expect {lcm.test_configuration('config')}.not_to raise_error
|
117
122
|
end
|
118
123
|
end
|
119
124
|
end
|
120
125
|
|
121
126
|
it 'should identify a correctly formatted error message as a resource import failure' do
|
122
|
-
expect(lcm.send(:
|
127
|
+
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output)).to be(true)
|
123
128
|
end
|
124
129
|
|
125
130
|
it 'should not identify an incorrectly formatted error message as a resource import failure' do
|
126
|
-
expect(lcm.send(:
|
131
|
+
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('module', 'gibberish'))).to be(false)
|
127
132
|
end
|
128
133
|
|
129
134
|
it 'should not identify a message without a CimException reference as a resource import failure' do
|
130
|
-
expect(lcm.send(:
|
135
|
+
expect(lcm.send(:dsc_module_import_failure?, dsc_resource_import_failure_output.gsub('CimException', 'ArgumentException'))).to be(false)
|
131
136
|
end
|
132
137
|
end
|
133
138
|
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: 11.
|
4
|
+
version: 11.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-config
|
@@ -134,14 +134,14 @@ dependencies:
|
|
134
134
|
requirements:
|
135
135
|
- - "~>"
|
136
136
|
- !ruby/object:Gem::Version
|
137
|
-
version: '1.
|
137
|
+
version: '1.2'
|
138
138
|
type: :runtime
|
139
139
|
prerelease: false
|
140
140
|
version_requirements: !ruby/object:Gem::Requirement
|
141
141
|
requirements:
|
142
142
|
- - "~>"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '1.
|
144
|
+
version: '1.2'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: net-ssh
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -230,20 +230,20 @@ dependencies:
|
|
230
230
|
requirements:
|
231
231
|
- - "~>"
|
232
232
|
- !ruby/object:Gem::Version
|
233
|
-
version: '2.
|
233
|
+
version: '2.2'
|
234
234
|
- - ">="
|
235
235
|
- !ruby/object:Gem::Version
|
236
|
-
version: 2.1
|
236
|
+
version: 2.2.1
|
237
237
|
type: :runtime
|
238
238
|
prerelease: false
|
239
239
|
version_requirements: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
241
|
- - "~>"
|
242
242
|
- !ruby/object:Gem::Version
|
243
|
-
version: '2.
|
243
|
+
version: '2.2'
|
244
244
|
- - ">="
|
245
245
|
- !ruby/object:Gem::Version
|
246
|
-
version: 2.1
|
246
|
+
version: 2.2.1
|
247
247
|
- !ruby/object:Gem::Dependency
|
248
248
|
name: pry
|
249
249
|
requirement: !ruby/object:Gem::Requirement
|
@@ -1536,6 +1536,7 @@ files:
|
|
1536
1536
|
- spec/support/shared/integration/app_server_support.rb
|
1537
1537
|
- spec/support/shared/integration/integration_helper.rb
|
1538
1538
|
- spec/support/shared/integration/knife_support.rb
|
1539
|
+
- spec/support/shared/shared_examples.rb
|
1539
1540
|
- spec/support/shared/unit/api_error_inspector.rb
|
1540
1541
|
- spec/support/shared/unit/execute_resource.rb
|
1541
1542
|
- spec/support/shared/unit/file_system_support.rb
|
@@ -1554,6 +1555,7 @@ files:
|
|
1554
1555
|
- spec/unit/application/server_spec.rb
|
1555
1556
|
- spec/unit/application/solo_spec.rb
|
1556
1557
|
- spec/unit/application_spec.rb
|
1558
|
+
- spec/unit/chef_fs/data_handler/group_handler_spec.rb
|
1557
1559
|
- spec/unit/chef_fs/diff_spec.rb
|
1558
1560
|
- spec/unit/chef_fs/file_pattern_spec.rb
|
1559
1561
|
- spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
|
@@ -1930,7 +1932,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1930
1932
|
version: '0'
|
1931
1933
|
requirements: []
|
1932
1934
|
rubyforge_project:
|
1933
|
-
rubygems_version: 2.4.
|
1935
|
+
rubygems_version: 2.4.4
|
1934
1936
|
signing_key:
|
1935
1937
|
specification_version: 4
|
1936
1938
|
summary: A systems integration framework, built to bring the benefits of configuration
|