chef 12.0.0.alpha.0 → 12.0.0.alpha.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CONTRIBUTING.md +3 -5
- data/lib/chef/api_client.rb +1 -1
- data/lib/chef/application.rb +16 -8
- data/lib/chef/chef_fs/chef_fs_data_store.rb +1 -1
- data/lib/chef/chef_fs/command_line.rb +1 -1
- data/lib/chef/chef_fs/file_system.rb +1 -1
- data/lib/chef/chef_fs/file_system/acl_entry.rb +1 -1
- data/lib/chef/chef_fs/file_system/chef_repository_file_system_entry.rb +3 -3
- data/lib/chef/chef_fs/file_system/cookbook_file.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_dir.rb +2 -2
- data/lib/chef/chef_fs/file_system/rest_list_entry.rb +4 -4
- data/lib/chef/config.rb +6 -5
- data/lib/chef/config_fetcher.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +126 -43
- data/lib/chef/cookbook/metadata.rb +102 -53
- data/lib/chef/cookbook/syntax_check.rb +1 -1
- data/lib/chef/cookbook_loader.rb +62 -14
- data/lib/chef/cookbook_site_streaming_uploader.rb +12 -1
- data/lib/chef/cookbook_version.rb +13 -4
- data/lib/chef/data_bag.rb +28 -15
- data/lib/chef/data_bag_item.rb +5 -7
- data/lib/chef/digester.rb +5 -9
- data/lib/chef/dsl/recipe.rb +14 -0
- data/lib/chef/encrypted_data_bag_item.rb +1 -0
- data/lib/chef/encrypted_data_bag_item/assertions.rb +57 -0
- data/lib/chef/encrypted_data_bag_item/decryptor.rb +52 -28
- data/lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb +37 -0
- data/lib/chef/encrypted_data_bag_item/encryption_failure.rb +22 -0
- data/lib/chef/encrypted_data_bag_item/encryptor.rb +79 -8
- data/lib/chef/environment.rb +1 -3
- data/lib/chef/exceptions.rb +18 -3
- data/lib/chef/formatters/base.rb +7 -0
- data/lib/chef/formatters/error_inspectors/cookbook_resolve_error_inspector.rb +1 -1
- data/lib/chef/handler/json_file.rb +0 -1
- data/lib/chef/http/json_output.rb +1 -1
- data/lib/chef/json_compat.rb +24 -6
- data/lib/chef/knife/bootstrap.rb +2 -2
- data/lib/chef/knife/client_delete.rb +1 -1
- data/lib/chef/knife/cookbook_site_download.rb +1 -1
- 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/node_editor.rb +2 -3
- data/lib/chef/knife/core/ui.rb +2 -2
- data/lib/chef/knife/deps.rb +2 -3
- data/lib/chef/mixin/shell_out.rb +1 -1
- data/lib/chef/mixin/windows_architecture_helper.rb +1 -0
- data/lib/chef/node.rb +1 -2
- data/lib/chef/platform/provider_mapping.rb +33 -6
- data/lib/chef/provider.rb +0 -2
- data/lib/chef/provider/cookbook_file/content.rb +1 -1
- data/lib/chef/provider/cron.rb +11 -0
- data/lib/chef/provider/deploy.rb +3 -2
- data/lib/chef/provider/deploy/revision.rb +2 -2
- data/lib/chef/provider/env.rb +1 -1
- data/lib/chef/provider/env/windows.rb +5 -9
- data/lib/chef/provider/file.rb +84 -33
- data/lib/chef/provider/git.rb +2 -1
- data/lib/chef/provider/group/aix.rb +17 -2
- data/lib/chef/provider/group/dscl.rb +27 -9
- data/lib/chef/provider/group/pw.rb +8 -1
- data/lib/chef/provider/http_request.rb +4 -4
- data/lib/chef/provider/log.rb +4 -14
- data/lib/chef/provider/mount/mount.rb +2 -2
- data/lib/chef/provider/package/ips.rb +17 -23
- data/lib/chef/provider/package/paludis.rb +2 -2
- data/lib/chef/provider/package/rpm.rb +2 -2
- data/lib/chef/provider/package/rubygems.rb +2 -0
- data/lib/chef/provider/package/yum.rb +2 -0
- data/lib/chef/provider/package/zypper.rb +1 -1
- data/lib/chef/provider/remote_file/cache_control_data.rb +2 -2
- data/lib/chef/provider/service/windows.rb +87 -21
- data/lib/chef/provider/user/aix.rb +95 -0
- data/lib/chef/provider/user/dscl.rb +544 -156
- data/lib/chef/provider/user/useradd.rb +1 -0
- data/lib/chef/providers.rb +1 -0
- data/lib/chef/resource.rb +4 -3
- data/lib/chef/resource/freebsd_package.rb +10 -2
- data/lib/chef/resource/paludis_package.rb +1 -0
- data/lib/chef/resource/scm.rb +10 -0
- data/lib/chef/resource/user.rb +27 -0
- data/lib/chef/resource/windows_service.rb +53 -0
- data/lib/chef/resource_collection.rb +23 -12
- data/lib/chef/resource_reporter.rb +10 -10
- data/lib/chef/resources.rb +1 -0
- data/lib/chef/role.rb +3 -3
- data/lib/chef/run_list.rb +6 -3
- data/lib/chef/user.rb +1 -1
- data/lib/chef/util/diff.rb +1 -2
- data/lib/chef/version.rb +1 -1
- data/lib/chef/version_constraint.rb +4 -4
- data/spec/data/cookbooks/angrybash/metadata.rb +2 -0
- data/spec/data/cookbooks/apache2/metadata.rb +2 -0
- data/spec/data/cookbooks/borken/metadata.rb +2 -0
- data/spec/data/cookbooks/ignorken/metadata.rb +2 -0
- data/spec/data/cookbooks/java/metadata.rb +2 -0
- data/spec/data/cookbooks/name-mismatch-versionnumber/README.md +4 -0
- data/spec/data/cookbooks/name-mismatch-versionnumber/metadata.rb +8 -0
- data/spec/data/cookbooks/name-mismatch-versionnumber/recipes/default.rb +8 -0
- data/spec/data/cookbooks/openldap/files/default/remotedir/not_a_template.erb +2 -0
- data/spec/data/cookbooks/preseed/metadata.rb +2 -0
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/README.md +4 -0
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/metadata.rb +13 -0
- data/spec/data/incomplete-metadata-chef-repo/incomplete-metadata/recipes/default.rb +8 -0
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/README.md +4 -0
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/metadata.rb +10 -0
- data/spec/data/invalid-metadata-chef-repo/invalid-metadata/recipes/default.rb +8 -0
- data/spec/data/mac_users/10.7-8.plist.xml +559 -0
- data/spec/data/mac_users/10.7-8.shadow.xml +11 -0
- data/spec/data/mac_users/10.7.plist.xml +559 -0
- data/spec/data/mac_users/10.7.shadow.xml +11 -0
- data/spec/data/mac_users/10.8.plist.xml +559 -0
- data/spec/data/mac_users/10.8.shadow.xml +21 -0
- data/spec/data/mac_users/10.9.plist.xml +560 -0
- data/spec/data/mac_users/10.9.shadow.xml +21 -0
- data/spec/data/object_loader/environments/test.json +2 -0
- data/spec/data/object_loader/environments/test_json_class.json +2 -0
- data/spec/data/object_loader/nodes/test.json +2 -0
- data/spec/data/object_loader/nodes/test_json_class.json +2 -0
- data/spec/data/object_loader/roles/test.json +2 -0
- data/spec/data/object_loader/roles/test_json_class.json +2 -0
- data/spec/functional/resource/bff_spec.rb +1 -1
- data/spec/functional/resource/cron_spec.rb +20 -1
- data/spec/functional/resource/env_spec.rb +137 -0
- data/spec/functional/resource/group_spec.rb +7 -5
- data/spec/functional/resource/remote_file_spec.rb +12 -1
- data/spec/functional/resource/user/dscl_spec.rb +198 -0
- data/spec/functional/resource/{user_spec.rb → user/useradd_spec.rb} +175 -37
- data/spec/integration/client/client_spec.rb +6 -4
- data/spec/integration/client/ipv6_spec.rb +16 -14
- data/spec/integration/knife/chef_fs_data_store_spec.rb +57 -46
- data/spec/integration/knife/chef_repo_path_spec.rb +105 -78
- data/spec/integration/knife/chef_repository_file_system_spec.rb +100 -84
- data/spec/integration/knife/chefignore_spec.rb +76 -46
- data/spec/integration/knife/common_options_spec.rb +16 -21
- data/spec/integration/knife/cookbook_api_ipv6_spec.rb +3 -3
- data/spec/integration/knife/delete_spec.rb +66 -46
- data/spec/integration/knife/deps_spec.rb +145 -94
- data/spec/integration/knife/diff_spec.rb +176 -110
- data/spec/integration/knife/download_spec.rb +229 -133
- data/spec/integration/knife/list_spec.rb +62 -54
- data/spec/integration/knife/raw_spec.rb +24 -9
- data/spec/integration/knife/redirection_spec.rb +2 -2
- data/spec/integration/knife/serve_spec.rb +2 -2
- data/spec/integration/knife/show_spec.rb +32 -26
- data/spec/integration/knife/upload_spec.rb +308 -165
- data/spec/integration/recipes/lwrp_inline_resources_spec.rb +10 -8
- data/spec/integration/solo/solo_spec.rb +22 -11
- data/spec/spec_helper.rb +3 -0
- data/spec/support/lib/chef/resource/zen_follower.rb +46 -0
- data/spec/support/platform_helpers.rb +12 -0
- data/spec/support/shared/functional/file_resource.rb +10 -0
- data/spec/support/shared/integration/chef_zero_support.rb +130 -0
- data/spec/support/shared/integration/integration_helper.rb +100 -98
- data/spec/support/shared/integration/knife_support.rb +0 -1
- data/spec/support/shared/unit/provider/file.rb +6 -4
- data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +10 -1
- data/spec/unit/api_client/registration_spec.rb +83 -74
- data/spec/unit/application_spec.rb +32 -9
- data/spec/unit/cookbook/cookbook_version_loader_spec.rb +179 -0
- data/spec/unit/cookbook/metadata_spec.rb +190 -150
- data/spec/unit/cookbook/syntax_check_spec.rb +3 -2
- data/spec/unit/cookbook_loader_spec.rb +114 -53
- data/spec/unit/{cookbook_site_streaming_uploader.rb → cookbook_site_streaming_uploader_spec.rb} +21 -1
- data/spec/unit/data_bag_spec.rb +88 -13
- data/spec/unit/deprecation_spec.rb +1 -2
- data/spec/unit/encrypted_data_bag_item_spec.rb +145 -9
- data/spec/unit/environment_spec.rb +1 -1
- data/spec/unit/formatters/base_spec.rb +48 -0
- data/spec/unit/json_compat_spec.rb +48 -17
- data/spec/unit/knife/client_delete_spec.rb +4 -4
- data/spec/unit/knife/client_show_spec.rb +15 -5
- data/spec/unit/knife/cookbook_site_download_spec.rb +1 -1
- data/spec/unit/knife/cookbook_site_share_spec.rb +3 -3
- data/spec/unit/knife/data_bag_from_file_spec.rb +0 -2
- data/spec/unit/knife/data_bag_show_spec.rb +23 -14
- data/spec/unit/knife/node_show_spec.rb +32 -15
- data/spec/unit/knife/role_show_spec.rb +59 -0
- data/spec/unit/platform_spec.rb +10 -0
- data/spec/unit/provider/deploy_spec.rb +4 -0
- data/spec/unit/provider/env_spec.rb +19 -0
- data/spec/unit/provider/git_spec.rb +22 -2
- data/spec/unit/provider/group/dscl_spec.rb +38 -1
- data/spec/unit/provider/group/pw_spec.rb +2 -2
- data/spec/unit/provider/http_request_spec.rb +8 -8
- data/spec/unit/provider/log_spec.rb +33 -53
- data/spec/unit/provider/mount/mount_spec.rb +12 -3
- data/spec/unit/provider/package/ips_spec.rb +96 -63
- data/spec/unit/provider/package/paludis_spec.rb +5 -5
- data/spec/unit/provider/package/rpm_spec.rb +12 -0
- data/spec/unit/provider/package/zypper_spec.rb +28 -16
- data/spec/unit/provider/service/windows_spec.rb +77 -17
- data/spec/unit/provider/user/dscl_spec.rb +659 -264
- data/spec/unit/provider/user/useradd_spec.rb +1 -0
- data/spec/unit/recipe_spec.rb +41 -0
- data/spec/unit/resource/scm_spec.rb +11 -0
- data/spec/unit/resource/user_spec.rb +4 -0
- data/spec/unit/resource/windows_service_spec.rb +46 -0
- data/spec/unit/resource_collection_spec.rb +33 -0
- data/spec/unit/resource_reporter_spec.rb +48 -0
- data/spec/unit/resource_spec.rb +9 -2
- data/spec/unit/role_spec.rb +6 -0
- data/spec/unit/version_constraint_spec.rb +28 -0
- metadata +61 -4
data/spec/unit/recipe_spec.rb
CHANGED
@@ -182,7 +182,48 @@ describe Chef::Recipe do
|
|
182
182
|
zm_resource # force let binding evaluation
|
183
183
|
run_context.resource_collection.resources(:zen_master => "klopp").should == zm_resource
|
184
184
|
end
|
185
|
+
end
|
186
|
+
|
187
|
+
describe "creating a resource with short name" do
|
188
|
+
# zen_follower resource has this:
|
189
|
+
# provides :follower, :on_platforms => ["zen"]
|
190
|
+
before do
|
191
|
+
node.stub(:[]) do |key|
|
192
|
+
case key
|
193
|
+
when :platform
|
194
|
+
:zen
|
195
|
+
when :platform_version
|
196
|
+
"1.0.0"
|
197
|
+
else
|
198
|
+
nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
let(:resource_follower) do
|
204
|
+
recipe.declare_resource(:follower, "srst") do
|
205
|
+
master "none"
|
206
|
+
end
|
207
|
+
end
|
185
208
|
|
209
|
+
it "defines the resource using the declaration name with short name" do
|
210
|
+
resource_follower
|
211
|
+
run_context.resource_collection.lookup("follower[srst]").should_not be_nil
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
describe "creating a resource with a long name" do
|
216
|
+
let(:resource_zn_follower) do
|
217
|
+
recipe.declare_resource(:zen_follower, "srst") do
|
218
|
+
master "none"
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
it "defines the resource using the declaration name with long name" do
|
224
|
+
resource_zn_follower
|
225
|
+
run_context.resource_collection.lookup("zen_follower[srst]").should_not be_nil
|
226
|
+
end
|
186
227
|
end
|
187
228
|
|
188
229
|
describe "when attempting to create a resource of an invalid type" do
|
@@ -147,6 +147,10 @@ describe Chef::Resource::Scm do
|
|
147
147
|
@resource.ssh_wrapper.should be_nil
|
148
148
|
end
|
149
149
|
|
150
|
+
it "defaults to nil for the environment" do
|
151
|
+
@resource.environment.should be_nil
|
152
|
+
end
|
153
|
+
|
150
154
|
describe "when it has a timeout attribute" do
|
151
155
|
let(:ten_seconds) { 10 }
|
152
156
|
before { @resource.timeout(ten_seconds) }
|
@@ -179,4 +183,11 @@ describe Chef::Resource::Scm do
|
|
179
183
|
end
|
180
184
|
end
|
181
185
|
|
186
|
+
describe "when it has a environment attribute" do
|
187
|
+
let(:test_environment) { {'CHEF_ENV' => '/tmp' } }
|
188
|
+
before { @resource.environment(test_environment) }
|
189
|
+
it "stores this environment" do
|
190
|
+
@resource.environment.should == test_environment
|
191
|
+
end
|
192
|
+
end
|
182
193
|
end
|
@@ -54,6 +54,10 @@ describe Chef::Resource::User, "initialize" do
|
|
54
54
|
@resource.supports[:non_unique].should eql(false)
|
55
55
|
end
|
56
56
|
|
57
|
+
it "should set force to false" do
|
58
|
+
@resource.force.should eql(false)
|
59
|
+
end
|
60
|
+
|
57
61
|
%w{create remove modify manage lock unlock}.each do |action|
|
58
62
|
it "should allow action #{action}" do
|
59
63
|
@resource.allowed_actions.detect { |a| a == action.to_sym }.should eql(action.to_sym)
|
@@ -0,0 +1,46 @@
|
|
1
|
+
#
|
2
|
+
# Author:: Bryan McLellan <btm@loftninjas.org>
|
3
|
+
# Copyright:: Copyright (c) 2014 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::Resource::WindowsService, "initialize", :windows_only do
|
22
|
+
|
23
|
+
let(:resource) { Chef::Resource::WindowsService.new("BITS") }
|
24
|
+
|
25
|
+
it "returns a Chef::Resource::WindowsService" do
|
26
|
+
expect(resource).to be_a_kind_of(Chef::Resource::WindowsService)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "sets the resource_name to :windows_service" do
|
30
|
+
expect(resource.resource_name).to eql(:windows_service)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sets the provider to Chef::Provider::Service::Windows" do
|
34
|
+
expect(resource.provider).to eql(Chef::Provider::Service::Windows)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "supports setting startup_type" do
|
38
|
+
resource.startup_type(:manual)
|
39
|
+
expect(resource.startup_type).to eql(:manual)
|
40
|
+
end
|
41
|
+
|
42
|
+
it "allows the action to be 'configure_startup'" do
|
43
|
+
resource.action :configure_startup
|
44
|
+
resource.action.should == [:configure_startup]
|
45
|
+
end
|
46
|
+
end
|
@@ -88,6 +88,39 @@ describe Chef::ResourceCollection do
|
|
88
88
|
end
|
89
89
|
end
|
90
90
|
|
91
|
+
describe "insert_at" do
|
92
|
+
it "should accept only Chef::Resources" do
|
93
|
+
lambda { @rc.insert_at(0, @resource, @resource) }.should_not raise_error
|
94
|
+
lambda { @rc.insert_at(0, "string") }.should raise_error
|
95
|
+
lambda { @rc.insert_at(0, @resource, "string") }.should raise_error
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should toss an error if it receives a bad index" do
|
99
|
+
@rc.insert_at(10, @resource)
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should insert resources at the beginning when asked" do
|
103
|
+
@rc.insert(Chef::Resource::ZenMaster.new('1'))
|
104
|
+
@rc.insert(Chef::Resource::ZenMaster.new('2'))
|
105
|
+
@rc.insert_at(0, Chef::Resource::ZenMaster.new('X'))
|
106
|
+
@rc.all_resources.map { |r| r.name }.should == [ 'X', '1', '2' ]
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should insert resources in the middle when asked" do
|
110
|
+
@rc.insert(Chef::Resource::ZenMaster.new('1'))
|
111
|
+
@rc.insert(Chef::Resource::ZenMaster.new('2'))
|
112
|
+
@rc.insert_at(1, Chef::Resource::ZenMaster.new('X'))
|
113
|
+
@rc.all_resources.map { |r| r.name }.should == [ '1', 'X', '2' ]
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should insert resources at the end when asked" do
|
117
|
+
@rc.insert(Chef::Resource::ZenMaster.new('1'))
|
118
|
+
@rc.insert(Chef::Resource::ZenMaster.new('2'))
|
119
|
+
@rc.insert_at(2, Chef::Resource::ZenMaster.new('X'))
|
120
|
+
@rc.all_resources.map { |r| r.name }.should == [ '1', '2', 'X' ]
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
91
124
|
describe "each" do
|
92
125
|
it "should allow you to iterate over every resource in the collection" do
|
93
126
|
load_up_resources
|
@@ -21,6 +21,7 @@
|
|
21
21
|
|
22
22
|
require File.expand_path("../../spec_helper", __FILE__)
|
23
23
|
require 'chef/resource_reporter'
|
24
|
+
require 'socket'
|
24
25
|
|
25
26
|
describe Chef::ResourceReporter do
|
26
27
|
before(:all) do
|
@@ -707,5 +708,52 @@ describe Chef::ResourceReporter do
|
|
707
708
|
@resource_reporter.run_completed(@node)
|
708
709
|
end
|
709
710
|
end
|
711
|
+
|
712
|
+
context "when data report post is enabled and the server response fails" do
|
713
|
+
before do
|
714
|
+
@enable_reporting_url_fatals = Chef::Config[:enable_reporting_url_fatals]
|
715
|
+
Chef::Config[:enable_reporting_url_fatals] = true
|
716
|
+
# this call doesn't matter for this context
|
717
|
+
@rest_client.stub(:create_url)
|
718
|
+
end
|
719
|
+
|
720
|
+
after do
|
721
|
+
Chef::Config[:enable_reporting_url_fatals] = @enable_reporting_url_fatals
|
722
|
+
end
|
723
|
+
|
724
|
+
it "should log 4xx errors" do
|
725
|
+
response = Net::HTTPClientError.new("forbidden", "403", "Forbidden")
|
726
|
+
error = Net::HTTPServerException.new("403 message", response)
|
727
|
+
@rest_client.stub(:raw_http_request).and_raise(error)
|
728
|
+
Chef::Log.should_receive(:error).with(/403/)
|
729
|
+
|
730
|
+
@resource_reporter.post_reporting_data
|
731
|
+
end
|
732
|
+
|
733
|
+
it "should log error 5xx errors" do
|
734
|
+
response = Net::HTTPServerError.new("internal error", "500", "Internal Server Error")
|
735
|
+
error = Net::HTTPFatalError.new("500 message", response)
|
736
|
+
@rest_client.stub(:raw_http_request).and_raise(error)
|
737
|
+
Chef::Log.should_receive(:error).with(/500/)
|
738
|
+
|
739
|
+
@resource_reporter.post_reporting_data
|
740
|
+
end
|
741
|
+
|
742
|
+
it "should log if a socket error happens" do
|
743
|
+
@rest_client.stub(:raw_http_request).and_raise(SocketError.new("test socket error"))
|
744
|
+
Chef::Log.should_receive(:error).with(/test socket error/)
|
745
|
+
|
746
|
+
@resource_reporter.post_reporting_data
|
747
|
+
|
748
|
+
end
|
749
|
+
|
750
|
+
it "should raise if an unkwown error happens" do
|
751
|
+
@rest_client.stub(:raw_http_request).and_raise(Exception.new)
|
752
|
+
|
753
|
+
lambda {
|
754
|
+
@resource_reporter.post_reporting_data
|
755
|
+
}.should raise_error(Exception)
|
756
|
+
end
|
757
|
+
end
|
710
758
|
end
|
711
759
|
end
|
data/spec/unit/resource_spec.rb
CHANGED
@@ -344,7 +344,7 @@ describe Chef::Resource do
|
|
344
344
|
expected_keys = [ :allowed_actions, :params, :provider, :updated,
|
345
345
|
:updated_by_last_action, :before, :supports,
|
346
346
|
:noop, :ignore_failure, :name, :source_line,
|
347
|
-
:action, :retries, :retry_delay, :elapsed_time,
|
347
|
+
:action, :retries, :retry_delay, :elapsed_time,
|
348
348
|
:guard_interpreter, :sensitive ]
|
349
349
|
(hash.keys - expected_keys).should == []
|
350
350
|
(expected_keys - hash.keys).should == []
|
@@ -527,6 +527,13 @@ describe Chef::Resource do
|
|
527
527
|
snitch_var2.should be_false
|
528
528
|
end
|
529
529
|
|
530
|
+
it "reports 0 elapsed time if actual elapsed time is < 0" do
|
531
|
+
expected = Time.now
|
532
|
+
Time.stub(:now).and_return(expected, expected - 1)
|
533
|
+
@resource.run_action(:purr)
|
534
|
+
@resource.elapsed_time.should == 0
|
535
|
+
end
|
536
|
+
|
530
537
|
describe "guard_interpreter attribute" do
|
531
538
|
let(:resource) { @resource }
|
532
539
|
|
@@ -788,7 +795,7 @@ describe Chef::Resource do
|
|
788
795
|
before(:each) do
|
789
796
|
@resource_file = Chef::Resource::File.new("/nonexistent/CHEF-5098/file", @run_context)
|
790
797
|
@action = :create
|
791
|
-
end
|
798
|
+
end
|
792
799
|
|
793
800
|
def compiled_resource_data(resource, action, err)
|
794
801
|
error_inspector = Chef::Formatters::ErrorInspectors::ResourceFailureInspector.new(resource, action, err)
|
data/spec/unit/role_spec.rb
CHANGED
@@ -296,6 +296,12 @@ EOR
|
|
296
296
|
File.should_not_receive(:exists?)
|
297
297
|
lambda {@role.class.from_disk("lolcat")}.should raise_error(Chef::Exceptions::DuplicateRole)
|
298
298
|
end
|
299
|
+
|
300
|
+
it "should not raise an exception if two files exist with a similar name" do
|
301
|
+
Dir.should_receive(:glob).and_return(["#{Chef::Config[:role_path]}/memes/lolcat.rb", "#{Chef::Config[:role_path]}/super_lolcat.rb"])
|
302
|
+
File.should_not_receive(:exists?)
|
303
|
+
lambda {@role.class.from_disk("lolcat")}.should_not raise_error(Chef::Exceptions::DuplicateRole)
|
304
|
+
end
|
299
305
|
end
|
300
306
|
|
301
307
|
describe "when loading from disk and role_path is an array" do
|
@@ -148,4 +148,32 @@ describe Chef::VersionConstraint do
|
|
148
148
|
vc.should_not include "0.3.0"
|
149
149
|
end
|
150
150
|
end
|
151
|
+
|
152
|
+
describe 'to_s' do
|
153
|
+
it 'shows a patch-level if one is given' do
|
154
|
+
vc = Chef::VersionConstraint.new '~> 1.2.0'
|
155
|
+
|
156
|
+
vc.to_s.should == '~> 1.2.0'
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'shows no patch-level if one is not given' do
|
160
|
+
vc = Chef::VersionConstraint.new '~> 1.2'
|
161
|
+
|
162
|
+
vc.to_s.should == '~> 1.2'
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
describe 'inspect' do
|
167
|
+
it 'shows a patch-level if one is given' do
|
168
|
+
vc = Chef::VersionConstraint.new '~> 1.2.0'
|
169
|
+
|
170
|
+
vc.inspect.should == '(~> 1.2.0)'
|
171
|
+
end
|
172
|
+
|
173
|
+
it 'shows no patch-level if one is not given' do
|
174
|
+
vc = Chef::VersionConstraint.new '~> 1.2'
|
175
|
+
|
176
|
+
vc.inspect.should == '(~> 1.2)'
|
177
|
+
end
|
178
|
+
end
|
151
179
|
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.0.0.alpha.
|
4
|
+
version: 12.0.0.alpha.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Jacob
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-config
|
@@ -101,6 +101,9 @@ dependencies:
|
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '1.0'
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: 1.0.2
|
104
107
|
type: :runtime
|
105
108
|
prerelease: false
|
106
109
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -108,6 +111,9 @@ dependencies:
|
|
108
111
|
- - "~>"
|
109
112
|
- !ruby/object:Gem::Version
|
110
113
|
version: '1.0'
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
version: 1.0.2
|
111
117
|
- !ruby/object:Gem::Dependency
|
112
118
|
name: net-ssh
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -218,6 +224,20 @@ dependencies:
|
|
218
224
|
- - "~>"
|
219
225
|
- !ruby/object:Gem::Version
|
220
226
|
version: '0.9'
|
227
|
+
- !ruby/object:Gem::Dependency
|
228
|
+
name: plist
|
229
|
+
requirement: !ruby/object:Gem::Requirement
|
230
|
+
requirements:
|
231
|
+
- - "~>"
|
232
|
+
- !ruby/object:Gem::Version
|
233
|
+
version: 3.1.0
|
234
|
+
type: :runtime
|
235
|
+
prerelease: false
|
236
|
+
version_requirements: !ruby/object:Gem::Requirement
|
237
|
+
requirements:
|
238
|
+
- - "~>"
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
version: 3.1.0
|
221
241
|
- !ruby/object:Gem::Dependency
|
222
242
|
name: rack
|
223
243
|
requirement: !ruby/object:Gem::Requirement
|
@@ -642,8 +662,11 @@ files:
|
|
642
662
|
- lib/chef/dsl/recipe.rb
|
643
663
|
- lib/chef/dsl/registry_helper.rb
|
644
664
|
- lib/chef/encrypted_data_bag_item.rb
|
665
|
+
- lib/chef/encrypted_data_bag_item/assertions.rb
|
645
666
|
- lib/chef/encrypted_data_bag_item/decryption_failure.rb
|
646
667
|
- lib/chef/encrypted_data_bag_item/decryptor.rb
|
668
|
+
- lib/chef/encrypted_data_bag_item/encrypted_data_bag_item_assertions.rb
|
669
|
+
- lib/chef/encrypted_data_bag_item/encryption_failure.rb
|
647
670
|
- lib/chef/encrypted_data_bag_item/encryptor.rb
|
648
671
|
- lib/chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb
|
649
672
|
- lib/chef/encrypted_data_bag_item/unsupported_cipher.rb
|
@@ -961,6 +984,7 @@ files:
|
|
961
984
|
- lib/chef/provider/template/content.rb
|
962
985
|
- lib/chef/provider/template_finder.rb
|
963
986
|
- lib/chef/provider/user.rb
|
987
|
+
- lib/chef/provider/user/aix.rb
|
964
988
|
- lib/chef/provider/user/dscl.rb
|
965
989
|
- lib/chef/provider/user/pw.rb
|
966
990
|
- lib/chef/provider/user/solaris.rb
|
@@ -1033,6 +1057,7 @@ files:
|
|
1033
1057
|
- lib/chef/resource/whyrun_safe_ruby_block.rb
|
1034
1058
|
- lib/chef/resource/windows_package.rb
|
1035
1059
|
- lib/chef/resource/windows_script.rb
|
1060
|
+
- lib/chef/resource/windows_service.rb
|
1036
1061
|
- lib/chef/resource/yum_package.rb
|
1037
1062
|
- lib/chef/resource_collection.rb
|
1038
1063
|
- lib/chef/resource_collection/stepable_iterator.rb
|
@@ -1184,15 +1209,23 @@ files:
|
|
1184
1209
|
- spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-x2d6j9-0
|
1185
1210
|
- spec/data/checksum_cache/chef-file--tmp-chef-rendered-template20100929-10863-xi0l6h-0
|
1186
1211
|
- spec/data/config.rb
|
1212
|
+
- spec/data/cookbooks/angrybash/metadata.rb
|
1187
1213
|
- spec/data/cookbooks/angrybash/recipes/default.rb
|
1188
1214
|
- spec/data/cookbooks/apache2/files/default/apache2_module_conf_generate.pl
|
1215
|
+
- spec/data/cookbooks/apache2/metadata.rb
|
1189
1216
|
- spec/data/cookbooks/apache2/recipes/default.rb
|
1217
|
+
- spec/data/cookbooks/borken/metadata.rb
|
1190
1218
|
- spec/data/cookbooks/borken/recipes/default.rb
|
1191
1219
|
- spec/data/cookbooks/borken/templates/default/borken.erb
|
1192
1220
|
- spec/data/cookbooks/chefignore
|
1221
|
+
- spec/data/cookbooks/ignorken/metadata.rb
|
1193
1222
|
- spec/data/cookbooks/ignorken/recipes/default.rb
|
1194
1223
|
- spec/data/cookbooks/ignorken/recipes/ignoreme.rb
|
1195
1224
|
- spec/data/cookbooks/java/files/default/java.response
|
1225
|
+
- spec/data/cookbooks/java/metadata.rb
|
1226
|
+
- spec/data/cookbooks/name-mismatch-versionnumber/README.md
|
1227
|
+
- spec/data/cookbooks/name-mismatch-versionnumber/metadata.rb
|
1228
|
+
- spec/data/cookbooks/name-mismatch-versionnumber/recipes/default.rb
|
1196
1229
|
- spec/data/cookbooks/openldap/attributes/default.rb
|
1197
1230
|
- spec/data/cookbooks/openldap/attributes/smokey.rb
|
1198
1231
|
- spec/data/cookbooks/openldap/definitions/client.rb
|
@@ -1200,6 +1233,7 @@ files:
|
|
1200
1233
|
- spec/data/cookbooks/openldap/files/default/.dotfile
|
1201
1234
|
- spec/data/cookbooks/openldap/files/default/.ssh/id_rsa
|
1202
1235
|
- spec/data/cookbooks/openldap/files/default/remotedir/.a_dotdir/.a_dotfile_in_a_dotdir
|
1236
|
+
- spec/data/cookbooks/openldap/files/default/remotedir/not_a_template.erb
|
1203
1237
|
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file1.txt
|
1204
1238
|
- spec/data/cookbooks/openldap/files/default/remotedir/remote_dir_file2.txt
|
1205
1239
|
- spec/data/cookbooks/openldap/files/default/remotedir/remotesubdir/.a_dotfile
|
@@ -1221,6 +1255,7 @@ files:
|
|
1221
1255
|
- spec/data/cookbooks/openldap/templates/default/test.erb
|
1222
1256
|
- spec/data/cookbooks/preseed/files/default/preseed-file.seed
|
1223
1257
|
- spec/data/cookbooks/preseed/files/default/preseed-template.seed
|
1258
|
+
- spec/data/cookbooks/preseed/metadata.rb
|
1224
1259
|
- spec/data/cookbooks/preseed/templates/default/preseed-template-variables.seed
|
1225
1260
|
- spec/data/cookbooks/preseed/templates/default/preseed-template.seed
|
1226
1261
|
- spec/data/definitions/test.rb
|
@@ -1233,6 +1268,12 @@ files:
|
|
1233
1268
|
- spec/data/git_bundles/sinatra-test-app-with-callback-files.gitbundle
|
1234
1269
|
- spec/data/git_bundles/sinatra-test-app-with-symlinks.gitbundle
|
1235
1270
|
- spec/data/git_bundles/sinatra-test-app.gitbundle
|
1271
|
+
- spec/data/incomplete-metadata-chef-repo/incomplete-metadata/README.md
|
1272
|
+
- spec/data/incomplete-metadata-chef-repo/incomplete-metadata/metadata.rb
|
1273
|
+
- spec/data/incomplete-metadata-chef-repo/incomplete-metadata/recipes/default.rb
|
1274
|
+
- spec/data/invalid-metadata-chef-repo/invalid-metadata/README.md
|
1275
|
+
- spec/data/invalid-metadata-chef-repo/invalid-metadata/metadata.rb
|
1276
|
+
- spec/data/invalid-metadata-chef-repo/invalid-metadata/recipes/default.rb
|
1236
1277
|
- spec/data/kitchen/chefignore
|
1237
1278
|
- spec/data/kitchen/openldap/attributes/default.rb
|
1238
1279
|
- spec/data/kitchen/openldap/attributes/robinson.rb
|
@@ -1259,6 +1300,14 @@ files:
|
|
1259
1300
|
- spec/data/lwrp_const_scoping/resources/conflict.rb
|
1260
1301
|
- spec/data/lwrp_override/providers/buck_passer.rb
|
1261
1302
|
- spec/data/lwrp_override/resources/foo.rb
|
1303
|
+
- spec/data/mac_users/10.7-8.plist.xml
|
1304
|
+
- spec/data/mac_users/10.7-8.shadow.xml
|
1305
|
+
- spec/data/mac_users/10.7.plist.xml
|
1306
|
+
- spec/data/mac_users/10.7.shadow.xml
|
1307
|
+
- spec/data/mac_users/10.8.plist.xml
|
1308
|
+
- spec/data/mac_users/10.8.shadow.xml
|
1309
|
+
- spec/data/mac_users/10.9.plist.xml
|
1310
|
+
- spec/data/mac_users/10.9.shadow.xml
|
1262
1311
|
- spec/data/metadata/quick_start/metadata.rb
|
1263
1312
|
- spec/data/nodes/default.rb
|
1264
1313
|
- spec/data/nodes/test.example.com.rb
|
@@ -1382,6 +1431,7 @@ files:
|
|
1382
1431
|
- spec/functional/resource/cron_spec.rb
|
1383
1432
|
- spec/functional/resource/deploy_revision_spec.rb
|
1384
1433
|
- spec/functional/resource/directory_spec.rb
|
1434
|
+
- spec/functional/resource/env_spec.rb
|
1385
1435
|
- spec/functional/resource/file_spec.rb
|
1386
1436
|
- spec/functional/resource/git_spec.rb
|
1387
1437
|
- spec/functional/resource/group_spec.rb
|
@@ -1396,7 +1446,8 @@ files:
|
|
1396
1446
|
- spec/functional/resource/remote_file_spec.rb
|
1397
1447
|
- spec/functional/resource/rpm_spec.rb
|
1398
1448
|
- spec/functional/resource/template_spec.rb
|
1399
|
-
- spec/functional/resource/
|
1449
|
+
- spec/functional/resource/user/dscl_spec.rb
|
1450
|
+
- spec/functional/resource/user/useradd_spec.rb
|
1400
1451
|
- spec/functional/rest_spec.rb
|
1401
1452
|
- spec/functional/run_lock_spec.rb
|
1402
1453
|
- spec/functional/shell_spec.rb
|
@@ -1438,6 +1489,7 @@ files:
|
|
1438
1489
|
- spec/support/lib/chef/resource/cat.rb
|
1439
1490
|
- spec/support/lib/chef/resource/one_two_three_four.rb
|
1440
1491
|
- spec/support/lib/chef/resource/with_state.rb
|
1492
|
+
- spec/support/lib/chef/resource/zen_follower.rb
|
1441
1493
|
- spec/support/lib/chef/resource/zen_master.rb
|
1442
1494
|
- spec/support/lib/library_load_order.rb
|
1443
1495
|
- spec/support/matchers/leak.rb
|
@@ -1460,6 +1512,7 @@ files:
|
|
1460
1512
|
- spec/support/shared/functional/securable_resource_with_reporting.rb
|
1461
1513
|
- spec/support/shared/functional/windows_script.rb
|
1462
1514
|
- spec/support/shared/integration/app_server_support.rb
|
1515
|
+
- spec/support/shared/integration/chef_zero_support.rb
|
1463
1516
|
- spec/support/shared/integration/integration_helper.rb
|
1464
1517
|
- spec/support/shared/integration/knife_support.rb
|
1465
1518
|
- spec/support/shared/matchers.rb
|
@@ -1491,13 +1544,14 @@ files:
|
|
1491
1544
|
- spec/unit/config_fetcher_spec.rb
|
1492
1545
|
- spec/unit/config_spec.rb
|
1493
1546
|
- spec/unit/cookbook/chefignore_spec.rb
|
1547
|
+
- spec/unit/cookbook/cookbook_version_loader_spec.rb
|
1494
1548
|
- spec/unit/cookbook/file_vendor_spec.rb
|
1495
1549
|
- spec/unit/cookbook/metadata_spec.rb
|
1496
1550
|
- spec/unit/cookbook/synchronizer_spec.rb
|
1497
1551
|
- spec/unit/cookbook/syntax_check_spec.rb
|
1498
1552
|
- spec/unit/cookbook_loader_spec.rb
|
1499
1553
|
- spec/unit/cookbook_manifest_spec.rb
|
1500
|
-
- spec/unit/
|
1554
|
+
- spec/unit/cookbook_site_streaming_uploader_spec.rb
|
1501
1555
|
- spec/unit/cookbook_spec.rb
|
1502
1556
|
- spec/unit/cookbook_uploader_spec.rb
|
1503
1557
|
- spec/unit/cookbook_version_spec.rb
|
@@ -1519,6 +1573,7 @@ files:
|
|
1519
1573
|
- spec/unit/file_content_management/deploy/cp_spec.rb
|
1520
1574
|
- spec/unit/file_content_management/deploy/mv_unix_spec.rb
|
1521
1575
|
- spec/unit/file_content_management/deploy/mv_windows_spec.rb
|
1576
|
+
- spec/unit/formatters/base_spec.rb
|
1522
1577
|
- spec/unit/formatters/error_inspectors/compile_error_inspector_spec.rb
|
1523
1578
|
- spec/unit/formatters/error_inspectors/cookbook_resolve_error_inspector_spec.rb
|
1524
1579
|
- spec/unit/formatters/error_inspectors/cookbook_sync_error_inspector_spec.rb
|
@@ -1596,6 +1651,7 @@ files:
|
|
1596
1651
|
- spec/unit/knife/role_edit_spec.rb
|
1597
1652
|
- spec/unit/knife/role_from_file_spec.rb
|
1598
1653
|
- spec/unit/knife/role_list_spec.rb
|
1654
|
+
- spec/unit/knife/role_show_spec.rb
|
1599
1655
|
- spec/unit/knife/ssh_spec.rb
|
1600
1656
|
- spec/unit/knife/ssl_check_spec.rb
|
1601
1657
|
- spec/unit/knife/ssl_fetch_spec.rb
|
@@ -1793,6 +1849,7 @@ files:
|
|
1793
1849
|
- spec/unit/resource/timestamped_deploy_spec.rb
|
1794
1850
|
- spec/unit/resource/user_spec.rb
|
1795
1851
|
- spec/unit/resource/windows_package_spec.rb
|
1852
|
+
- spec/unit/resource/windows_service_spec.rb
|
1796
1853
|
- spec/unit/resource/yum_package_spec.rb
|
1797
1854
|
- spec/unit/resource_collection/stepable_iterator_spec.rb
|
1798
1855
|
- spec/unit/resource_collection_spec.rb
|