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
@@ -20,14 +20,16 @@ require 'chef/knife/list'
|
|
20
20
|
require 'chef/knife/show'
|
21
21
|
|
22
22
|
describe 'General chef_repo file system checks' do
|
23
|
-
|
23
|
+
include IntegrationSupport
|
24
24
|
include KnifeSupport
|
25
25
|
|
26
26
|
context 'directories and files that should/should not be ignored' do
|
27
27
|
when_the_repository "has empty roles, environments and data bag item directories" do
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
before do
|
29
|
+
directory "roles"
|
30
|
+
directory "environments"
|
31
|
+
directory "data_bags/bag1"
|
32
|
+
end
|
31
33
|
|
32
34
|
it "knife list --local -Rfp / returns them" do
|
33
35
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -40,7 +42,7 @@ EOM
|
|
40
42
|
end
|
41
43
|
|
42
44
|
when_the_repository "has an empty data_bags directory" do
|
43
|
-
directory "data_bags"
|
45
|
+
before { directory "data_bags" }
|
44
46
|
|
45
47
|
it "knife list --local / returns it" do
|
46
48
|
knife('list --local /').should_succeed "/data_bags\n"
|
@@ -48,7 +50,7 @@ EOM
|
|
48
50
|
end
|
49
51
|
|
50
52
|
when_the_repository "has an empty cookbook directory" do
|
51
|
-
directory 'cookbooks/cookbook1'
|
53
|
+
before { directory 'cookbooks/cookbook1' }
|
52
54
|
|
53
55
|
it "knife list --local -Rfp / does not return it" do
|
54
56
|
knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
|
@@ -58,7 +60,7 @@ EOM
|
|
58
60
|
end
|
59
61
|
|
60
62
|
when_the_repository "has only empty cookbook subdirectories" do
|
61
|
-
directory 'cookbooks/cookbook1/recipes'
|
63
|
+
before { directory 'cookbooks/cookbook1/recipes' }
|
62
64
|
|
63
65
|
it "knife list --local -Rfp / does not return it" do
|
64
66
|
knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
|
@@ -68,8 +70,10 @@ EOM
|
|
68
70
|
end
|
69
71
|
|
70
72
|
when_the_repository "has empty and non-empty cookbook subdirectories" do
|
71
|
-
|
72
|
-
|
73
|
+
before do
|
74
|
+
directory 'cookbooks/cookbook1/recipes'
|
75
|
+
file 'cookbooks/cookbook1/templates/default/x.txt', ''
|
76
|
+
end
|
73
77
|
|
74
78
|
it "knife list --local -Rfp / does not return the empty ones" do
|
75
79
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -83,7 +87,7 @@ EOM
|
|
83
87
|
end
|
84
88
|
|
85
89
|
when_the_repository "has only empty cookbook sub-sub-directories" do
|
86
|
-
directory 'cookbooks/cookbook1/templates/default'
|
90
|
+
before { directory 'cookbooks/cookbook1/templates/default' }
|
87
91
|
|
88
92
|
it "knife list --local -Rfp / does not return it" do
|
89
93
|
knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
|
@@ -93,9 +97,11 @@ EOM
|
|
93
97
|
end
|
94
98
|
|
95
99
|
when_the_repository "has empty cookbook sub-sub-directories alongside non-empty ones" do
|
96
|
-
|
97
|
-
|
98
|
-
|
100
|
+
before do
|
101
|
+
file 'cookbooks/cookbook1/templates/default/x.txt', ''
|
102
|
+
directory 'cookbooks/cookbook1/templates/rhel'
|
103
|
+
directory 'cookbooks/cookbook1/files/default'
|
104
|
+
end
|
99
105
|
|
100
106
|
it "knife list --local -Rfp / does not return the empty ones" do
|
101
107
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -109,8 +115,10 @@ EOM
|
|
109
115
|
end
|
110
116
|
|
111
117
|
when_the_repository "has an extra schmenvironments directory" do
|
112
|
-
|
113
|
-
|
118
|
+
before do
|
119
|
+
directory "schmenvironments" do
|
120
|
+
file "_default.json", {}
|
121
|
+
end
|
114
122
|
end
|
115
123
|
|
116
124
|
it "knife list --local -Rfp / should NOT return it" do
|
@@ -119,20 +127,22 @@ EOM
|
|
119
127
|
end
|
120
128
|
|
121
129
|
when_the_repository "has extra subdirectories and files under data bag items, roles, and environments" do
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
130
|
+
before do
|
131
|
+
directory "data_bags/bag1" do
|
132
|
+
file "item1.json", {}
|
133
|
+
file "item2.xml", ""
|
134
|
+
file "another_subdir/item.json", {}
|
135
|
+
end
|
136
|
+
directory "roles" do
|
137
|
+
file "role1.json", {}
|
138
|
+
file "role2.xml", ""
|
139
|
+
file "subdir/role.json", {}
|
140
|
+
end
|
141
|
+
directory "environments" do
|
142
|
+
file "environment1.json", {}
|
143
|
+
file "environment2.xml", ""
|
144
|
+
file "subdir/environment.json", {}
|
145
|
+
end
|
136
146
|
end
|
137
147
|
|
138
148
|
it "knife list --local -Rfp / should NOT return them" do
|
@@ -149,56 +159,58 @@ EOM
|
|
149
159
|
end
|
150
160
|
|
151
161
|
when_the_repository "has extraneous subdirectories and files under a cookbook" do
|
152
|
-
|
153
|
-
|
154
|
-
file 'blarghle/blah.rb', ''
|
155
|
-
directory 'attributes' do
|
156
|
-
file 'a.rb', ''
|
157
|
-
file 'b.json', {}
|
158
|
-
file 'c/d.rb', ''
|
159
|
-
file 'c/e.json', {}
|
160
|
-
end
|
161
|
-
directory 'definitions' do
|
162
|
-
file 'a.rb', ''
|
163
|
-
file 'b.json', {}
|
164
|
-
file 'c/d.rb', ''
|
165
|
-
file 'c/e.json', {}
|
166
|
-
end
|
167
|
-
directory 'recipes' do
|
162
|
+
before do
|
163
|
+
directory 'cookbooks/cookbook1' do
|
168
164
|
file 'a.rb', ''
|
169
|
-
file '
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
165
|
+
file 'blarghle/blah.rb', ''
|
166
|
+
directory 'attributes' do
|
167
|
+
file 'a.rb', ''
|
168
|
+
file 'b.json', {}
|
169
|
+
file 'c/d.rb', ''
|
170
|
+
file 'c/e.json', {}
|
171
|
+
end
|
172
|
+
directory 'definitions' do
|
173
|
+
file 'a.rb', ''
|
174
|
+
file 'b.json', {}
|
175
|
+
file 'c/d.rb', ''
|
176
|
+
file 'c/e.json', {}
|
177
|
+
end
|
178
|
+
directory 'recipes' do
|
179
|
+
file 'a.rb', ''
|
180
|
+
file 'b.json', {}
|
181
|
+
file 'c/d.rb', ''
|
182
|
+
file 'c/e.json', {}
|
183
|
+
end
|
184
|
+
directory 'libraries' do
|
185
|
+
file 'a.rb', ''
|
186
|
+
file 'b.json', {}
|
187
|
+
file 'c/d.rb', ''
|
188
|
+
file 'c/e.json', {}
|
189
|
+
end
|
190
|
+
directory 'templates' do
|
191
|
+
file 'a.rb', ''
|
192
|
+
file 'b.json', {}
|
193
|
+
file 'c/d.rb', ''
|
194
|
+
file 'c/e.json', {}
|
195
|
+
end
|
196
|
+
directory 'files' do
|
197
|
+
file 'a.rb', ''
|
198
|
+
file 'b.json', {}
|
199
|
+
file 'c/d.rb', ''
|
200
|
+
file 'c/e.json', {}
|
201
|
+
end
|
202
|
+
directory 'resources' do
|
203
|
+
file 'a.rb', ''
|
204
|
+
file 'b.json', {}
|
205
|
+
file 'c/d.rb', ''
|
206
|
+
file 'c/e.json', {}
|
207
|
+
end
|
208
|
+
directory 'providers' do
|
209
|
+
file 'a.rb', ''
|
210
|
+
file 'b.json', {}
|
211
|
+
file 'c/d.rb', ''
|
212
|
+
file 'c/e.json', {}
|
213
|
+
end
|
202
214
|
end
|
203
215
|
end
|
204
216
|
|
@@ -240,7 +252,7 @@ EOM
|
|
240
252
|
end
|
241
253
|
|
242
254
|
when_the_repository "has a file in cookbooks/" do
|
243
|
-
file 'cookbooks/file', ''
|
255
|
+
before { file 'cookbooks/file', '' }
|
244
256
|
it 'does not show up in list -Rfp' do
|
245
257
|
knife('list --local -Rfp /').should_succeed <<EOM
|
246
258
|
/cookbooks/
|
@@ -249,7 +261,7 @@ EOM
|
|
249
261
|
end
|
250
262
|
|
251
263
|
when_the_repository "has a file in data_bags/" do
|
252
|
-
file 'data_bags/file', ''
|
264
|
+
before { file 'data_bags/file', '' }
|
253
265
|
it 'does not show up in list -Rfp' do
|
254
266
|
knife('list --local -Rfp /').should_succeed <<EOM
|
255
267
|
/data_bags/
|
@@ -259,16 +271,20 @@ EOM
|
|
259
271
|
end
|
260
272
|
|
261
273
|
when_the_repository 'has a cookbook starting with .' do
|
262
|
-
|
263
|
-
|
274
|
+
before do
|
275
|
+
file 'cookbooks/.svn/metadata.rb', ''
|
276
|
+
file 'cookbooks/a.b/metadata.rb', ''
|
277
|
+
end
|
264
278
|
it 'knife list does not show it' do
|
265
279
|
knife('list --local -fp /cookbooks').should_succeed "/cookbooks/a.b/\n"
|
266
280
|
end
|
267
281
|
end
|
268
282
|
|
269
283
|
when_the_repository 'has a data bag starting with .' do
|
270
|
-
|
271
|
-
|
284
|
+
before do
|
285
|
+
file 'data_bags/.svn/x.json', {}
|
286
|
+
file 'data_bags/a.b/x.json', {}
|
287
|
+
end
|
272
288
|
it 'knife list does not show it' do
|
273
289
|
knife('list --local -fp /data_bags').should_succeed "/data_bags/a.b/\n"
|
274
290
|
end
|
@@ -20,23 +20,27 @@ require 'chef/knife/list'
|
|
20
20
|
require 'chef/knife/show'
|
21
21
|
|
22
22
|
describe 'chefignore tests' do
|
23
|
-
|
23
|
+
include IntegrationSupport
|
24
24
|
include KnifeSupport
|
25
25
|
|
26
26
|
when_the_repository "has lots of stuff in it" do
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
27
|
+
before do
|
28
|
+
file 'roles/x.json', {}
|
29
|
+
file 'environments/x.json', {}
|
30
|
+
file 'data_bags/bag1/x.json', {}
|
31
|
+
file 'cookbooks/cookbook1/x.json', {}
|
32
|
+
end
|
31
33
|
|
32
34
|
context "and has a chefignore everywhere except cookbooks" do
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
before do
|
36
|
+
chefignore = "x.json\nroles/x.json\nenvironments/x.json\ndata_bags/bag1/x.json\nbag1/x.json\ncookbooks/cookbook1/x.json\ncookbook1/x.json\n"
|
37
|
+
file 'chefignore', chefignore
|
38
|
+
file 'roles/chefignore', chefignore
|
39
|
+
file 'environments/chefignore', chefignore
|
40
|
+
file 'data_bags/chefignore', chefignore
|
41
|
+
file 'data_bags/bag1/chefignore', chefignore
|
42
|
+
file 'cookbooks/cookbook1/chefignore', chefignore
|
43
|
+
end
|
40
44
|
|
41
45
|
it 'matching files and directories get ignored' do
|
42
46
|
# NOTE: many of the "chefignore" files should probably not show up
|
@@ -58,9 +62,11 @@ EOM
|
|
58
62
|
end
|
59
63
|
|
60
64
|
when_the_repository 'has a cookbook with only chefignored files' do
|
61
|
-
|
62
|
-
|
63
|
-
|
65
|
+
before do
|
66
|
+
file 'cookbooks/cookbook1/templates/default/x.rb', ''
|
67
|
+
file 'cookbooks/cookbook1/libraries/x.rb', ''
|
68
|
+
file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
|
69
|
+
end
|
64
70
|
|
65
71
|
it 'the cookbook is not listed' do
|
66
72
|
knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'cookbook1' is empty or entirely chefignored at #{Chef::Config.chef_repo_path}/cookbooks/cookbook1\n")
|
@@ -70,13 +76,15 @@ EOM
|
|
70
76
|
end
|
71
77
|
|
72
78
|
when_the_repository "has multiple cookbooks" do
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
79
|
+
before do
|
80
|
+
file 'cookbooks/cookbook1/x.json', {}
|
81
|
+
file 'cookbooks/cookbook1/y.json', {}
|
82
|
+
file 'cookbooks/cookbook2/x.json', {}
|
83
|
+
file 'cookbooks/cookbook2/y.json', {}
|
84
|
+
end
|
77
85
|
|
78
86
|
context 'and has a chefignore with filenames' do
|
79
|
-
file 'cookbooks/chefignore', "x.json\n"
|
87
|
+
before { file 'cookbooks/chefignore', "x.json\n" }
|
80
88
|
|
81
89
|
it 'matching files and directories get ignored in all cookbooks' do
|
82
90
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -90,8 +98,10 @@ EOM
|
|
90
98
|
end
|
91
99
|
|
92
100
|
context "and has a chefignore with wildcards" do
|
93
|
-
|
94
|
-
|
101
|
+
before do
|
102
|
+
file 'cookbooks/chefignore', "x.*\n"
|
103
|
+
file 'cookbooks/cookbook1/x.rb', ''
|
104
|
+
end
|
95
105
|
|
96
106
|
it 'matching files and directories get ignored in all cookbooks' do
|
97
107
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -105,9 +115,11 @@ EOM
|
|
105
115
|
end
|
106
116
|
|
107
117
|
context "and has a chefignore with relative paths" do
|
108
|
-
|
109
|
-
|
110
|
-
|
118
|
+
before do
|
119
|
+
file 'cookbooks/cookbook1/recipes/x.rb', ''
|
120
|
+
file 'cookbooks/cookbook2/recipes/y.rb', ''
|
121
|
+
file 'cookbooks/chefignore', "recipes/x.rb\n"
|
122
|
+
end
|
111
123
|
|
112
124
|
it 'matching directories get ignored' do
|
113
125
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -125,8 +137,10 @@ EOM
|
|
125
137
|
end
|
126
138
|
|
127
139
|
context "and has a chefignore with subdirectories" do
|
128
|
-
|
129
|
-
|
140
|
+
before do
|
141
|
+
file 'cookbooks/cookbook1/recipes/y.rb', ''
|
142
|
+
file 'cookbooks/chefignore', "recipes\nrecipes/\n"
|
143
|
+
end
|
130
144
|
|
131
145
|
it 'matching directories do NOT get ignored' do
|
132
146
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -144,9 +158,11 @@ EOM
|
|
144
158
|
end
|
145
159
|
|
146
160
|
context "and has a chefignore that ignores all files in a subdirectory" do
|
147
|
-
|
148
|
-
|
149
|
-
|
161
|
+
before do
|
162
|
+
file 'cookbooks/cookbook1/templates/default/x.rb', ''
|
163
|
+
file 'cookbooks/cookbook1/libraries/x.rb', ''
|
164
|
+
file 'cookbooks/chefignore', "libraries/x.rb\ntemplates/default/x.rb\n"
|
165
|
+
end
|
150
166
|
|
151
167
|
it 'ignores the subdirectory entirely' do
|
152
168
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -162,7 +178,9 @@ EOM
|
|
162
178
|
end
|
163
179
|
|
164
180
|
context "and has an empty chefignore" do
|
165
|
-
|
181
|
+
before do
|
182
|
+
file 'cookbooks/chefignore', "\n"
|
183
|
+
end
|
166
184
|
|
167
185
|
it 'nothing is ignored' do
|
168
186
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -178,7 +196,9 @@ EOM
|
|
178
196
|
end
|
179
197
|
|
180
198
|
context "and has a chefignore with comments and empty lines" do
|
181
|
-
|
199
|
+
before do
|
200
|
+
file 'cookbooks/chefignore', "\n\n # blah\n#\nx.json\n\n"
|
201
|
+
end
|
182
202
|
|
183
203
|
it 'matching files and directories get ignored in all cookbooks' do
|
184
204
|
knife('list --local -Rfp /').should_succeed <<EOM
|
@@ -200,14 +220,18 @@ EOM
|
|
200
220
|
]
|
201
221
|
end
|
202
222
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
223
|
+
before do
|
224
|
+
file 'cookbooks1/mycookbook/metadata.rb', ''
|
225
|
+
file 'cookbooks1/mycookbook/x.json', {}
|
226
|
+
file 'cookbooks2/yourcookbook/metadata.rb', ''
|
227
|
+
file 'cookbooks2/yourcookbook/x.json', ''
|
228
|
+
end
|
207
229
|
|
208
230
|
context "and multiple chefignores" do
|
209
|
-
|
210
|
-
|
231
|
+
before do
|
232
|
+
file 'cookbooks1/chefignore', "metadata.rb\n"
|
233
|
+
file 'cookbooks2/chefignore', "x.json\n"
|
234
|
+
end
|
211
235
|
it "chefignores apply only to the directories they are in" do
|
212
236
|
knife('list --local -Rfp /').should_succeed <<EOM
|
213
237
|
/cookbooks/
|
@@ -219,10 +243,12 @@ EOM
|
|
219
243
|
end
|
220
244
|
|
221
245
|
context "and conflicting cookbooks" do
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
246
|
+
before do
|
247
|
+
file 'cookbooks1/yourcookbook/metadata.rb', ''
|
248
|
+
file 'cookbooks1/yourcookbook/x.json', ''
|
249
|
+
file 'cookbooks1/yourcookbook/onlyincookbooks1.rb', ''
|
250
|
+
file 'cookbooks2/yourcookbook/onlyincookbooks2.rb', ''
|
251
|
+
end
|
226
252
|
|
227
253
|
it "chefignores apply only to the winning cookbook" do
|
228
254
|
knife('list --local -Rfp /').should_succeed(<<EOM, :stderr => "WARN: Child with name 'yourcookbook' found in multiple directories: #{Chef::Config.chef_repo_path}/cookbooks1/yourcookbook and #{Chef::Config.chef_repo_path}/cookbooks2/yourcookbook\n")
|
@@ -239,7 +265,9 @@ EOM
|
|
239
265
|
end
|
240
266
|
|
241
267
|
when_the_repository 'has a cookbook named chefignore' do
|
242
|
-
|
268
|
+
before do
|
269
|
+
file 'cookbooks/chefignore/metadata.rb', {}
|
270
|
+
end
|
243
271
|
it 'knife list -Rfp /cookbooks shows it' do
|
244
272
|
knife('list --local -Rfp /cookbooks').should_succeed <<EOM
|
245
273
|
/cookbooks/chefignore/
|
@@ -249,9 +277,11 @@ EOM
|
|
249
277
|
end
|
250
278
|
|
251
279
|
when_the_repository 'has multiple cookbook paths, one with a chefignore file and the other with a cookbook named chefignore' do
|
252
|
-
|
253
|
-
|
254
|
-
|
280
|
+
before do
|
281
|
+
file 'cookbooks1/chefignore', ''
|
282
|
+
file 'cookbooks1/blah/metadata.rb', ''
|
283
|
+
file 'cookbooks2/chefignore/metadata.rb', ''
|
284
|
+
end
|
255
285
|
before :each do
|
256
286
|
Chef::Config.cookbook_path = [
|
257
287
|
File.join(Chef::Config.chef_repo_path, 'cookbooks1'),
|