chef 12.0.0.alpha.0-x86-mingw32 → 12.0.0.alpha.1-x86-mingw32
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
@@ -21,36 +21,38 @@ require 'chef/knife/list'
|
|
21
21
|
require 'chef/knife/show'
|
22
22
|
|
23
23
|
describe 'chef_repo_path tests' do
|
24
|
-
|
24
|
+
include IntegrationSupport
|
25
25
|
include KnifeSupport
|
26
26
|
|
27
27
|
# TODO alternate repo_path / *_path
|
28
28
|
context 'alternate *_path' do
|
29
29
|
when_the_repository 'has clients and clients2, cookbooks and cookbooks2, etc.' do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
30
|
+
before do
|
31
|
+
file 'clients/client1.json', {}
|
32
|
+
file 'cookbooks/cookbook1/metadata.rb', ''
|
33
|
+
file 'data_bags/bag/item.json', {}
|
34
|
+
file 'environments/env1.json', {}
|
35
|
+
file 'nodes/node1.json', {}
|
36
|
+
file 'roles/role1.json', {}
|
37
|
+
file 'users/user1.json', {}
|
38
|
+
|
39
|
+
file 'clients2/client2.json', {}
|
40
|
+
file 'cookbooks2/cookbook2/metadata.rb', ''
|
41
|
+
file 'data_bags2/bag2/item2.json', {}
|
42
|
+
file 'environments2/env2.json', {}
|
43
|
+
file 'nodes2/node2.json', {}
|
44
|
+
file 'roles2/role2.json', {}
|
45
|
+
file 'users2/user2.json', {}
|
46
|
+
|
47
|
+
directory 'chef_repo2' do
|
48
|
+
file 'clients/client3.json', {}
|
49
|
+
file 'cookbooks/cookbook3/metadata.rb', ''
|
50
|
+
file 'data_bags/bag3/item3.json', {}
|
51
|
+
file 'environments/env3.json', {}
|
52
|
+
file 'nodes/node3.json', {}
|
53
|
+
file 'roles/role3.json', {}
|
54
|
+
file 'users/user3.json', {}
|
55
|
+
end
|
54
56
|
end
|
55
57
|
|
56
58
|
it 'knife list --local -Rfp --chef-repo-path chef_repo2 / grabs chef_repo2 stuff' do
|
@@ -105,21 +107,21 @@ EOM
|
|
105
107
|
end
|
106
108
|
|
107
109
|
context 'when cwd is at the top level' do
|
108
|
-
cwd '.'
|
110
|
+
before { cwd '.' }
|
109
111
|
it 'knife list --local -Rfp fails' do
|
110
112
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
111
113
|
end
|
112
114
|
end
|
113
115
|
|
114
116
|
context 'when cwd is inside the data_bags directory' do
|
115
|
-
cwd 'data_bags'
|
117
|
+
before { cwd 'data_bags' }
|
116
118
|
it 'knife list --local -Rfp fails' do
|
117
119
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
118
120
|
end
|
119
121
|
end
|
120
122
|
|
121
123
|
context 'when cwd is inside chef_repo2' do
|
122
|
-
cwd 'chef_repo2'
|
124
|
+
before { cwd 'chef_repo2' }
|
123
125
|
it 'knife list --local -Rfp lists everything' do
|
124
126
|
knife('list --local -Rfp').should_succeed <<EOM
|
125
127
|
clients/
|
@@ -143,7 +145,7 @@ EOM
|
|
143
145
|
end
|
144
146
|
|
145
147
|
context 'when cwd is inside data_bags2' do
|
146
|
-
cwd 'data_bags2'
|
148
|
+
before { cwd 'data_bags2' }
|
147
149
|
it 'knife list --local -Rfp lists data bags' do
|
148
150
|
knife('list --local -Rfp').should_succeed <<EOM
|
149
151
|
bag2/
|
@@ -164,7 +166,7 @@ EOM
|
|
164
166
|
end
|
165
167
|
|
166
168
|
context 'when cwd is at the top level' do
|
167
|
-
cwd '.'
|
169
|
+
before { cwd '.' }
|
168
170
|
it 'knife list --local -Rfp lists everything' do
|
169
171
|
knife('list --local -Rfp').should_succeed <<EOM
|
170
172
|
clients/
|
@@ -188,21 +190,21 @@ EOM
|
|
188
190
|
end
|
189
191
|
|
190
192
|
context 'when cwd is inside the data_bags directory' do
|
191
|
-
cwd 'data_bags'
|
193
|
+
before { cwd 'data_bags' }
|
192
194
|
it 'knife list --local -Rfp fails' do
|
193
195
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
194
196
|
end
|
195
197
|
end
|
196
198
|
|
197
199
|
context 'when cwd is inside chef_repo2' do
|
198
|
-
cwd 'chef_repo2'
|
200
|
+
before { cwd 'chef_repo2' }
|
199
201
|
it 'knife list -Rfp fails' do
|
200
202
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
201
203
|
end
|
202
204
|
end
|
203
205
|
|
204
206
|
context 'when cwd is inside data_bags2' do
|
205
|
-
cwd 'data_bags2'
|
207
|
+
before { cwd 'data_bags2' }
|
206
208
|
it 'knife list --local -Rfp lists data bags' do
|
207
209
|
knife('list --local -Rfp').should_succeed <<EOM
|
208
210
|
bag2/
|
@@ -221,21 +223,21 @@ EOM
|
|
221
223
|
end
|
222
224
|
|
223
225
|
context 'when cwd is at the top level' do
|
224
|
-
cwd '.'
|
226
|
+
before { cwd '.' }
|
225
227
|
it 'knife list --local -Rfp fails' do
|
226
228
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
227
229
|
end
|
228
230
|
end
|
229
231
|
|
230
232
|
context 'when cwd is inside the data_bags directory' do
|
231
|
-
cwd 'data_bags'
|
233
|
+
before { cwd 'data_bags' }
|
232
234
|
it 'knife list --local -Rfp fails' do
|
233
235
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
234
236
|
end
|
235
237
|
end
|
236
238
|
|
237
239
|
context 'when cwd is inside chef_repo2' do
|
238
|
-
cwd 'chef_repo2'
|
240
|
+
before { cwd 'chef_repo2' }
|
239
241
|
it 'knife list --local -Rfp lists everything' do
|
240
242
|
knife('list --local -Rfp').should_succeed <<EOM
|
241
243
|
clients/
|
@@ -259,7 +261,7 @@ EOM
|
|
259
261
|
end
|
260
262
|
|
261
263
|
context 'when cwd is inside chef_repo2/data_bags' do
|
262
|
-
cwd 'chef_repo2/data_bags'
|
264
|
+
before { cwd 'chef_repo2/data_bags' }
|
263
265
|
it 'knife list --local -Rfp lists data bags' do
|
264
266
|
knife('list --local -Rfp').should_succeed <<EOM
|
265
267
|
bag3/
|
@@ -281,20 +283,25 @@ EOM
|
|
281
283
|
end
|
282
284
|
|
283
285
|
context 'when there is a directory in clients1 and file in clients2 with the same name' do
|
284
|
-
|
285
|
-
|
286
|
+
before do
|
287
|
+
directory 'clients/blah.json'
|
288
|
+
file 'clients2/blah.json', {}
|
289
|
+
end
|
286
290
|
it 'knife show /clients/blah.json succeeds' do
|
287
291
|
knife('show --local /clients/blah.json').should_succeed <<EOM
|
288
292
|
/clients/blah.json:
|
289
293
|
{
|
294
|
+
|
290
295
|
}
|
291
296
|
EOM
|
292
297
|
end
|
293
298
|
end
|
294
299
|
|
295
300
|
context 'when there is a file in cookbooks1 and directory in cookbooks2 with the same name' do
|
296
|
-
|
297
|
-
|
301
|
+
before do
|
302
|
+
file 'cookbooks/blah', ''
|
303
|
+
file 'cookbooks2/blah/metadata.rb', ''
|
304
|
+
end
|
298
305
|
it 'knife list -Rfp cookbooks shows files in blah' do
|
299
306
|
knife('list --local -Rfp /cookbooks').should_succeed <<EOM
|
300
307
|
/cookbooks/blah/
|
@@ -308,8 +315,10 @@ EOM
|
|
308
315
|
end
|
309
316
|
|
310
317
|
context 'when there is an empty directory in cookbooks1 and a real cookbook in cookbooks2 with the same name' do
|
311
|
-
|
312
|
-
|
318
|
+
before do
|
319
|
+
directory 'cookbooks/blah'
|
320
|
+
file 'cookbooks2/blah/metadata.rb', ''
|
321
|
+
end
|
313
322
|
it 'knife list -Rfp cookbooks shows files in blah' do
|
314
323
|
knife('list --local -Rfp /cookbooks').should_succeed(<<EOM, :stderr => "WARN: Cookbook 'blah' is empty or entirely chefignored at #{Chef::Config.cookbook_path[0]}/blah\n")
|
315
324
|
/cookbooks/blah/
|
@@ -323,8 +332,10 @@ EOM
|
|
323
332
|
end
|
324
333
|
|
325
334
|
context 'when there is a cookbook in cookbooks1 and a cookbook in cookbooks2 with the same name' do
|
326
|
-
|
327
|
-
|
335
|
+
before do
|
336
|
+
file 'cookbooks/blah/metadata.json', {}
|
337
|
+
file 'cookbooks2/blah/metadata.rb', ''
|
338
|
+
end
|
328
339
|
it 'knife list -Rfp cookbooks shows files in the first cookbook and not the second' do
|
329
340
|
knife('list --local -Rfp /cookbooks').should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.cookbook_path[0]}/blah and #{Chef::Config.cookbook_path[1]}/blah\n")
|
330
341
|
/cookbooks/blah/
|
@@ -338,8 +349,10 @@ EOM
|
|
338
349
|
end
|
339
350
|
|
340
351
|
context 'when there is a file in data_bags1 and a directory in data_bags2 with the same name' do
|
341
|
-
|
342
|
-
|
352
|
+
before do
|
353
|
+
file 'data_bags/blah', ''
|
354
|
+
file 'data_bags2/blah/item.json', ''
|
355
|
+
end
|
343
356
|
it 'knife list -Rfp data_bags shows files in blah' do
|
344
357
|
knife('list --local -Rfp /data_bags').should_succeed <<EOM
|
345
358
|
/data_bags/bag/
|
@@ -353,8 +366,10 @@ EOM
|
|
353
366
|
end
|
354
367
|
|
355
368
|
context 'when there is a data bag in data_bags1 and a data bag in data_bags2 with the same name' do
|
356
|
-
|
357
|
-
|
369
|
+
before do
|
370
|
+
file 'data_bags/blah/item1.json', ''
|
371
|
+
file 'data_bags2/blah/item2.json', ''
|
372
|
+
end
|
358
373
|
it 'knife list -Rfp data_bags shows only items in data_bags1' do
|
359
374
|
knife('list --local -Rfp /data_bags').should_succeed(<<EOM, :stderr => "WARN: Child with name 'blah' found in multiple directories: #{Chef::Config.data_bag_path[0]}/blah and #{Chef::Config.data_bag_path[1]}/blah\n")
|
360
375
|
/data_bags/bag/
|
@@ -368,62 +383,74 @@ EOM
|
|
368
383
|
end
|
369
384
|
|
370
385
|
context 'when there is a directory in environments1 and file in environments2 with the same name' do
|
371
|
-
|
372
|
-
|
386
|
+
before do
|
387
|
+
directory 'environments/blah.json'
|
388
|
+
file 'environments2/blah.json', {}
|
389
|
+
end
|
373
390
|
it 'knife show /environments/blah.json succeeds' do
|
374
391
|
knife('show --local /environments/blah.json').should_succeed <<EOM
|
375
392
|
/environments/blah.json:
|
376
393
|
{
|
394
|
+
|
377
395
|
}
|
378
396
|
EOM
|
379
397
|
end
|
380
398
|
end
|
381
399
|
|
382
400
|
context 'when there is a directory in nodes1 and file in nodes2 with the same name' do
|
383
|
-
|
384
|
-
|
401
|
+
before do
|
402
|
+
directory 'nodes/blah.json'
|
403
|
+
file 'nodes2/blah.json', {}
|
404
|
+
end
|
385
405
|
it 'knife show /nodes/blah.json succeeds' do
|
386
406
|
knife('show --local /nodes/blah.json').should_succeed <<EOM
|
387
407
|
/nodes/blah.json:
|
388
408
|
{
|
409
|
+
|
389
410
|
}
|
390
411
|
EOM
|
391
412
|
end
|
392
413
|
end
|
393
414
|
|
394
415
|
context 'when there is a directory in roles1 and file in roles2 with the same name' do
|
395
|
-
|
396
|
-
|
416
|
+
before do
|
417
|
+
directory 'roles/blah.json'
|
418
|
+
file 'roles2/blah.json', {}
|
419
|
+
end
|
397
420
|
it 'knife show /roles/blah.json succeeds' do
|
398
421
|
knife('show --local /roles/blah.json').should_succeed <<EOM
|
399
422
|
/roles/blah.json:
|
400
423
|
{
|
424
|
+
|
401
425
|
}
|
402
426
|
EOM
|
403
427
|
end
|
404
428
|
end
|
405
429
|
|
406
430
|
context 'when there is a directory in users1 and file in users2 with the same name' do
|
407
|
-
|
408
|
-
|
431
|
+
before do
|
432
|
+
directory 'users/blah.json'
|
433
|
+
file 'users2/blah.json', {}
|
434
|
+
end
|
409
435
|
it 'knife show /users/blah.json succeeds' do
|
410
436
|
knife('show --local /users/blah.json').should_succeed <<EOM
|
411
437
|
/users/blah.json:
|
412
438
|
{
|
439
|
+
|
413
440
|
}
|
414
441
|
EOM
|
415
442
|
end
|
416
443
|
end
|
417
444
|
|
418
445
|
context 'when cwd is at the top level' do
|
419
|
-
cwd '.'
|
446
|
+
before { cwd '.' }
|
420
447
|
it 'knife list --local -Rfp fails' do
|
421
448
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
422
449
|
end
|
423
450
|
end
|
424
451
|
|
425
452
|
context 'when cwd is inside the data_bags directory' do
|
426
|
-
cwd 'data_bags'
|
453
|
+
before { cwd 'data_bags' }
|
427
454
|
it 'knife list --local -Rfp lists data bags' do
|
428
455
|
knife('list --local -Rfp').should_succeed <<EOM
|
429
456
|
bag/
|
@@ -435,7 +462,7 @@ EOM
|
|
435
462
|
end
|
436
463
|
|
437
464
|
context 'when cwd is inside chef_repo2' do
|
438
|
-
cwd 'chef_repo2'
|
465
|
+
before { cwd 'chef_repo2' }
|
439
466
|
it 'knife list --local -Rfp lists everything' do
|
440
467
|
knife('list --local -Rfp').should_succeed <<EOM
|
441
468
|
clients/
|
@@ -468,7 +495,7 @@ EOM
|
|
468
495
|
end
|
469
496
|
|
470
497
|
context 'when cwd is inside data_bags2' do
|
471
|
-
cwd 'data_bags2'
|
498
|
+
before { cwd 'data_bags2' }
|
472
499
|
it 'knife list --local -Rfp lists data bags' do
|
473
500
|
knife('list --local -Rfp').should_succeed <<EOM
|
474
501
|
bag/
|
@@ -492,7 +519,7 @@ EOM
|
|
492
519
|
end
|
493
520
|
|
494
521
|
context 'when cwd is at the top level' do
|
495
|
-
cwd '.'
|
522
|
+
before { cwd '.' }
|
496
523
|
it 'knife list --local -Rfp lists everything' do
|
497
524
|
knife('list --local -Rfp').should_succeed <<EOM
|
498
525
|
clients/
|
@@ -525,7 +552,7 @@ EOM
|
|
525
552
|
end
|
526
553
|
|
527
554
|
context 'when cwd is inside the data_bags directory' do
|
528
|
-
cwd 'data_bags'
|
555
|
+
before { cwd 'data_bags' }
|
529
556
|
it 'knife list --local -Rfp lists data bags' do
|
530
557
|
knife('list --local -Rfp').should_succeed <<EOM
|
531
558
|
bag/
|
@@ -537,7 +564,7 @@ EOM
|
|
537
564
|
end
|
538
565
|
|
539
566
|
context 'when cwd is inside chef_repo2' do
|
540
|
-
cwd 'chef_repo2'
|
567
|
+
before { cwd 'chef_repo2' }
|
541
568
|
it 'knife list --local -Rfp lists everything' do
|
542
569
|
knife('list --local -Rfp').should_succeed <<EOM
|
543
570
|
clients/
|
@@ -570,7 +597,7 @@ EOM
|
|
570
597
|
end
|
571
598
|
|
572
599
|
context 'when cwd is inside chef_repo2/data_bags' do
|
573
|
-
cwd 'chef_repo2/data_bags'
|
600
|
+
before { cwd 'chef_repo2/data_bags' }
|
574
601
|
it 'knife list --local -Rfp lists data bags' do
|
575
602
|
knife('list --local -Rfp').should_succeed <<EOM
|
576
603
|
bag/
|
@@ -592,21 +619,21 @@ EOM
|
|
592
619
|
end
|
593
620
|
|
594
621
|
context 'when cwd is at the top level' do
|
595
|
-
cwd '.'
|
622
|
+
before { cwd '.' }
|
596
623
|
it 'knife list --local -Rfp fails' do
|
597
624
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
598
625
|
end
|
599
626
|
end
|
600
627
|
|
601
628
|
context 'when cwd is inside the data_bags directory' do
|
602
|
-
cwd 'data_bags'
|
629
|
+
before { cwd 'data_bags' }
|
603
630
|
it 'knife list --local -Rfp fails' do
|
604
631
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
605
632
|
end
|
606
633
|
end
|
607
634
|
|
608
635
|
context 'when cwd is inside chef_repo2' do
|
609
|
-
cwd 'chef_repo2'
|
636
|
+
before { cwd 'chef_repo2' }
|
610
637
|
it 'knife list --local -Rfp lists everything' do
|
611
638
|
knife('list --local -Rfp').should_succeed <<EOM
|
612
639
|
clients/
|
@@ -630,7 +657,7 @@ EOM
|
|
630
657
|
end
|
631
658
|
|
632
659
|
context 'when cwd is inside chef_repo2/data_bags' do
|
633
|
-
cwd 'chef_repo2/data_bags'
|
660
|
+
before { cwd 'chef_repo2/data_bags' }
|
634
661
|
it 'knife list --local -Rfp lists data bags' do
|
635
662
|
knife('list --local -Rfp').should_succeed <<EOM
|
636
663
|
bag3/
|
@@ -653,7 +680,7 @@ EOM
|
|
653
680
|
end
|
654
681
|
|
655
682
|
context 'when cwd is at the top level' do
|
656
|
-
cwd '.'
|
683
|
+
before { cwd '.' }
|
657
684
|
it 'knife list --local -Rfp lists everything' do
|
658
685
|
knife('list --local -Rfp').should_succeed <<EOM
|
659
686
|
clients/
|
@@ -686,7 +713,7 @@ EOM
|
|
686
713
|
end
|
687
714
|
|
688
715
|
context 'when cwd is inside the data_bags directory' do
|
689
|
-
cwd 'data_bags'
|
716
|
+
before { cwd 'data_bags' }
|
690
717
|
it 'knife list --local -Rfp lists data bags' do
|
691
718
|
knife('list --local -Rfp').should_succeed <<EOM
|
692
719
|
bag/
|
@@ -698,7 +725,7 @@ EOM
|
|
698
725
|
end
|
699
726
|
|
700
727
|
context 'when cwd is inside chef_repo2' do
|
701
|
-
cwd 'chef_repo2'
|
728
|
+
before { cwd 'chef_repo2' }
|
702
729
|
it 'knife list --local -Rfp lists everything' do
|
703
730
|
knife('list --local -Rfp').should_succeed <<EOM
|
704
731
|
clients/
|
@@ -731,7 +758,7 @@ EOM
|
|
731
758
|
end
|
732
759
|
|
733
760
|
context 'when cwd is inside chef_repo2/data_bags' do
|
734
|
-
cwd 'chef_repo2/data_bags'
|
761
|
+
before { cwd 'chef_repo2/data_bags' }
|
735
762
|
it 'knife list --local -Rfp lists data bags' do
|
736
763
|
knife('list --local -Rfp').should_succeed <<EOM
|
737
764
|
bag/
|
@@ -753,14 +780,14 @@ EOM
|
|
753
780
|
end
|
754
781
|
|
755
782
|
context 'when cwd is at the top level' do
|
756
|
-
cwd '.'
|
783
|
+
before { cwd '.' }
|
757
784
|
it 'knife list --local -Rfp fails' do
|
758
785
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
759
786
|
end
|
760
787
|
end
|
761
788
|
|
762
789
|
context 'when cwd is inside the data_bags directory' do
|
763
|
-
cwd 'data_bags'
|
790
|
+
before { cwd 'data_bags' }
|
764
791
|
it 'knife list --local -Rfp lists data bags' do
|
765
792
|
knife('list --local -Rfp').should_succeed <<EOM
|
766
793
|
bag/
|
@@ -770,7 +797,7 @@ EOM
|
|
770
797
|
end
|
771
798
|
|
772
799
|
context 'when cwd is inside chef_repo2' do
|
773
|
-
cwd 'chef_repo2'
|
800
|
+
before { cwd 'chef_repo2' }
|
774
801
|
it 'knife list --local -Rfp lists everything' do
|
775
802
|
knife('list --local -Rfp').should_succeed <<EOM
|
776
803
|
clients/
|
@@ -794,7 +821,7 @@ EOM
|
|
794
821
|
end
|
795
822
|
|
796
823
|
context 'when cwd is inside chef_repo2/data_bags' do
|
797
|
-
cwd 'chef_repo2/data_bags'
|
824
|
+
before { cwd 'chef_repo2/data_bags' }
|
798
825
|
it 'knife list --local -Rfp fails' do
|
799
826
|
knife('list --local -Rfp').should_fail("ERROR: Attempt to use relative path '' when current directory is outside the repository path\n")
|
800
827
|
end
|
@@ -828,7 +855,7 @@ EOM
|
|
828
855
|
end
|
829
856
|
|
830
857
|
context 'when cwd is inside the data_bags directory' do
|
831
|
-
cwd 'data_bags'
|
858
|
+
before { cwd 'data_bags' }
|
832
859
|
it 'knife list --local -Rfp lists data bags' do
|
833
860
|
knife('list --local -Rfp').should_succeed <<EOM
|
834
861
|
bag/
|