chef 11.6.0.hotfix.1 → 11.6.0.rc.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/distro/common/html/chef-client.8.html +4 -4
- data/distro/common/html/chef-expander.8.html +4 -4
- data/distro/common/html/chef-expanderctl.8.html +4 -4
- data/distro/common/html/chef-server-webui.8.html +4 -4
- data/distro/common/html/chef-server.8.html +4 -4
- data/distro/common/html/chef-shell.1.html +4 -4
- data/distro/common/html/chef-solo.8.html +4 -4
- data/distro/common/html/chef-solr.8.html +4 -4
- data/distro/common/html/knife-bootstrap.1.html +4 -4
- data/distro/common/html/knife-client.1.html +4 -4
- data/distro/common/html/knife-configure.1.html +4 -4
- data/distro/common/html/knife-cookbook-site.1.html +4 -4
- data/distro/common/html/knife-cookbook.1.html +4 -4
- data/distro/common/html/knife-data-bag.1.html +4 -4
- data/distro/common/html/knife-environment.1.html +4 -4
- data/distro/common/html/knife-exec.1.html +4 -4
- data/distro/common/html/knife-index.1.html +4 -4
- data/distro/common/html/knife-node.1.html +4 -4
- data/distro/common/html/knife-role.1.html +4 -4
- data/distro/common/html/knife-search.1.html +4 -4
- data/distro/common/html/knife-ssh.1.html +4 -4
- data/distro/common/html/knife-status.1.html +4 -4
- data/distro/common/html/knife-tag.1.html +4 -4
- data/distro/common/html/knife.1.html +4 -4
- data/distro/common/man/man1/chef-shell.1 +1 -1
- data/distro/common/man/man1/knife-bootstrap.1 +1 -1
- data/distro/common/man/man1/knife-client.1 +1 -1
- data/distro/common/man/man1/knife-configure.1 +1 -1
- data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
- data/distro/common/man/man1/knife-cookbook.1 +1 -1
- data/distro/common/man/man1/knife-data-bag.1 +1 -1
- data/distro/common/man/man1/knife-environment.1 +1 -1
- data/distro/common/man/man1/knife-exec.1 +1 -1
- data/distro/common/man/man1/knife-index.1 +1 -1
- data/distro/common/man/man1/knife-node.1 +1 -1
- data/distro/common/man/man1/knife-role.1 +1 -1
- data/distro/common/man/man1/knife-search.1 +1 -1
- data/distro/common/man/man1/knife-ssh.1 +1 -1
- data/distro/common/man/man1/knife-status.1 +1 -1
- data/distro/common/man/man1/knife-tag.1 +1 -1
- data/distro/common/man/man1/knife.1 +1 -1
- data/distro/common/man/man8/chef-client.8 +1 -1
- data/distro/common/man/man8/chef-expander.8 +1 -1
- data/distro/common/man/man8/chef-expanderctl.8 +1 -1
- data/distro/common/man/man8/chef-server-webui.8 +1 -1
- data/distro/common/man/man8/chef-server.8 +1 -1
- data/distro/common/man/man8/chef-solo.8 +1 -1
- data/distro/common/man/man8/chef-solr.8 +1 -1
- data/lib/chef/application/client.rb +2 -0
- data/lib/chef/application/solo.rb +1 -0
- data/lib/chef/application/windows_service.rb +1 -0
- data/lib/chef/client.rb +6 -28
- data/lib/chef/config.rb +1 -1
- data/lib/chef/cookbook/cookbook_version_loader.rb +19 -10
- data/lib/chef/cookbook/file_system_file_vendor.rb +7 -4
- data/lib/chef/cookbook/metadata.rb +10 -1
- data/lib/chef/cookbook/syntax_check.rb +4 -4
- data/lib/chef/cookbook_uploader.rb +1 -1
- data/lib/chef/cookbook_version.rb +10 -6
- data/lib/chef/deprecation/provider/template.rb +1 -1
- data/lib/chef/exceptions.rb +0 -2
- data/lib/chef/formatters/error_descriptor.rb +4 -5
- data/lib/chef/knife/cookbook_site_share.rb +0 -1
- data/lib/chef/knife/cookbook_test.rb +0 -1
- data/lib/chef/provider/file.rb +1 -2
- data/lib/chef/provider/package/yum.rb +1 -2
- data/lib/chef/provider/remote_file/cache_control_data.rb +6 -12
- data/lib/chef/resource/file.rb +0 -2
- data/lib/chef/resource_reporter.rb +2 -5
- data/lib/chef/scan_access_control.rb +1 -6
- data/lib/chef/util/diff.rb +5 -31
- data/lib/chef/version.rb +1 -1
- data/lib/chef/win32/api/file.rb +0 -7
- data/spec/data/cookbooks/not-nginx/attributes/default.rb +1 -0
- data/spec/data/cookbooks/not-nginx/metadata.rb +1 -0
- data/spec/data/kitchen/no-really-not-nginx/attributes/default.rb +1 -0
- data/spec/data/kitchen/no-really-not-nginx/metadata.rb +1 -0
- data/spec/functional/knife/exec_spec.rb +2 -2
- data/spec/functional/resource/user_spec.rb +14 -6
- data/spec/spec_helper.rb +0 -32
- data/spec/support/platform_helpers.rb +0 -12
- data/spec/support/shared/functional/file_resource.rb +10 -87
- data/spec/support/shared/unit/provider/file.rb +2 -4
- data/spec/unit/cookbook/metadata_spec.rb +56 -50
- data/spec/unit/cookbook_loader_spec.rb +22 -1
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/package/yum_spec.rb +36 -17
- data/spec/unit/provider/remote_file/cache_control_data_spec.rb +0 -50
- data/spec/unit/resource_reporter_spec.rb +1 -52
- data/spec/unit/scan_access_control_spec.rb +2 -4
- data/spec/unit/util/diff_spec.rb +11 -351
- metadata +9 -93
- data/spec/data/apt/chef-integration-test-1.0/debian/changelog +0 -5
- data/spec/data/apt/chef-integration-test-1.0/debian/compat +0 -1
- data/spec/data/apt/chef-integration-test-1.0/debian/control +0 -13
- data/spec/data/apt/chef-integration-test-1.0/debian/copyright +0 -34
- data/spec/data/apt/chef-integration-test-1.0/debian/files +0 -1
- data/spec/data/apt/chef-integration-test-1.0/debian/rules +0 -13
- data/spec/data/apt/chef-integration-test-1.0/debian/source/format +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/changelog +0 -11
- data/spec/data/apt/chef-integration-test-1.1/debian/compat +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/control +0 -13
- data/spec/data/apt/chef-integration-test-1.1/debian/copyright +0 -34
- data/spec/data/apt/chef-integration-test-1.1/debian/files +0 -1
- data/spec/data/apt/chef-integration-test-1.1/debian/rules +0 -13
- data/spec/data/apt/chef-integration-test-1.1/debian/source/format +0 -1
- data/spec/data/apt/chef-integration-test_1.0-1_amd64.changes +0 -22
- data/spec/data/apt/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test_1.0.orig.tar.gz +0 -0
- data/spec/data/apt/chef-integration-test_1.1-1_amd64.changes +0 -22
- data/spec/data/apt/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/spec/data/apt/chef-integration-test_1.1.orig.tar.gz +0 -0
- data/spec/data/apt/var/www/apt/conf/distributions +0 -7
- data/spec/data/apt/var/www/apt/conf/incoming +0 -4
- data/spec/data/apt/var/www/apt/conf/pulls +0 -3
- data/spec/data/apt/var/www/apt/db/checksums.db +0 -0
- data/spec/data/apt/var/www/apt/db/contents.cache.db +0 -0
- data/spec/data/apt/var/www/apt/db/packages.db +0 -0
- data/spec/data/apt/var/www/apt/db/references.db +0 -0
- data/spec/data/apt/var/www/apt/db/release.caches.db +0 -0
- data/spec/data/apt/var/www/apt/db/version +0 -4
- data/spec/data/apt/var/www/apt/dists/sid/Release +0 -19
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages +0 -16
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Packages.gz +0 -0
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-amd64/Release +0 -5
- data/spec/data/apt/var/www/apt/dists/sid/main/binary-i386/Packages +0 -0
- data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.0-1_amd64.deb +0 -0
- data/spec/data/apt/var/www/apt/pool/main/c/chef-integration-test/chef-integration-test_1.1-1_amd64.deb +0 -0
- data/spec/data/cookbooks/preseed/files/default/preseed-file.seed +0 -1
- data/spec/data/cookbooks/preseed/templates/default/preseed-template.seed +0 -1
- data/spec/functional/provider/remote_file/cache_control_data_spec.rb +0 -101
- data/spec/functional/resource/package_spec.rb +0 -297
data/lib/chef/version.rb
CHANGED
data/lib/chef/win32/api/file.rb
CHANGED
@@ -471,13 +471,6 @@ BOOL WINAPI DeviceIoControl(
|
|
471
471
|
# ensures the handle is closed on exit of the block
|
472
472
|
def file_search_handle(path, &block)
|
473
473
|
begin
|
474
|
-
# Workaround for CHEF-4419:
|
475
|
-
# Make sure paths starting with "/" has a drive letter
|
476
|
-
# assigned from the current working diretory.
|
477
|
-
# Note: In chef 11.8 and beyond this issue will be fixed with a
|
478
|
-
# broader fix to map all the paths starting with "/" to
|
479
|
-
# SYSTEM_DRIVE on windows.
|
480
|
-
path = ::File.expand_path(path) if path.start_with? "/"
|
481
474
|
path = encode_path(path)
|
482
475
|
find_data = WIN32_FIND_DATA.new
|
483
476
|
handle = FindFirstFileW(path, find_data)
|
@@ -0,0 +1 @@
|
|
1
|
+
default[:cheese] = 'mr whiskers'
|
@@ -0,0 +1 @@
|
|
1
|
+
name "nginx"
|
@@ -0,0 +1 @@
|
|
1
|
+
default[:wine] = 'captain socks'
|
@@ -0,0 +1 @@
|
|
1
|
+
name "nginx"
|
@@ -46,12 +46,12 @@ describe Chef::Knife::Exec do
|
|
46
46
|
|
47
47
|
pending "executes a script in the context of the chef-shell main context", :ruby_18_only
|
48
48
|
|
49
|
-
it "executes a script in the context of the chef-shell main context", :
|
49
|
+
it "executes a script in the context of the chef-shell main context", :ruby_19_only do
|
50
50
|
@node = Chef::Node.new
|
51
51
|
@node.name("ohai-world")
|
52
52
|
response = {"rows" => [@node],"start" => 0,"total" => 1}
|
53
53
|
@api.get(%r{^/search/node}, 200, response.to_json)
|
54
|
-
code = "$output.puts nodes.all"
|
54
|
+
code = "$output.puts nodes.all.inspect"
|
55
55
|
@knife.config[:exec] = code
|
56
56
|
@knife.run
|
57
57
|
$output.string.should match(%r{node\[ohai-world\]})
|
@@ -20,15 +20,15 @@
|
|
20
20
|
require 'spec_helper'
|
21
21
|
require 'chef/mixin/shell_out'
|
22
22
|
|
23
|
-
|
24
|
-
:requires_root => true,
|
25
|
-
:provider => {:user => Chef::Provider::User::Useradd}
|
26
|
-
}
|
27
|
-
|
28
|
-
describe Chef::Resource::User, metadata do
|
23
|
+
describe Chef::Resource::User, :unix_only, :requires_root do
|
29
24
|
|
30
25
|
include Chef::Mixin::ShellOut
|
31
26
|
|
27
|
+
# User provider is platform-dependent, we need platform ohai data:
|
28
|
+
OHAI_SYSTEM = Ohai::System.new
|
29
|
+
OHAI_SYSTEM.require_plugin("os")
|
30
|
+
OHAI_SYSTEM.require_plugin("platform")
|
31
|
+
|
32
32
|
|
33
33
|
# Utility code for /etc/passwd interaction, avoid any caching of user records:
|
34
34
|
PwEntry = Struct.new(:name, :passwd, :uid, :gid, :gecos, :home, :shell)
|
@@ -56,6 +56,14 @@ describe Chef::Resource::User, metadata do
|
|
56
56
|
before do
|
57
57
|
# Silence shell_out live stream
|
58
58
|
Chef::Log.level = :warn
|
59
|
+
|
60
|
+
# Tests only implemented for a subset of platforms currently.
|
61
|
+
user_provider = Chef::Platform.find_provider(OHAI_SYSTEM["platform"],
|
62
|
+
OHAI_SYSTEM["platform_version"],
|
63
|
+
:user)
|
64
|
+
unless user_provider == Chef::Provider::User::Useradd
|
65
|
+
pending "Only the useradd provider is supported at this time"
|
66
|
+
end
|
59
67
|
end
|
60
68
|
|
61
69
|
after do
|
data/spec/spec_helper.rb
CHANGED
@@ -83,13 +83,6 @@ Dir["spec/support/**/*.rb"].
|
|
83
83
|
map { |f| f.gsub(%r[spec/], '')}.
|
84
84
|
each { |f| require f }
|
85
85
|
|
86
|
-
|
87
|
-
OHAI_SYSTEM = Ohai::System.new
|
88
|
-
OHAI_SYSTEM.require_plugin("os")
|
89
|
-
OHAI_SYSTEM.require_plugin("platform")
|
90
|
-
TEST_PLATFORM = OHAI_SYSTEM["platform"].dup.freeze
|
91
|
-
TEST_PLATFORM_VERSION = OHAI_SYSTEM["platform_version"].dup.freeze
|
92
|
-
|
93
86
|
RSpec.configure do |config|
|
94
87
|
config.include(Matchers)
|
95
88
|
config.filter_run :focus => true
|
@@ -111,35 +104,10 @@ RSpec.configure do |config|
|
|
111
104
|
config.filter_run_excluding :selinux_only => true unless selinux_enabled?
|
112
105
|
config.filter_run_excluding :ruby_18_only => true unless ruby_18?
|
113
106
|
config.filter_run_excluding :ruby_19_only => true unless ruby_19?
|
114
|
-
config.filter_run_excluding :ruby_gte_19_only => true unless ruby_gte_19?
|
115
|
-
config.filter_run_excluding :ruby_20_only => true unless ruby_20?
|
116
|
-
config.filter_run_excluding :ruby_gte_20_only => true unless ruby_gte_20?
|
117
107
|
config.filter_run_excluding :requires_root => true unless ENV['USER'] == 'root'
|
118
108
|
config.filter_run_excluding :requires_unprivileged_user => true if ENV['USER'] == 'root'
|
119
109
|
config.filter_run_excluding :uses_diff => true unless has_diff?
|
120
110
|
|
121
|
-
running_platform_arch = `uname -m`.strip
|
122
|
-
|
123
|
-
config.filter_run_excluding :arch => lambda {|target_arch|
|
124
|
-
running_platform_arch != target_arch
|
125
|
-
}
|
126
|
-
|
127
|
-
# Functional Resource tests that are provider-specific:
|
128
|
-
# context "on platforms that use useradd", :provider => {:user => Chef::Provider::User::Useradd}} do #...
|
129
|
-
config.filter_run_excluding :provider => lambda {|criteria|
|
130
|
-
type, target_provider = criteria.first
|
131
|
-
|
132
|
-
platform = TEST_PLATFORM.dup
|
133
|
-
platform_version = TEST_PLATFORM_VERSION.dup
|
134
|
-
|
135
|
-
begin
|
136
|
-
provider_for_running_platform = Chef::Platform.find_provider(platform, platform_version, type)
|
137
|
-
provider_for_running_platform != target_provider
|
138
|
-
rescue ArgumentError # no provider for platform
|
139
|
-
true
|
140
|
-
end
|
141
|
-
}
|
142
|
-
|
143
111
|
config.run_all_when_everything_filtered = true
|
144
112
|
config.treat_symbols_as_metadata_keys_with_true_values = true
|
145
113
|
end
|
@@ -523,8 +523,15 @@ shared_examples_for "a configured file resource" do
|
|
523
523
|
resource.path(link_path)
|
524
524
|
# create symlinks for test context
|
525
525
|
File.symlink(path, link_path)
|
526
|
+
|
527
|
+
# Create source (real) file
|
528
|
+
File.open(path, "wb") { |f| f.write(wrong_content) }
|
526
529
|
end
|
527
530
|
|
531
|
+
include_context "setup broken permissions"
|
532
|
+
|
533
|
+
include_examples "a securable resource with existing target"
|
534
|
+
|
528
535
|
after(:each) do
|
529
536
|
# shared examples should not change our test setup of a file resource
|
530
537
|
# pointing at a symlink:
|
@@ -532,56 +539,9 @@ shared_examples_for "a configured file resource" do
|
|
532
539
|
FileUtils.rm_rf(link_path)
|
533
540
|
end
|
534
541
|
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
File.open(path, "wb") { |f| f.write(expected_content) }
|
539
|
-
end
|
540
|
-
|
541
|
-
|
542
|
-
include_context "setup broken permissions"
|
543
|
-
|
544
|
-
include_examples "a securable resource with existing target"
|
545
|
-
|
546
|
-
it "does not replace the symlink with a real file" do
|
547
|
-
resource.run_action(:create)
|
548
|
-
File.should be_symlink(link_path)
|
549
|
-
end
|
550
|
-
|
551
|
-
end
|
552
|
-
|
553
|
-
context "and the content is incorrect" do
|
554
|
-
before do
|
555
|
-
# Create source (real) file
|
556
|
-
File.open(path, "wb") { |f| f.write(wrong_content) }
|
557
|
-
end
|
558
|
-
|
559
|
-
it "updates the source file content" do
|
560
|
-
pending
|
561
|
-
end
|
562
|
-
|
563
|
-
it "marks the resource as updated" do
|
564
|
-
resource.run_action(:create)
|
565
|
-
resource.should be_updated_by_last_action
|
566
|
-
end
|
567
|
-
|
568
|
-
it "does not replace the symlink with a real file" do
|
569
|
-
resource.run_action(:create)
|
570
|
-
File.should be_symlink(link_path)
|
571
|
-
end
|
572
|
-
end
|
573
|
-
|
574
|
-
context "and the content and permissions are correct" do
|
575
|
-
let(:expect_updated?) { false }
|
576
|
-
|
577
|
-
before do
|
578
|
-
# Create source (real) file
|
579
|
-
File.open(path, "wb") { |f| f.write(expected_content) }
|
580
|
-
end
|
581
|
-
include_context "setup correct permissions"
|
582
|
-
|
583
|
-
include_examples "a securable resource with existing target"
|
584
|
-
|
542
|
+
it "does not replace the symlink with a real file" do
|
543
|
+
resource.run_action(:create)
|
544
|
+
File.should be_symlink(link_path)
|
585
545
|
end
|
586
546
|
|
587
547
|
end
|
@@ -895,43 +855,6 @@ shared_examples_for "a configured file resource" do
|
|
895
855
|
end
|
896
856
|
end
|
897
857
|
|
898
|
-
# Regression test for http://tickets.opscode.com/browse/CHEF-4419
|
899
|
-
context "when the path starts with '/' and target file exists", :windows_only do
|
900
|
-
let(:path) do
|
901
|
-
File.join(test_file_dir[2..test_file_dir.length], make_tmpname(file_base))
|
902
|
-
end
|
903
|
-
|
904
|
-
before do
|
905
|
-
File.open(path, "wb") { |f| f.print expected_content }
|
906
|
-
now = Time.now.to_i
|
907
|
-
File.utime(now - 9000, now - 9000, path)
|
908
|
-
|
909
|
-
@expected_mtime = File.stat(path).mtime
|
910
|
-
@expected_checksum = sha256_checksum(path)
|
911
|
-
end
|
912
|
-
|
913
|
-
describe ":create action should run without any updates" do
|
914
|
-
before do
|
915
|
-
# Assert starting state is as expected
|
916
|
-
File.should exist(path)
|
917
|
-
sha256_checksum(path).should == @expected_checksum
|
918
|
-
resource.run_action(:create)
|
919
|
-
end
|
920
|
-
|
921
|
-
it "does not overwrite the original when the :create action is run" do
|
922
|
-
sha256_checksum(path).should == @expected_checksum
|
923
|
-
end
|
924
|
-
|
925
|
-
it "does not update the mtime of the file when the :create action is run" do
|
926
|
-
File.stat(path).mtime.should == @expected_mtime
|
927
|
-
end
|
928
|
-
|
929
|
-
it "is not marked as updated by last action" do
|
930
|
-
resource.should_not be_updated_by_last_action
|
931
|
-
end
|
932
|
-
end
|
933
|
-
end
|
934
|
-
|
935
858
|
end
|
936
859
|
|
937
860
|
shared_context Chef::Resource::File do
|
@@ -146,8 +146,7 @@ shared_examples_for Chef::Provider::File do
|
|
146
146
|
# mock up the filesystem to behave like unix
|
147
147
|
setup_normal_file
|
148
148
|
stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
|
149
|
-
|
150
|
-
File.should_receive(:stat).with(resource_real_path).at_least(:once).and_return(stat_struct)
|
149
|
+
File.should_receive(:stat).with(resource.path).at_least(:once).and_return(stat_struct)
|
151
150
|
Etc.stub!(:getgrgid).with(0).and_return(mock("Group Ent", :name => "wheel"))
|
152
151
|
Etc.stub!(:getpwuid).with(0).and_return(mock("User Ent", :name => "root"))
|
153
152
|
end
|
@@ -271,8 +270,7 @@ shared_examples_for Chef::Provider::File do
|
|
271
270
|
# mock up the filesystem to behave like unix
|
272
271
|
setup_normal_file
|
273
272
|
stat_struct = mock("::File.stat", :mode => 0600, :uid => 0, :gid => 0, :mtime => 10000)
|
274
|
-
|
275
|
-
File.stub!(:stat).with(resource_real_path).and_return(stat_struct)
|
273
|
+
File.stub!(:stat).with(resource.path).and_return(stat_struct)
|
276
274
|
Etc.stub!(:getgrgid).with(0).and_return(mock("Group Ent", :name => "wheel"))
|
277
275
|
Etc.stub!(:getpwuid).with(0).and_return(mock("User Ent", :name => "root"))
|
278
276
|
provider.send(:load_resource_attributes_from_file, resource)
|
@@ -7,9 +7,9 @@
|
|
7
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
8
8
|
# you may not use this file except in compliance with the License.
|
9
9
|
# You may obtain a copy of the License at
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# http://www.apache.org/licenses/LICENSE-2.0
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# Unless required by applicable law or agreed to in writing, software
|
14
14
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
15
15
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
@@ -20,7 +20,7 @@
|
|
20
20
|
require 'spec_helper'
|
21
21
|
require 'chef/cookbook/metadata'
|
22
22
|
|
23
|
-
describe Chef::Cookbook::Metadata do
|
23
|
+
describe Chef::Cookbook::Metadata do
|
24
24
|
before(:each) do
|
25
25
|
@cookbook = Chef::CookbookVersion.new('test_cookbook')
|
26
26
|
@meta = Chef::Cookbook::Metadata.new(@cookbook)
|
@@ -86,7 +86,7 @@ describe Chef::Cookbook::Metadata do
|
|
86
86
|
it "should return a Chef::Cookbook::Metadata object" do
|
87
87
|
@meta.should be_a_kind_of(Chef::Cookbook::Metadata)
|
88
88
|
end
|
89
|
-
|
89
|
+
|
90
90
|
it "should allow a cookbook as the first argument" do
|
91
91
|
lambda { Chef::Cookbook::Metadata.new(@cookbook) }.should_not raise_error
|
92
92
|
end
|
@@ -96,7 +96,7 @@ describe Chef::Cookbook::Metadata do
|
|
96
96
|
end
|
97
97
|
|
98
98
|
it "should set the maintainer name from the second argument" do
|
99
|
-
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown')
|
99
|
+
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown')
|
100
100
|
md.maintainer.should == 'Bobo T. Clown'
|
101
101
|
end
|
102
102
|
|
@@ -105,7 +105,7 @@ describe Chef::Cookbook::Metadata do
|
|
105
105
|
end
|
106
106
|
|
107
107
|
it "should set the maintainer email from the third argument" do
|
108
|
-
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co')
|
108
|
+
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co')
|
109
109
|
md.maintainer_email.should == 'bobo@clown.co'
|
110
110
|
end
|
111
111
|
|
@@ -114,10 +114,10 @@ describe Chef::Cookbook::Metadata do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "should set the license from the fourth argument" do
|
117
|
-
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1')
|
117
|
+
md = Chef::Cookbook::Metadata.new(@cookbook, 'Bobo T. Clown', 'bobo@clown.co', 'Clown License v1')
|
118
118
|
md.license.should == 'Clown License v1'
|
119
119
|
end
|
120
|
-
end
|
120
|
+
end
|
121
121
|
|
122
122
|
describe "cookbook" do
|
123
123
|
it "should return the cookbook we were initialized with" do
|
@@ -133,7 +133,7 @@ describe Chef::Cookbook::Metadata do
|
|
133
133
|
|
134
134
|
describe "platforms" do
|
135
135
|
it "should return the current platform hash" do
|
136
|
-
@meta.platforms.should be_a_kind_of(Hash)
|
136
|
+
@meta.platforms.should be_a_kind_of(Hash)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
@@ -235,7 +235,7 @@ describe Chef::Cookbook::Metadata do
|
|
235
235
|
end
|
236
236
|
end
|
237
237
|
end
|
238
|
-
|
238
|
+
|
239
239
|
describe "attribute groupings" do
|
240
240
|
it "should allow you set a grouping" do
|
241
241
|
group = {
|
@@ -312,7 +312,7 @@ describe Chef::Cookbook::Metadata do
|
|
312
312
|
@meta.attribute("db/mysql/databases", {})
|
313
313
|
@meta.attributes["db/mysql/databases"][:choice].should == []
|
314
314
|
end
|
315
|
-
|
315
|
+
|
316
316
|
it "should let calculated be true or false" do
|
317
317
|
lambda {
|
318
318
|
@meta.attribute("db/mysql/databases", :calculated => true)
|
@@ -324,7 +324,7 @@ describe Chef::Cookbook::Metadata do
|
|
324
324
|
@meta.attribute("db/mysql/databases", :calculated => Hash.new)
|
325
325
|
}.should raise_error(ArgumentError)
|
326
326
|
end
|
327
|
-
|
327
|
+
|
328
328
|
it "should set calculated to false by default" do
|
329
329
|
@meta.attribute("db/mysql/databases", {})
|
330
330
|
@meta.attributes["db/mysql/databases"][:calculated].should == false
|
@@ -350,7 +350,7 @@ describe Chef::Cookbook::Metadata do
|
|
350
350
|
@meta.attribute("db/mysql/databases", :type => "symbol")
|
351
351
|
}.should_not raise_error(ArgumentError)
|
352
352
|
end
|
353
|
-
|
353
|
+
|
354
354
|
it "should let type be hash (backwards compatability only)" do
|
355
355
|
lambda {
|
356
356
|
@meta.attribute("db/mysql/databases", :type => "hash")
|
@@ -375,7 +375,7 @@ describe Chef::Cookbook::Metadata do
|
|
375
375
|
}.should_not raise_error(ArgumentError)
|
376
376
|
#attrib = @meta.attributes["db/mysql/databases"][:required].should == "required"
|
377
377
|
end
|
378
|
-
|
378
|
+
|
379
379
|
it "should convert required false to optional" do
|
380
380
|
lambda {
|
381
381
|
@meta.attribute("db/mysql/databases", :required => false)
|
@@ -387,7 +387,7 @@ describe Chef::Cookbook::Metadata do
|
|
387
387
|
@meta.attribute("db/mysql/databases", {})
|
388
388
|
@meta.attributes["db/mysql/databases"][:required].should == 'optional'
|
389
389
|
end
|
390
|
-
|
390
|
+
|
391
391
|
it "should make sure recipes is an array" do
|
392
392
|
lambda {
|
393
393
|
@meta.attribute("db/mysql/databases", :recipes => [])
|
@@ -399,7 +399,7 @@ describe Chef::Cookbook::Metadata do
|
|
399
399
|
|
400
400
|
it "should set recipes to an empty array by default" do
|
401
401
|
@meta.attribute("db/mysql/databases", {})
|
402
|
-
@meta.attributes["db/mysql/databases"][:recipes].should == []
|
402
|
+
@meta.attributes["db/mysql/databases"][:recipes].should == []
|
403
403
|
end
|
404
404
|
|
405
405
|
it "should allow the default value to be a string, array, or hash" do
|
@@ -438,14 +438,14 @@ describe Chef::Cookbook::Metadata do
|
|
438
438
|
lambda {
|
439
439
|
attrs = {
|
440
440
|
:choice => [ "a", "b", "c"],
|
441
|
-
:default => "b"
|
441
|
+
:default => "b"
|
442
442
|
}
|
443
443
|
@meta.attribute("db/mysql/databases", attrs)
|
444
444
|
}.should_not raise_error(ArgumentError)
|
445
445
|
lambda {
|
446
446
|
attrs = {
|
447
447
|
:choice => [ "a", "b", "c", "d", "e"],
|
448
|
-
:default => ["b", "d"]
|
448
|
+
:default => ["b", "d"]
|
449
449
|
}
|
450
450
|
@meta.attribute("db/mysql/databases", attrs)
|
451
451
|
}.should_not raise_error(ArgumentError)
|
@@ -455,7 +455,7 @@ describe Chef::Cookbook::Metadata do
|
|
455
455
|
lambda {
|
456
456
|
attrs = {
|
457
457
|
:choice => [ "a", "b", "c"],
|
458
|
-
:default => "d"
|
458
|
+
:default => "d"
|
459
459
|
}
|
460
460
|
@meta.attribute("db/mysql/databases", attrs)
|
461
461
|
}.should raise_error(ArgumentError)
|
@@ -470,11 +470,11 @@ describe Chef::Cookbook::Metadata do
|
|
470
470
|
end
|
471
471
|
|
472
472
|
describe "recipes" do
|
473
|
-
before(:each) do
|
473
|
+
before(:each) do
|
474
474
|
@cookbook.recipe_files = [ "default.rb", "enlighten.rb" ]
|
475
475
|
@meta = Chef::Cookbook::Metadata.new(@cookbook)
|
476
476
|
end
|
477
|
-
|
477
|
+
|
478
478
|
it "should have the names of the recipes" do
|
479
479
|
@meta.recipes["test_cookbook"].should == ""
|
480
480
|
@meta.recipes["test_cookbook::enlighten"].should == ""
|
@@ -493,7 +493,7 @@ describe Chef::Cookbook::Metadata do
|
|
493
493
|
end
|
494
494
|
|
495
495
|
describe "json" do
|
496
|
-
before(:each) do
|
496
|
+
before(:each) do
|
497
497
|
@cookbook.recipe_files = [ "default.rb", "enlighten.rb" ]
|
498
498
|
@meta = Chef::Cookbook::Metadata.new(@cookbook)
|
499
499
|
@meta.version "1.0"
|
@@ -509,8 +509,8 @@ describe Chef::Cookbook::Metadata do
|
|
509
509
|
@meta.provides "foo(:bar, :baz)"
|
510
510
|
@meta.replaces "snarkitron"
|
511
511
|
@meta.recipe "test_cookbook::enlighten", "is your buddy"
|
512
|
-
@meta.attribute "bizspark/has_login",
|
513
|
-
:display_name => "You have nothing"
|
512
|
+
@meta.attribute "bizspark/has_login",
|
513
|
+
:display_name => "You have nothing"
|
514
514
|
@meta.version "1.2.3"
|
515
515
|
end
|
516
516
|
|
@@ -524,23 +524,23 @@ describe Chef::Cookbook::Metadata do
|
|
524
524
|
end
|
525
525
|
|
526
526
|
%w{
|
527
|
-
name
|
528
|
-
description
|
529
|
-
long_description
|
530
|
-
maintainer
|
531
|
-
maintainer_email
|
527
|
+
name
|
528
|
+
description
|
529
|
+
long_description
|
530
|
+
maintainer
|
531
|
+
maintainer_email
|
532
532
|
license
|
533
|
-
platforms
|
534
|
-
dependencies
|
535
|
-
suggestions
|
536
|
-
recommendations
|
537
|
-
conflicting
|
533
|
+
platforms
|
534
|
+
dependencies
|
535
|
+
suggestions
|
536
|
+
recommendations
|
537
|
+
conflicting
|
538
538
|
providing
|
539
|
-
replacing
|
540
|
-
attributes
|
539
|
+
replacing
|
540
|
+
attributes
|
541
541
|
recipes
|
542
542
|
version
|
543
|
-
}.each do |t|
|
543
|
+
}.each do |t|
|
544
544
|
it "should include '#{t}'" do
|
545
545
|
@serial[t].should == @meta.send(t.to_sym)
|
546
546
|
end
|
@@ -557,23 +557,23 @@ describe Chef::Cookbook::Metadata do
|
|
557
557
|
end
|
558
558
|
|
559
559
|
%w{
|
560
|
-
name
|
561
|
-
description
|
562
|
-
long_description
|
563
|
-
maintainer
|
564
|
-
maintainer_email
|
560
|
+
name
|
561
|
+
description
|
562
|
+
long_description
|
563
|
+
maintainer
|
564
|
+
maintainer_email
|
565
565
|
license
|
566
|
-
platforms
|
567
|
-
dependencies
|
568
|
-
suggestions
|
569
|
-
recommendations
|
570
|
-
conflicting
|
566
|
+
platforms
|
567
|
+
dependencies
|
568
|
+
suggestions
|
569
|
+
recommendations
|
570
|
+
conflicting
|
571
571
|
providing
|
572
|
-
replacing
|
573
|
-
attributes
|
572
|
+
replacing
|
573
|
+
attributes
|
574
574
|
recipes
|
575
575
|
version
|
576
|
-
}.each do |t|
|
576
|
+
}.each do |t|
|
577
577
|
it "should match '#{t}'" do
|
578
578
|
@deserial.send(t.to_sym).should == @meta.send(t.to_sym)
|
579
579
|
end
|
@@ -585,6 +585,12 @@ describe Chef::Cookbook::Metadata do
|
|
585
585
|
@hash = @meta.to_hash
|
586
586
|
end
|
587
587
|
|
588
|
+
it "should convert a name field containing the empty string to nil" do
|
589
|
+
@hash['name'] = ""
|
590
|
+
deserial = Chef::Cookbook::Metadata.from_hash(@hash)
|
591
|
+
deserial.name.should be_nil
|
592
|
+
end
|
593
|
+
|
588
594
|
[:dependencies,
|
589
595
|
:recommendations,
|
590
596
|
:suggestions,
|