knife-essentials 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/chef/knife/delete_essentials.rb +37 -8
- data/lib/chef/knife/deps_essentials.rb +5 -5
- data/lib/chef/knife/diff_essentials.rb +9 -1
- data/lib/chef/knife/download_essentials.rb +1 -1
- data/lib/chef/knife/list_essentials.rb +5 -5
- data/lib/chef/knife/raw_essentials.rb +7 -2
- data/lib/chef/knife/show_essentials.rb +14 -4
- data/lib/chef/knife/upload_essentials.rb +1 -1
- data/lib/chef_fs/command_line.rb +18 -10
- data/lib/chef_fs/file_system.rb +4 -4
- data/lib/chef_fs/file_system/base_fs_object.rb +10 -10
- data/lib/chef_fs/file_system/chef_repository_file_system_root_dir.rb +1 -1
- data/lib/chef_fs/file_system/chef_server_root_dir.rb +0 -2
- data/lib/chef_fs/file_system/cookbook_dir.rb +17 -12
- data/lib/chef_fs/file_system/cookbooks_dir.rb +1 -1
- data/lib/chef_fs/file_system/data_bag_dir.rb +4 -3
- data/lib/chef_fs/file_system/data_bag_item.rb +1 -1
- data/lib/chef_fs/file_system/data_bags_dir.rb +2 -2
- data/lib/chef_fs/file_system/{operation_skipped_error.rb → default_environment_cannot_be_modified_error.rb} +8 -3
- data/lib/chef_fs/file_system/environments_dir.rb +5 -7
- data/lib/chef_fs/file_system/file_system_entry.rb +6 -6
- data/lib/chef_fs/file_system/must_delete_recursively_error.rb +4 -1
- data/lib/chef_fs/file_system/nodes_dir.rb +2 -2
- data/lib/chef_fs/file_system/nonexistent_fs_object.rb +0 -12
- data/lib/chef_fs/file_system/not_found_error.rb +4 -1
- data/lib/chef_fs/file_system/operation_not_allowed_error.rb +19 -1
- data/lib/chef_fs/file_system/rest_list_dir.rb +2 -2
- data/lib/chef_fs/file_system/rest_list_entry.rb +3 -3
- data/lib/chef_fs/knife.rb +5 -4
- data/lib/chef_fs/path_utils.rb +6 -4
- data/lib/chef_fs/version.rb +1 -1
- data/spec/integration/delete_spec.rb +684 -0
- data/spec/integration/diff_spec.rb +75 -1
- data/spec/integration/download_spec.rb +101 -4
- data/spec/integration/raw_spec.rb +171 -0
- data/spec/integration/show_spec.rb +124 -0
- data/spec/integration/upload_spec.rb +122 -13
- metadata +6 -3
@@ -36,7 +36,7 @@ EOM
|
|
36
36
|
end
|
37
37
|
|
38
38
|
it 'knife upload --purge deletes everything' do
|
39
|
-
knife('upload --purge /').should_succeed(<<EOM, :stderr => "
|
39
|
+
knife('upload --purge /').should_succeed(<<EOM, :stderr => "WARNING: /environments/_default.json cannot be deleted (default environment cannot be modified).\n")
|
40
40
|
Deleted extra entry /cookbooks/x (purge is on)
|
41
41
|
Deleted extra entry /data_bags/x (purge is on)
|
42
42
|
Deleted extra entry /environments/x.json (purge is on)
|
@@ -111,7 +111,7 @@ EOM
|
|
111
111
|
EOM
|
112
112
|
|
113
113
|
it 'knife upload makes no changes' do
|
114
|
-
knife('upload /').should_succeed ''
|
114
|
+
knife('upload /cookbooks/x').should_succeed ''
|
115
115
|
knife('diff --name-status /').should_succeed ''
|
116
116
|
end
|
117
117
|
|
@@ -144,6 +144,30 @@ EOM
|
|
144
144
|
end
|
145
145
|
end
|
146
146
|
|
147
|
+
context 'except the role file is textually different, but not ACTUALLY different' do
|
148
|
+
file 'roles/x.json', <<EOM
|
149
|
+
{
|
150
|
+
"chef_type": "role",
|
151
|
+
"default_attributes": {
|
152
|
+
},
|
153
|
+
"env_run_lists": {
|
154
|
+
},
|
155
|
+
"json_class": "Chef::Role",
|
156
|
+
"name": "x",
|
157
|
+
"description": "",
|
158
|
+
"override_attributes": {
|
159
|
+
},
|
160
|
+
"run_list": [
|
161
|
+
|
162
|
+
]
|
163
|
+
}
|
164
|
+
EOM
|
165
|
+
it 'knife upload / does not change anything' do
|
166
|
+
knife('upload /').should_succeed ''
|
167
|
+
knife('diff --name-status /').should_succeed ''
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
147
171
|
context 'as well as one extra copy of each thing' do
|
148
172
|
file 'clients/y.json', { 'name' => 'y' }
|
149
173
|
file 'cookbooks/x/blah.rb', ''
|
@@ -220,10 +244,10 @@ EOM
|
|
220
244
|
|
221
245
|
it 'knife upload --purge deletes nothing' do
|
222
246
|
knife('upload --purge /').should_fail <<EOM
|
223
|
-
ERROR:
|
224
|
-
ERROR:
|
225
|
-
ERROR:
|
226
|
-
ERROR:
|
247
|
+
ERROR: /cookbooks cannot be deleted.
|
248
|
+
ERROR: /data_bags cannot be deleted.
|
249
|
+
ERROR: /environments cannot be deleted.
|
250
|
+
ERROR: /roles cannot be deleted.
|
227
251
|
EOM
|
228
252
|
knife('diff --name-status /').should_succeed <<EOM
|
229
253
|
D\t/cookbooks
|
@@ -346,6 +370,28 @@ Deleted extra entry /data_bags/x/deleted.json (purge is on)
|
|
346
370
|
EOM
|
347
371
|
knife('diff --name-status /data_bags').should_succeed ''
|
348
372
|
end
|
373
|
+
context 'when cwd is the /data_bags directory' do
|
374
|
+
cwd 'data_bags'
|
375
|
+
it 'knife upload fails' do
|
376
|
+
knife('upload').should_fail "FATAL: Must specify at least one argument. If you want to upload everything in this directory, type \"knife upload .\"\n", :stdout => /USAGE/
|
377
|
+
end
|
378
|
+
it 'knife upload --purge . uploads everything' do
|
379
|
+
knife('upload --purge .').should_succeed <<EOM
|
380
|
+
Created x/added.json
|
381
|
+
Updated x/modified.json
|
382
|
+
Deleted extra entry x/deleted.json (purge is on)
|
383
|
+
EOM
|
384
|
+
knife('diff --name-status /data_bags').should_succeed ''
|
385
|
+
end
|
386
|
+
it 'knife upload --purge * uploads everything' do
|
387
|
+
knife('upload --purge *').should_succeed <<EOM
|
388
|
+
Created x/added.json
|
389
|
+
Updated x/modified.json
|
390
|
+
Deleted extra entry x/deleted.json (purge is on)
|
391
|
+
EOM
|
392
|
+
knife('diff --name-status /data_bags').should_succeed ''
|
393
|
+
end
|
394
|
+
end
|
349
395
|
end
|
350
396
|
end
|
351
397
|
|
@@ -358,9 +404,9 @@ EOM
|
|
358
404
|
file 'cookbooks/x/metadata.rb', 'version "1.0.0"'
|
359
405
|
file 'cookbooks/x/y.rb', 'hi'
|
360
406
|
it 'knife upload of any individual file fails' do
|
361
|
-
knife('upload /cookbooks/x/metadata.rb').should_fail "ERROR:
|
362
|
-
knife('upload /cookbooks/x/y.rb').should_fail "ERROR:
|
363
|
-
knife('upload --purge /cookbooks/x/z.rb').should_fail "ERROR:
|
407
|
+
knife('upload /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb cannot be updated.\n"
|
408
|
+
knife('upload /cookbooks/x/y.rb').should_fail "ERROR: /cookbooks/x cannot have a child created under it.\n"
|
409
|
+
knife('upload --purge /cookbooks/x/z.rb').should_fail "ERROR: /cookbooks/x/z.rb cannot be deleted.\n"
|
364
410
|
end
|
365
411
|
# TODO this is a bit of an inconsistency: if we didn't specify --purge,
|
366
412
|
# technically we shouldn't have deleted missing files. But ... cookbooks
|
@@ -400,8 +446,71 @@ EOM
|
|
400
446
|
end
|
401
447
|
end
|
402
448
|
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
449
|
+
when_the_repository 'has a cookbook' do
|
450
|
+
file 'cookbooks/x/metadata.rb', 'version "1.0.0"'
|
451
|
+
file 'cookbooks/x/onlyin1.0.0.rb', 'old_text'
|
452
|
+
|
453
|
+
when_the_chef_server 'has a later version for the cookbook' do
|
454
|
+
cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'onlyin1.0.0.rb' => '' }
|
455
|
+
cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'onlyin1.0.1.rb' => 'hi' }
|
456
|
+
|
457
|
+
it 'knife upload /cookbooks/x uploads the local version' do
|
458
|
+
knife('diff --name-status /cookbooks').should_succeed <<EOM
|
459
|
+
M\t/cookbooks/x/metadata.rb
|
460
|
+
D\t/cookbooks/x/onlyin1.0.1.rb
|
461
|
+
A\t/cookbooks/x/onlyin1.0.0.rb
|
462
|
+
EOM
|
463
|
+
knife('upload --purge /cookbooks/x').should_succeed <<EOM
|
464
|
+
Updated /cookbooks/x
|
465
|
+
EOM
|
466
|
+
knife('diff --name-status /cookbooks').should_succeed <<EOM
|
467
|
+
M\t/cookbooks/x/metadata.rb
|
468
|
+
D\t/cookbooks/x/onlyin1.0.1.rb
|
469
|
+
A\t/cookbooks/x/onlyin1.0.0.rb
|
470
|
+
EOM
|
471
|
+
end
|
472
|
+
end
|
473
|
+
|
474
|
+
when_the_chef_server 'has an earlier version for the cookbook' do
|
475
|
+
cookbook 'x', '1.0.0', { 'metadata.rb' => 'version "1.0.0"', 'onlyin1.0.0.rb' => ''}
|
476
|
+
cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'onlyin0.9.9.rb' => 'hi' }
|
477
|
+
it 'knife upload /cookbooks/x uploads the local version' do
|
478
|
+
knife('upload --purge /cookbooks/x').should_succeed <<EOM
|
479
|
+
Updated /cookbooks/x
|
480
|
+
EOM
|
481
|
+
knife('diff --name-status /cookbooks').should_succeed ''
|
482
|
+
end
|
483
|
+
end
|
484
|
+
|
485
|
+
when_the_chef_server 'has a later version for the cookbook, and no current version' do
|
486
|
+
cookbook 'x', '1.0.1', { 'metadata.rb' => 'version "1.0.1"', 'onlyin1.0.1.rb' => 'hi' }
|
487
|
+
|
488
|
+
it 'knife upload /cookbooks/x uploads the local version' do
|
489
|
+
knife('diff --name-status /cookbooks').should_succeed <<EOM
|
490
|
+
M\t/cookbooks/x/metadata.rb
|
491
|
+
D\t/cookbooks/x/onlyin1.0.1.rb
|
492
|
+
A\t/cookbooks/x/onlyin1.0.0.rb
|
493
|
+
EOM
|
494
|
+
knife('upload --purge /cookbooks/x').should_succeed <<EOM
|
495
|
+
Updated /cookbooks/x
|
496
|
+
EOM
|
497
|
+
knife('diff --name-status /cookbooks').should_succeed <<EOM
|
498
|
+
M\t/cookbooks/x/metadata.rb
|
499
|
+
D\t/cookbooks/x/onlyin1.0.1.rb
|
500
|
+
A\t/cookbooks/x/onlyin1.0.0.rb
|
501
|
+
EOM
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
when_the_chef_server 'has an earlier version for the cookbook, and no current version' do
|
506
|
+
cookbook 'x', '0.9.9', { 'metadata.rb' => 'version "0.9.9"', 'onlyin0.9.9.rb' => 'hi' }
|
507
|
+
|
508
|
+
it 'knife upload /cookbooks/x uploads the new version' do
|
509
|
+
knife('upload --purge /cookbooks/x').should_succeed <<EOM
|
510
|
+
Updated /cookbooks/x
|
511
|
+
EOM
|
512
|
+
knife('diff --name-status /cookbooks').should_succeed ''
|
513
|
+
end
|
514
|
+
end
|
515
|
+
end
|
407
516
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-01-
|
12
|
+
date: 2013-01-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef-zero
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- lib/chef_fs/file_system/data_bag_dir.rb
|
62
62
|
- lib/chef_fs/file_system/data_bag_item.rb
|
63
63
|
- lib/chef_fs/file_system/data_bags_dir.rb
|
64
|
+
- lib/chef_fs/file_system/default_environment_cannot_be_modified_error.rb
|
64
65
|
- lib/chef_fs/file_system/environments_dir.rb
|
65
66
|
- lib/chef_fs/file_system/file_system_entry.rb
|
66
67
|
- lib/chef_fs/file_system/file_system_error.rb
|
@@ -71,7 +72,6 @@ files:
|
|
71
72
|
- lib/chef_fs/file_system/nonexistent_fs_object.rb
|
72
73
|
- lib/chef_fs/file_system/not_found_error.rb
|
73
74
|
- lib/chef_fs/file_system/operation_not_allowed_error.rb
|
74
|
-
- lib/chef_fs/file_system/operation_skipped_error.rb
|
75
75
|
- lib/chef_fs/file_system/rest_list_dir.rb
|
76
76
|
- lib/chef_fs/file_system/rest_list_entry.rb
|
77
77
|
- lib/chef_fs/file_system.rb
|
@@ -88,10 +88,13 @@ files:
|
|
88
88
|
- spec/integration/chef_repo_path_spec.rb
|
89
89
|
- spec/integration/chef_repository_file_system_spec.rb
|
90
90
|
- spec/integration/chefignore_spec.rb
|
91
|
+
- spec/integration/delete_spec.rb
|
91
92
|
- spec/integration/deps_spec.rb
|
92
93
|
- spec/integration/diff_spec.rb
|
93
94
|
- spec/integration/download_spec.rb
|
94
95
|
- spec/integration/list_spec.rb
|
96
|
+
- spec/integration/raw_spec.rb
|
97
|
+
- spec/integration/show_spec.rb
|
95
98
|
- spec/integration/upload_spec.rb
|
96
99
|
- spec/support/file_system_support.rb
|
97
100
|
- spec/support/integration_helper.rb
|