chef 12.5.1 → 12.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +6 -1
- data/README.md +6 -4
- data/Rakefile +1 -4
- data/chef-windows.gemspec +21 -0
- data/chef.gemspec +58 -0
- data/lib/chef/api_client/registration.rb +9 -4
- data/lib/chef/application.rb +3 -84
- data/lib/chef/application/apply.rb +9 -2
- data/lib/chef/application/client.rb +8 -3
- data/lib/chef/application/solo.rb +7 -1
- data/lib/chef/application/windows_service.rb +21 -6
- data/lib/chef/application/windows_service_manager.rb +2 -3
- data/lib/chef/audit/runner.rb +1 -0
- data/lib/chef/chef_class.rb +1 -11
- data/lib/chef/chef_fs/chef_fs_data_store.rb +181 -2
- data/lib/chef/chef_fs/file_system/cookbook_subdir.rb +5 -0
- data/lib/chef/chef_fs/file_system/file_system_entry.rb +11 -7
- data/lib/chef/client.rb +28 -1
- data/lib/chef/cookbook/cookbook_collection.rb +14 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +1 -1
- data/lib/chef/cookbook/metadata.rb +115 -9
- data/lib/chef/cookbook/remote_file_vendor.rb +1 -1
- data/lib/chef/cookbook_version.rb +6 -2
- data/lib/chef/data_bag.rb +1 -1
- data/lib/chef/data_bag_item.rb +1 -1
- data/lib/chef/digester.rb +5 -1
- data/lib/chef/dsl/chef_provisioning.rb +57 -0
- data/lib/chef/dsl/cheffish.rb +64 -0
- data/lib/chef/dsl/declare_resource.rb +108 -0
- data/lib/chef/dsl/platform_introspection.rb +3 -3
- data/lib/chef/dsl/recipe.rb +3 -73
- data/lib/chef/dsl/resources.rb +27 -1
- data/lib/chef/event_dispatch/base.rb +3 -0
- data/lib/chef/event_dispatch/dispatcher.rb +5 -0
- data/lib/chef/event_dispatch/events_output_stream.rb +8 -0
- data/lib/chef/exceptions.rb +21 -1
- data/lib/chef/file_access_control/unix.rb +12 -12
- data/lib/chef/file_content_management/deploy/cp.rb +2 -2
- data/lib/chef/file_content_management/deploy/mv_unix.rb +4 -4
- data/lib/chef/file_content_management/deploy/mv_windows.rb +1 -1
- data/lib/chef/formatters/base.rb +7 -0
- data/lib/chef/formatters/error_inspectors/compile_error_inspector.rb +2 -2
- data/lib/chef/formatters/indentable_output_stream.rb +5 -0
- data/lib/chef/http.rb +19 -3
- data/lib/chef/http/decompressor.rb +2 -2
- data/lib/chef/json_compat.rb +1 -0
- data/lib/chef/knife.rb +16 -2
- data/lib/chef/knife/bootstrap.rb +55 -10
- data/lib/chef/knife/cookbook_site_install.rb +5 -1
- data/lib/chef/knife/core/bootstrap_context.rb +2 -1
- data/lib/chef/knife/core/node_presenter.rb +1 -1
- data/lib/chef/knife/ssh.rb +30 -16
- data/lib/chef/knife/ssl_check.rb +4 -2
- data/lib/chef/knife/ssl_fetch.rb +3 -2
- data/lib/chef/knife/status.rb +14 -1
- data/lib/chef/log.rb +14 -0
- data/lib/chef/mixin/get_source_from_package.rb +7 -2
- data/lib/chef/mixin/properties.rb +302 -0
- data/lib/chef/mixin/proxified_socket.rb +38 -0
- data/lib/chef/mixin/subclass_directive.rb +37 -0
- data/lib/chef/node.rb +13 -5
- data/lib/chef/platform/query_helpers.rb +14 -3
- data/lib/chef/platform/service_helpers.rb +20 -38
- data/lib/chef/policy_builder/expand_node_object.rb +3 -0
- data/lib/chef/policy_builder/policyfile.rb +1 -0
- data/lib/chef/property.rb +51 -12
- data/lib/chef/provider.rb +40 -35
- data/lib/chef/provider/deploy.rb +1 -1
- data/lib/chef/provider/dsc_resource.rb +54 -20
- data/lib/chef/provider/execute.rb +25 -4
- data/lib/chef/provider/group.rb +1 -1
- data/lib/chef/provider/lwrp_base.rb +1 -0
- data/lib/chef/provider/package.rb +76 -30
- data/lib/chef/provider/package/dpkg.rb +152 -69
- data/lib/chef/provider/package/openbsd.rb +6 -8
- data/lib/chef/provider/package/solaris.rb +2 -0
- data/lib/chef/provider/package/windows.rb +95 -14
- data/lib/chef/provider/package/windows/exe.rb +129 -0
- data/lib/chef/provider/package/windows/msi.rb +37 -13
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +89 -0
- data/lib/chef/provider/package/yum.rb +13 -3
- data/lib/chef/provider/powershell_script.rb +3 -0
- data/lib/chef/provider/remote_file/cache_control_data.rb +37 -4
- data/lib/chef/provider/remote_file/http.rb +1 -1
- data/lib/chef/provider/script.rb +1 -0
- data/lib/chef/provider/service.rb +13 -10
- data/lib/chef/provider/service/solaris.rb +43 -17
- data/lib/chef/provider/service/upstart.rb +3 -3
- data/lib/chef/provider/user.rb +1 -1
- data/lib/chef/provider/user/dscl.rb +111 -100
- data/lib/chef/provider/user/windows.rb +5 -3
- data/lib/chef/recipe.rb +3 -5
- data/lib/chef/resource.rb +77 -320
- data/lib/chef/resource/action_class.rb +4 -0
- data/lib/chef/resource/dpkg_package.rb +4 -3
- data/lib/chef/resource/dsc_resource.rb +40 -2
- data/lib/chef/resource/execute.rb +9 -1
- data/lib/chef/resource/ksh.rb +32 -0
- data/lib/chef/resource/lwrp_base.rb +6 -10
- data/lib/chef/resource/package.rb +8 -9
- data/lib/chef/resource/registry_key.rb +1 -1
- data/lib/chef/resource/resource_notification.rb +14 -1
- data/lib/chef/resource/script.rb +1 -1
- data/lib/chef/resource/windows_package.rb +1 -1
- data/lib/chef/resource_builder.rb +14 -7
- data/lib/chef/resource_reporter.rb +6 -0
- data/lib/chef/resources.rb +1 -7
- data/lib/chef/rest.rb +1 -1
- data/lib/chef/run_context.rb +45 -2
- data/lib/chef/run_list/run_list_expansion.rb +47 -0
- data/lib/chef/runner.rb +25 -0
- data/lib/chef/search/query.rb +16 -2
- data/lib/chef/util/diff.rb +2 -2
- data/lib/chef/util/powershell/ps_credential.rb +2 -3
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/file.rb +51 -1
- data/lib/chef/win32/file.rb +5 -0
- data/lib/chef/win32/file/version_info.rb +93 -0
- data/lib/chef/win32/mutex.rb +1 -1
- data/spec/data/apt/chef-integration-test2-1.0/debian/changelog +5 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.debhelper.log +45 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.substvars +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/conffiles +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/control +10 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/md5sums +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/compat +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/conffiles +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/control +13 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/copyright +34 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/files +1 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/rules +13 -0
- data/spec/data/apt/chef-integration-test2-1.0/debian/source/format +1 -0
- data/spec/data/apt/chef-integration-test2_1.0-1.debian.tar.gz +0 -0
- data/spec/data/apt/chef-integration-test2_1.0-1.dsc +18 -0
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.build +91 -0
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.changes +31 -0
- data/spec/data/apt/chef-integration-test2_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test2_1.0.orig.tar.gz +0 -0
- data/spec/functional/application_spec.rb +1 -1
- data/spec/functional/audit/runner_spec.rb +4 -0
- data/spec/functional/knife/ssh_spec.rb +5 -5
- data/spec/functional/notifications_spec.rb +74 -4
- data/spec/functional/resource/aix_service_spec.rb +2 -2
- data/spec/functional/resource/dpkg_package_spec.rb +339 -0
- data/spec/functional/resource/ifconfig_spec.rb +3 -1
- data/spec/functional/resource/mount_spec.rb +5 -2
- data/spec/functional/resource/package_spec.rb +1 -1
- data/spec/functional/resource/user/windows_spec.rb +8 -0
- data/spec/functional/resource/windows_package_spec.rb +177 -0
- data/spec/functional/win32/version_info_spec.rb +50 -0
- data/spec/integration/client/client_spec.rb +80 -0
- data/spec/integration/knife/download_spec.rb +9 -0
- data/spec/integration/knife/upload_spec.rb +28 -1
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +93 -23
- data/spec/integration/recipes/resource_action_spec.rb +211 -116
- data/spec/integration/recipes/resource_converge_if_changed_spec.rb +72 -0
- data/spec/integration/solo/solo_spec.rb +34 -0
- data/spec/spec_helper.rb +11 -1
- data/spec/support/platform_helpers.rb +8 -0
- data/spec/support/shared/integration/integration_helper.rb +6 -0
- data/spec/support/shared/unit/execute_resource.rb +5 -0
- data/spec/support/shared/unit/platform_introspector.rb +7 -0
- data/spec/tiny_server.rb +6 -2
- data/spec/unit/api_client/registration_spec.rb +5 -4
- data/spec/unit/application_spec.rb +1 -181
- data/spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb +34 -0
- data/spec/unit/cookbook/metadata_spec.rb +122 -2
- data/spec/unit/http_spec.rb +102 -0
- data/spec/unit/knife/bootstrap_spec.rb +55 -13
- data/spec/unit/knife/core/bootstrap_context_spec.rb +10 -3
- data/spec/unit/knife/ssl_check_spec.rb +7 -3
- data/spec/unit/knife/ssl_fetch_spec.rb +2 -2
- data/spec/unit/knife/status_spec.rb +13 -13
- data/spec/unit/knife_spec.rb +26 -2
- data/spec/unit/lwrp_spec.rb +1 -1
- data/spec/unit/mixin/properties_spec.rb +97 -0
- data/spec/unit/mixin/proxified_socket_spec.rb +94 -0
- data/spec/unit/mixin/subclass_directive_spec.rb +45 -0
- data/spec/unit/node_spec.rb +9 -1
- data/spec/unit/policy_builder/policyfile_spec.rb +2 -0
- data/spec/unit/property/validation_spec.rb +14 -12
- data/spec/unit/property_spec.rb +56 -0
- data/spec/unit/provider/deploy_spec.rb +1 -1
- data/spec/unit/provider/dsc_resource_spec.rb +63 -24
- data/spec/unit/provider/execute_spec.rb +95 -28
- data/spec/unit/provider/package/dpkg_spec.rb +185 -96
- data/spec/unit/provider/package/windows/exe_spec.rb +251 -0
- data/spec/unit/provider/package/windows/msi_spec.rb +94 -10
- data/spec/unit/provider/package/windows_spec.rb +227 -26
- data/spec/unit/provider/package/yum_spec.rb +6 -0
- data/spec/unit/provider/package_spec.rb +495 -366
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +62 -36
- data/spec/unit/provider/script_spec.rb +2 -2
- data/spec/unit/provider/service/solaris_smf_service_spec.rb +110 -39
- data/spec/unit/provider/service/upstart_service_spec.rb +19 -0
- data/spec/unit/provider/user/dscl_spec.rb +14 -0
- data/spec/unit/provider/user/windows_spec.rb +2 -2
- data/spec/unit/provider/user_spec.rb +9 -0
- data/spec/unit/provider_resolver_spec.rb +6 -30
- data/spec/unit/recipe_spec.rb +46 -20
- data/spec/unit/resource/chef_gem_spec.rb +1 -1
- data/spec/unit/resource/dsc_resource_spec.rb +14 -3
- data/spec/unit/resource/ksh_spec.rb +40 -0
- data/spec/unit/resource/registry_key_spec.rb +2 -2
- data/spec/unit/resource/resource_notification_spec.rb +44 -45
- data/spec/unit/resource_reporter_spec.rb +7 -0
- data/spec/unit/resource_spec.rb +268 -253
- data/spec/unit/rest_spec.rb +2 -2
- data/spec/unit/run_list/run_list_expansion_spec.rb +18 -3
- data/spec/unit/search/query_spec.rb +19 -1
- data/spec/unit/util/powershell/ps_credential_spec.rb +8 -1
- data/spec/unit/windows_service_spec.rb +83 -38
- data/tasks/external_tests.rb +19 -9
- data/tasks/rspec.rb +1 -1
- metadata +64 -15
- data/spec/support/pedant/Gemfile +0 -3
- data/spec/support/pedant/pedant_config.rb +0 -129
- data/spec/support/pedant/run_pedant.rb +0 -63
- data/spec/support/pedant/stickywicket.pem +0 -27
- data/spec/unit/provider/package_spec.rbe +0 -0
data/spec/unit/rest_spec.rb
CHANGED
@@ -69,8 +69,8 @@ describe Chef::REST do
|
|
69
69
|
rest
|
70
70
|
end
|
71
71
|
|
72
|
-
let(:standard_read_headers) {{"Accept"=>"application/json", "Accept
|
73
|
-
let(:standard_write_headers) {{"Accept"=>"application/json", "Content-Type"=>"application/json", "Accept
|
72
|
+
let(:standard_read_headers) {{"Accept"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
|
73
|
+
let(:standard_write_headers) {{"Accept"=>"application/json", "Content-Type"=>"application/json", "Accept-Encoding"=>"gzip;q=1.0,deflate;q=0.6,identity;q=0.3", "X-REMOTE-REQUEST-ID"=>request_id, 'X-Ops-Server-API-Version' => Chef::HTTP::Authenticator::DEFAULT_SERVER_API_VERSION}}
|
74
74
|
|
75
75
|
before(:each) do
|
76
76
|
Chef::Log.init(log_stringio)
|
@@ -21,7 +21,7 @@ require 'spec_helper'
|
|
21
21
|
describe Chef::RunList::RunListExpansion do
|
22
22
|
before do
|
23
23
|
@run_list = Chef::RunList.new
|
24
|
-
@run_list << 'recipe[lobster]' << 'role[rage]' << 'recipe[fist]'
|
24
|
+
@run_list << 'recipe[lobster::mastercookbook@0.1.0]' << 'role[rage]' << 'recipe[fist@0.1]'
|
25
25
|
@expansion = Chef::RunList::RunListExpansion.new("_default", @run_list.run_list_items)
|
26
26
|
end
|
27
27
|
|
@@ -59,7 +59,7 @@ describe Chef::RunList::RunListExpansion do
|
|
59
59
|
end
|
60
60
|
|
61
61
|
it "has the correct list of recipes for the given environment" do
|
62
|
-
expect(@expansion.recipes).to eq(["lobster", "prod-only", "fist"])
|
62
|
+
expect(@expansion.recipes).to eq(["lobster::mastercookbook", "prod-only", "fist"])
|
63
63
|
end
|
64
64
|
|
65
65
|
end
|
@@ -82,19 +82,34 @@ describe Chef::RunList::RunListExpansion do
|
|
82
82
|
describe "after expanding a run list" do
|
83
83
|
before do
|
84
84
|
@first_role = Chef::Role.new
|
85
|
+
@first_role.name('rage')
|
85
86
|
@first_role.run_list('role[mollusk]')
|
86
87
|
@first_role.default_attributes({'foo' => 'bar'})
|
87
88
|
@first_role.override_attributes({'baz' => 'qux'})
|
88
89
|
@second_role = Chef::Role.new
|
90
|
+
@second_role.name('rage')
|
89
91
|
@second_role.run_list('recipe[crabrevenge]')
|
90
92
|
@second_role.default_attributes({'foo' => 'boo'})
|
91
93
|
@second_role.override_attributes({'baz' => 'bux'})
|
92
94
|
allow(@expansion).to receive(:fetch_role).and_return(@first_role, @second_role)
|
93
95
|
@expansion.expand
|
96
|
+
@json = '{"id":"_default","run_list":[{"type":"recipe","name":"lobster::mastercookbook","version":"0.1.0",'
|
97
|
+
.concat(
|
98
|
+
'"skipped":false},{"type":"role","name":"rage","children":[{"type":"role","name":"mollusk","children":[],"missing":null,'
|
99
|
+
.concat(
|
100
|
+
'"error":null,"skipped":null},{"type":"recipe","name":"crabrevenge","version":null,"skipped":false}],"missing":null,'
|
101
|
+
.concat(
|
102
|
+
'"error":null,"skipped":null},{"type":"recipe","name":"fist","version":"0.1","skipped":false}]}')))
|
103
|
+
|
104
|
+
end
|
105
|
+
|
106
|
+
it "produces json tree upon tracing expansion" do
|
107
|
+
jsonRunList = @expansion.to_json
|
108
|
+
expect(jsonRunList).to eq(@json)
|
94
109
|
end
|
95
110
|
|
96
111
|
it "has the ordered list of recipes" do
|
97
|
-
expect(@expansion.recipes).to eq(['lobster', 'crabrevenge', 'fist'])
|
112
|
+
expect(@expansion.recipes).to eq(['lobster::mastercookbook', 'crabrevenge', 'fist'])
|
98
113
|
end
|
99
114
|
|
100
115
|
it "has the merged attributes from the roles with outer roles overriding inner" do
|
@@ -83,6 +83,8 @@ describe Chef::Search::Query do
|
|
83
83
|
describe "search" do
|
84
84
|
let(:query_string) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0" }
|
85
85
|
let(:query_string_continue) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=4" }
|
86
|
+
let(:query_string_with_rows) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=0&rows=4" }
|
87
|
+
let(:query_string_continue_with_rows) { "search/node?q=platform:rhel&sort=X_CHEF_id_CHEF_X%20asc&start=4&rows=4" }
|
86
88
|
|
87
89
|
let(:response) { {
|
88
90
|
"rows" => [
|
@@ -149,6 +151,14 @@ describe Chef::Search::Query do
|
|
149
151
|
r
|
150
152
|
}
|
151
153
|
|
154
|
+
let(:big_response_empty) {
|
155
|
+
{
|
156
|
+
"start" => 0,
|
157
|
+
"total" => 8,
|
158
|
+
"rows" => []
|
159
|
+
}
|
160
|
+
}
|
161
|
+
|
152
162
|
let(:big_response_end) {
|
153
163
|
r = response.dup
|
154
164
|
r["start"] = 4
|
@@ -208,7 +218,7 @@ describe Chef::Search::Query do
|
|
208
218
|
it "pages through the responses" do
|
209
219
|
@call_me = double("blocky")
|
210
220
|
response["rows"].each { |r| expect(@call_me).to receive(:do).with(r) }
|
211
|
-
query.search(:node, "*:*", sort: nil, start: 0, rows:
|
221
|
+
query.search(:node, "*:*", sort: nil, start: 0, rows: 4) { |r| @call_me.do(r) }
|
212
222
|
end
|
213
223
|
|
214
224
|
it "sends multiple API requests when the server indicates there is more data" do
|
@@ -219,6 +229,14 @@ describe Chef::Search::Query do
|
|
219
229
|
end
|
220
230
|
end
|
221
231
|
|
232
|
+
it "paginates correctly in the face of filtered nodes" do
|
233
|
+
expect(rest).to receive(:get_rest).with(query_string_with_rows).and_return(big_response_empty)
|
234
|
+
expect(rest).to receive(:get_rest).with(query_string_continue_with_rows).and_return(big_response_end)
|
235
|
+
query.search(:node, "platform:rhel", rows: 4) do |r|
|
236
|
+
nil
|
237
|
+
end
|
238
|
+
end
|
239
|
+
|
222
240
|
context "when :filter_result is provided as a result" do
|
223
241
|
include_context "filtered search" do
|
224
242
|
let(:filter_key) { :filter_result }
|
@@ -21,7 +21,7 @@ require 'chef/util/powershell/ps_credential'
|
|
21
21
|
|
22
22
|
describe Chef::Util::Powershell::PSCredential do
|
23
23
|
let (:username) { 'foo' }
|
24
|
-
let (:password) { '
|
24
|
+
let (:password) { 'ThIsIsThEpAsSwOrD' }
|
25
25
|
|
26
26
|
context 'when username and password are provided' do
|
27
27
|
let(:ps_credential) { Chef::Util::Powershell::PSCredential.new(username, password)}
|
@@ -33,5 +33,12 @@ describe Chef::Util::Powershell::PSCredential do
|
|
33
33
|
"'#{username}',('encrypted' | ConvertTo-SecureString))")
|
34
34
|
end
|
35
35
|
end
|
36
|
+
|
37
|
+
context 'when to_text is called' do
|
38
|
+
it 'should not contain the password' do
|
39
|
+
allow(ps_credential).to receive(:encrypt).with(password).and_return('encrypted')
|
40
|
+
expect(ps_credential.to_text).not_to match(/#{password}/)
|
41
|
+
end
|
42
|
+
end
|
36
43
|
end
|
37
44
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Mukta Aphale (<mukta.aphale@clogeny.com>)
|
3
|
-
# Copyright:: Copyright (c) 2013
|
3
|
+
# Copyright:: Copyright (c) 2013-2015 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");
|
@@ -21,51 +21,96 @@ if Chef::Platform.windows?
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "Chef::Application::WindowsService", :windows_only do
|
24
|
-
let (:
|
25
|
-
let
|
26
|
-
|
24
|
+
let(:shell_out_result) { double('shellout', stdout: nil, stderr: nil) }
|
25
|
+
let(:config_options) do
|
26
|
+
{
|
27
|
+
log_location: STDOUT,
|
28
|
+
config_file: "test_config_file",
|
29
|
+
log_level: :info
|
30
|
+
}
|
31
|
+
end
|
32
|
+
let(:timeout) { 7200 }
|
33
|
+
let(:shellout_options) do
|
34
|
+
{
|
35
|
+
:timeout => timeout,
|
36
|
+
:logger => Chef::Log
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
27
40
|
before do
|
28
|
-
|
29
|
-
allow(
|
30
|
-
allow(
|
41
|
+
Chef::Config.merge!(config_options)
|
42
|
+
allow(subject).to receive(:configure_chef)
|
43
|
+
allow(subject).to receive(:parse_options)
|
44
|
+
allow(MonoLogger).to receive(:new)
|
45
|
+
allow(subject).to receive(:running?).and_return(true, false)
|
46
|
+
allow(subject).to receive(:state).and_return(4)
|
47
|
+
subject.service_init
|
31
48
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
expect(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
49
|
+
|
50
|
+
subject { Chef::Application::WindowsService.new }
|
51
|
+
|
52
|
+
it "passes DEFAULT_LOG_LOCATION to chef-client instead of STDOUT" do
|
53
|
+
expect(subject).to receive(:shell_out).with(
|
54
|
+
"chef-client --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
|
55
|
+
shellout_options
|
56
|
+
).and_return(shell_out_result)
|
57
|
+
subject.service_main
|
41
58
|
end
|
42
59
|
|
43
|
-
context '
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
60
|
+
context 'has a log location configured' do
|
61
|
+
let(:tempfile) { Tempfile.new 'log_file' }
|
62
|
+
let(:config_options) do
|
63
|
+
{
|
64
|
+
log_location: tempfile.path,
|
65
|
+
config_file: "test_config_file",
|
66
|
+
log_level: :info
|
67
|
+
}
|
68
|
+
end
|
69
|
+
|
70
|
+
after do
|
54
71
|
tempfile.unlink
|
55
72
|
end
|
56
73
|
|
57
|
-
it "
|
58
|
-
|
74
|
+
it "uses the configured log location" do
|
75
|
+
expect(subject).to receive(:shell_out).with(
|
76
|
+
"chef-client --no-fork -c test_config_file -L #{tempfile.path}",
|
77
|
+
shellout_options
|
78
|
+
).and_return(shell_out_result)
|
79
|
+
subject.service_main
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'configured to Event Logger' do
|
83
|
+
let(:config_options) do
|
84
|
+
{
|
85
|
+
log_location: Chef::Log::WinEvt.new,
|
86
|
+
config_file: "test_config_file",
|
87
|
+
log_level: :info
|
88
|
+
}
|
89
|
+
end
|
90
|
+
|
91
|
+
it "does not pass log location to new process" do
|
92
|
+
expect(subject).to receive(:shell_out).with(
|
93
|
+
"chef-client --no-fork -c test_config_file",
|
94
|
+
shellout_options
|
95
|
+
).and_return(shell_out_result)
|
96
|
+
subject.service_main
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
context 'configueres a watchdog timeout' do
|
102
|
+
let(:timeout) { 10 }
|
103
|
+
|
104
|
+
before do
|
59
105
|
Chef::Config[:windows_service][:watchdog_timeout] = 10
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
tempfile.unlink
|
106
|
+
end
|
107
|
+
|
108
|
+
it "passes watchdog timeout to new process" do
|
109
|
+
expect(subject).to receive(:shell_out).with(
|
110
|
+
"chef-client --no-fork -c test_config_file -L #{Chef::Application::WindowsService::DEFAULT_LOG_LOCATION}",
|
111
|
+
shellout_options
|
112
|
+
).and_return(shell_out_result)
|
113
|
+
subject.service_main
|
69
114
|
end
|
70
115
|
end
|
71
116
|
end
|
data/tasks/external_tests.rb
CHANGED
@@ -1,38 +1,48 @@
|
|
1
1
|
require 'tempfile'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
CURRENT_GEM_NAME = 'chef'
|
5
|
+
CURRENT_GEM_PATH = File.expand_path('../..', __FILE__)
|
2
6
|
|
3
7
|
def bundle_exec_with_chef(test_gem, commands)
|
4
8
|
gem_path = Bundler.environment.specs[test_gem].first.full_gem_path
|
5
|
-
gemfile_path = File.join(gem_path,
|
9
|
+
gemfile_path = File.join(gem_path, "Gemfile.#{CURRENT_GEM_NAME}-external-test")
|
6
10
|
gemfile = File.open(gemfile_path, "w")
|
7
11
|
begin
|
8
12
|
IO.read(File.join(gem_path, 'Gemfile')).each_line do |line|
|
9
13
|
if line =~ /^\s*gemspec/
|
10
14
|
next
|
11
|
-
elsif line =~ /^\s*gem '
|
15
|
+
elsif line =~ /^\s*gem '#{CURRENT_GEM_NAME}'|\s*gem "#{CURRENT_GEM_NAME}"/
|
12
16
|
next
|
13
17
|
elsif line =~ /^\s*dev_gem\s*['"](.+)['"]\s*$/
|
14
18
|
line = "gem '#{$1}', github: 'poise/#{$1}'"
|
15
|
-
elsif line =~ /\s*gem\s*['"]#{test_gem}['"]/ # foodcritic
|
19
|
+
elsif line =~ /\s*gem\s*['"]#{test_gem}['"]/ # foodcritic end
|
16
20
|
next
|
17
21
|
end
|
18
22
|
gemfile.puts(line)
|
19
23
|
end
|
20
|
-
gemfile.puts("gem
|
24
|
+
gemfile.puts("gem #{CURRENT_GEM_NAME.inspect}, path: #{CURRENT_GEM_PATH.inspect}")
|
21
25
|
gemfile.puts("gemspec path: #{gem_path.inspect}")
|
22
26
|
gemfile.close
|
23
27
|
Dir.chdir(gem_path) do
|
24
|
-
|
25
|
-
|
26
|
-
|
28
|
+
Bundler.with_clean_env do
|
29
|
+
unless system({ 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle install --gemfile #{gemfile_path}")
|
30
|
+
raise "Error running bundle install --gemfile #{gemfile_path} in #{gem_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
|
31
|
+
end
|
32
|
+
Array(commands).each do |command|
|
33
|
+
unless system({ 'BUNDLE_GEMFILE' => gemfile_path, 'RUBYOPT' => nil, 'GEMFILE_MOD' => nil }, "bundle exec #{command}")
|
34
|
+
raise "Error running bundle exec #{command} in #{gem_path} with BUNDLE_GEMFILE=#{gemfile_path}: #{$?.exitstatus}\nGemfile:\n#{IO.read(gemfile_path)}"
|
35
|
+
end
|
36
|
+
end
|
27
37
|
end
|
28
38
|
end
|
29
39
|
ensure
|
30
|
-
File.delete(gemfile_path)
|
40
|
+
File.delete(gemfile_path) if File.exist?(gemfile_path)
|
31
41
|
end
|
32
42
|
end
|
33
43
|
|
34
44
|
EXTERNAL_PROJECTS = {
|
35
|
-
"chef-zero" => [ "rake spec", "rake
|
45
|
+
"chef-zero" => [ "rake spec", "rake cheffs" ],
|
36
46
|
"cheffish" => "rake spec",
|
37
47
|
"chef-provisioning" => "rake spec",
|
38
48
|
"chef-provisioning-aws" => "rake spec",
|
data/tasks/rspec.rb
CHANGED
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.
|
4
|
+
version: 12.6.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: 2015-
|
11
|
+
date: 2015-12-21 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.
|
19
|
+
version: 12.6.0
|
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.
|
26
|
+
version: 12.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mixlib-cli
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -250,42 +250,42 @@ dependencies:
|
|
250
250
|
requirements:
|
251
251
|
- - "~>"
|
252
252
|
- !ruby/object:Gem::Version
|
253
|
-
version: '3.
|
253
|
+
version: '3.4'
|
254
254
|
type: :runtime
|
255
255
|
prerelease: false
|
256
256
|
version_requirements: !ruby/object:Gem::Requirement
|
257
257
|
requirements:
|
258
258
|
- - "~>"
|
259
259
|
- !ruby/object:Gem::Version
|
260
|
-
version: '3.
|
260
|
+
version: '3.4'
|
261
261
|
- !ruby/object:Gem::Dependency
|
262
262
|
name: rspec-expectations
|
263
263
|
requirement: !ruby/object:Gem::Requirement
|
264
264
|
requirements:
|
265
265
|
- - "~>"
|
266
266
|
- !ruby/object:Gem::Version
|
267
|
-
version: '3.
|
267
|
+
version: '3.4'
|
268
268
|
type: :runtime
|
269
269
|
prerelease: false
|
270
270
|
version_requirements: !ruby/object:Gem::Requirement
|
271
271
|
requirements:
|
272
272
|
- - "~>"
|
273
273
|
- !ruby/object:Gem::Version
|
274
|
-
version: '3.
|
274
|
+
version: '3.4'
|
275
275
|
- !ruby/object:Gem::Dependency
|
276
276
|
name: rspec-mocks
|
277
277
|
requirement: !ruby/object:Gem::Requirement
|
278
278
|
requirements:
|
279
279
|
- - "~>"
|
280
280
|
- !ruby/object:Gem::Version
|
281
|
-
version: '3.
|
281
|
+
version: '3.4'
|
282
282
|
type: :runtime
|
283
283
|
prerelease: false
|
284
284
|
version_requirements: !ruby/object:Gem::Requirement
|
285
285
|
requirements:
|
286
286
|
- - "~>"
|
287
287
|
- !ruby/object:Gem::Version
|
288
|
-
version: '3.
|
288
|
+
version: '3.4'
|
289
289
|
- !ruby/object:Gem::Dependency
|
290
290
|
name: rspec_junit_formatter
|
291
291
|
requirement: !ruby/object:Gem::Requirement
|
@@ -342,6 +342,20 @@ dependencies:
|
|
342
342
|
- - "~>"
|
343
343
|
- !ruby/object:Gem::Version
|
344
344
|
version: '1.6'
|
345
|
+
- !ruby/object:Gem::Dependency
|
346
|
+
name: proxifier
|
347
|
+
requirement: !ruby/object:Gem::Requirement
|
348
|
+
requirements:
|
349
|
+
- - "~>"
|
350
|
+
- !ruby/object:Gem::Version
|
351
|
+
version: '1.0'
|
352
|
+
type: :runtime
|
353
|
+
prerelease: false
|
354
|
+
version_requirements: !ruby/object:Gem::Requirement
|
355
|
+
requirements:
|
356
|
+
- - "~>"
|
357
|
+
- !ruby/object:Gem::Version
|
358
|
+
version: '1.0'
|
345
359
|
- !ruby/object:Gem::Dependency
|
346
360
|
name: rack
|
347
361
|
requirement: !ruby/object:Gem::Requirement
|
@@ -409,6 +423,8 @@ files:
|
|
409
423
|
- bin/chef-shell
|
410
424
|
- bin/chef-solo
|
411
425
|
- bin/knife
|
426
|
+
- chef-windows.gemspec
|
427
|
+
- chef.gemspec
|
412
428
|
- distro/common/html/_sources/ctl_chef_client.txt
|
413
429
|
- distro/common/html/_sources/ctl_chef_server.txt
|
414
430
|
- distro/common/html/_sources/ctl_chef_shell.txt
|
@@ -693,7 +709,10 @@ files:
|
|
693
709
|
- lib/chef/digester.rb
|
694
710
|
- lib/chef/dsl.rb
|
695
711
|
- lib/chef/dsl/audit.rb
|
712
|
+
- lib/chef/dsl/chef_provisioning.rb
|
713
|
+
- lib/chef/dsl/cheffish.rb
|
696
714
|
- lib/chef/dsl/data_query.rb
|
715
|
+
- lib/chef/dsl/declare_resource.rb
|
697
716
|
- lib/chef/dsl/definitions.rb
|
698
717
|
- lib/chef/dsl/include_attribute.rb
|
699
718
|
- lib/chef/dsl/include_recipe.rb
|
@@ -942,10 +961,13 @@ files:
|
|
942
961
|
- lib/chef/mixin/path_sanity.rb
|
943
962
|
- lib/chef/mixin/powershell_out.rb
|
944
963
|
- lib/chef/mixin/powershell_type_coercions.rb
|
964
|
+
- lib/chef/mixin/properties.rb
|
945
965
|
- lib/chef/mixin/provides.rb
|
966
|
+
- lib/chef/mixin/proxified_socket.rb
|
946
967
|
- lib/chef/mixin/recipe_definition_dsl_core.rb
|
947
968
|
- lib/chef/mixin/securable.rb
|
948
969
|
- lib/chef/mixin/shell_out.rb
|
970
|
+
- lib/chef/mixin/subclass_directive.rb
|
949
971
|
- lib/chef/mixin/template.rb
|
950
972
|
- lib/chef/mixin/unformatter.rb
|
951
973
|
- lib/chef/mixin/uris.rb
|
@@ -1053,7 +1075,9 @@ files:
|
|
1053
1075
|
- lib/chef/provider/package/smartos.rb
|
1054
1076
|
- lib/chef/provider/package/solaris.rb
|
1055
1077
|
- lib/chef/provider/package/windows.rb
|
1078
|
+
- lib/chef/provider/package/windows/exe.rb
|
1056
1079
|
- lib/chef/provider/package/windows/msi.rb
|
1080
|
+
- lib/chef/provider/package/windows/registry_uninstall_entry.rb
|
1057
1081
|
- lib/chef/provider/package/yum-dump.py
|
1058
1082
|
- lib/chef/provider/package/yum.rb
|
1059
1083
|
- lib/chef/provider/package/zypper.rb
|
@@ -1142,6 +1166,7 @@ files:
|
|
1142
1166
|
- lib/chef/resource/http_request.rb
|
1143
1167
|
- lib/chef/resource/ifconfig.rb
|
1144
1168
|
- lib/chef/resource/ips_package.rb
|
1169
|
+
- lib/chef/resource/ksh.rb
|
1145
1170
|
- lib/chef/resource/link.rb
|
1146
1171
|
- lib/chef/resource/log.rb
|
1147
1172
|
- lib/chef/resource/lwrp_base.rb
|
@@ -1262,6 +1287,7 @@ files:
|
|
1262
1287
|
- lib/chef/win32/eventlog.rb
|
1263
1288
|
- lib/chef/win32/file.rb
|
1264
1289
|
- lib/chef/win32/file/info.rb
|
1290
|
+
- lib/chef/win32/file/version_info.rb
|
1265
1291
|
- lib/chef/win32/handle.rb
|
1266
1292
|
- lib/chef/win32/memory.rb
|
1267
1293
|
- lib/chef/win32/mutex.rb
|
@@ -1293,6 +1319,25 @@ files:
|
|
1293
1319
|
- spec/data/apt/chef-integration-test-1.1/debian/files
|
1294
1320
|
- spec/data/apt/chef-integration-test-1.1/debian/rules
|
1295
1321
|
- spec/data/apt/chef-integration-test-1.1/debian/source/format
|
1322
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/changelog
|
1323
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.debhelper.log
|
1324
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2.substvars
|
1325
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/conffiles
|
1326
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/control
|
1327
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/chef-integration-test2/DEBIAN/md5sums
|
1328
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/compat
|
1329
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/conffiles
|
1330
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/control
|
1331
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/copyright
|
1332
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/files
|
1333
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/rules
|
1334
|
+
- spec/data/apt/chef-integration-test2-1.0/debian/source/format
|
1335
|
+
- spec/data/apt/chef-integration-test2_1.0-1.debian.tar.gz
|
1336
|
+
- spec/data/apt/chef-integration-test2_1.0-1.dsc
|
1337
|
+
- spec/data/apt/chef-integration-test2_1.0-1_amd64.build
|
1338
|
+
- spec/data/apt/chef-integration-test2_1.0-1_amd64.changes
|
1339
|
+
- spec/data/apt/chef-integration-test2_1.0-1_amd64.deb
|
1340
|
+
- spec/data/apt/chef-integration-test2_1.0.orig.tar.gz
|
1296
1341
|
- spec/data/apt/chef-integration-test_1.0-1_amd64.changes
|
1297
1342
|
- spec/data/apt/chef-integration-test_1.0-1_amd64.deb
|
1298
1343
|
- spec/data/apt/chef-integration-test_1.0.orig.tar.gz
|
@@ -1597,6 +1642,7 @@ files:
|
|
1597
1642
|
- spec/functional/resource/cron_spec.rb
|
1598
1643
|
- spec/functional/resource/deploy_revision_spec.rb
|
1599
1644
|
- spec/functional/resource/directory_spec.rb
|
1645
|
+
- spec/functional/resource/dpkg_package_spec.rb
|
1600
1646
|
- spec/functional/resource/dsc_resource_spec.rb
|
1601
1647
|
- spec/functional/resource/dsc_script_spec.rb
|
1602
1648
|
- spec/functional/resource/env_spec.rb
|
@@ -1619,6 +1665,7 @@ files:
|
|
1619
1665
|
- spec/functional/resource/user/dscl_spec.rb
|
1620
1666
|
- spec/functional/resource/user/useradd_spec.rb
|
1621
1667
|
- spec/functional/resource/user/windows_spec.rb
|
1668
|
+
- spec/functional/resource/windows_package_spec.rb
|
1622
1669
|
- spec/functional/resource/windows_service_spec.rb
|
1623
1670
|
- spec/functional/rest_spec.rb
|
1624
1671
|
- spec/functional/run_lock_spec.rb
|
@@ -1632,6 +1679,7 @@ files:
|
|
1632
1679
|
- spec/functional/win32/security_spec.rb
|
1633
1680
|
- spec/functional/win32/service_manager_spec.rb
|
1634
1681
|
- spec/functional/win32/sid_spec.rb
|
1682
|
+
- spec/functional/win32/version_info_spec.rb
|
1635
1683
|
- spec/functional/win32/versions_spec.rb
|
1636
1684
|
- spec/integration/client/client_spec.rb
|
1637
1685
|
- spec/integration/client/ipv6_spec.rb
|
@@ -1681,10 +1729,6 @@ files:
|
|
1681
1729
|
- spec/support/matchers/leak.rb
|
1682
1730
|
- spec/support/mock/constant.rb
|
1683
1731
|
- spec/support/mock/platform.rb
|
1684
|
-
- spec/support/pedant/Gemfile
|
1685
|
-
- spec/support/pedant/pedant_config.rb
|
1686
|
-
- spec/support/pedant/run_pedant.rb
|
1687
|
-
- spec/support/pedant/stickywicket.pem
|
1688
1732
|
- spec/support/platform_helpers.rb
|
1689
1733
|
- spec/support/platforms/prof/gc.rb
|
1690
1734
|
- spec/support/platforms/prof/win32.rb
|
@@ -1743,6 +1787,7 @@ files:
|
|
1743
1787
|
- spec/unit/chef_fs/data_handler/group_handler_spec.rb
|
1744
1788
|
- spec/unit/chef_fs/diff_spec.rb
|
1745
1789
|
- spec/unit/chef_fs/file_pattern_spec.rb
|
1790
|
+
- spec/unit/chef_fs/file_system/cookbook_subdir_spec.rb
|
1746
1791
|
- spec/unit/chef_fs/file_system/operation_failed_error_spec.rb
|
1747
1792
|
- spec/unit/chef_fs/file_system_spec.rb
|
1748
1793
|
- spec/unit/chef_fs/parallelizer.rb
|
@@ -1931,8 +1976,11 @@ files:
|
|
1931
1976
|
- spec/unit/mixin/path_sanity_spec.rb
|
1932
1977
|
- spec/unit/mixin/powershell_out_spec.rb
|
1933
1978
|
- spec/unit/mixin/powershell_type_coercions_spec.rb
|
1979
|
+
- spec/unit/mixin/properties_spec.rb
|
1980
|
+
- spec/unit/mixin/proxified_socket_spec.rb
|
1934
1981
|
- spec/unit/mixin/securable_spec.rb
|
1935
1982
|
- spec/unit/mixin/shell_out_spec.rb
|
1983
|
+
- spec/unit/mixin/subclass_directive_spec.rb
|
1936
1984
|
- spec/unit/mixin/template_spec.rb
|
1937
1985
|
- spec/unit/mixin/unformatter_spec.rb
|
1938
1986
|
- spec/unit/mixin/uris_spec.rb
|
@@ -2012,12 +2060,12 @@ files:
|
|
2012
2060
|
- spec/unit/provider/package/rubygems_spec.rb
|
2013
2061
|
- spec/unit/provider/package/smartos_spec.rb
|
2014
2062
|
- spec/unit/provider/package/solaris_spec.rb
|
2063
|
+
- spec/unit/provider/package/windows/exe_spec.rb
|
2015
2064
|
- spec/unit/provider/package/windows/msi_spec.rb
|
2016
2065
|
- spec/unit/provider/package/windows_spec.rb
|
2017
2066
|
- spec/unit/provider/package/yum_spec.rb
|
2018
2067
|
- spec/unit/provider/package/zypper_spec.rb
|
2019
2068
|
- spec/unit/provider/package_spec.rb
|
2020
|
-
- spec/unit/provider/package_spec.rbe
|
2021
2069
|
- spec/unit/provider/powershell_script_spec.rb
|
2022
2070
|
- spec/unit/provider/registry_key_spec.rb
|
2023
2071
|
- spec/unit/provider/remote_directory_spec.rb
|
@@ -2094,6 +2142,7 @@ files:
|
|
2094
2142
|
- spec/unit/resource/http_request_spec.rb
|
2095
2143
|
- spec/unit/resource/ifconfig_spec.rb
|
2096
2144
|
- spec/unit/resource/ips_package_spec.rb
|
2145
|
+
- spec/unit/resource/ksh_spec.rb
|
2097
2146
|
- spec/unit/resource/link_spec.rb
|
2098
2147
|
- spec/unit/resource/log_spec.rb
|
2099
2148
|
- spec/unit/resource/macports_package_spec.rb
|