chef-dk 3.3.23 → 3.4.38

Sign up to get free protection for your applications and to get access to all the features.
Files changed (100) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +7 -7
  3. data/Gemfile.lock +91 -82
  4. data/lib/chef-dk/cli.rb +13 -13
  5. data/lib/chef-dk/command/base.rb +8 -8
  6. data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
  7. data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
  8. data/lib/chef-dk/command/delete_policy.rb +9 -9
  9. data/lib/chef-dk/command/delete_policy_group.rb +9 -9
  10. data/lib/chef-dk/command/diff.rb +35 -35
  11. data/lib/chef-dk/command/export.rb +11 -11
  12. data/lib/chef-dk/command/generate.rb +3 -3
  13. data/lib/chef-dk/command/generator_commands.rb +24 -24
  14. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
  15. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
  16. data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
  17. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
  18. data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
  19. data/lib/chef-dk/command/generator_commands/template.rb +3 -3
  20. data/lib/chef-dk/command/install.rb +11 -11
  21. data/lib/chef-dk/command/provision.rb +32 -32
  22. data/lib/chef-dk/command/push.rb +9 -9
  23. data/lib/chef-dk/command/push_archive.rb +9 -9
  24. data/lib/chef-dk/command/shell_init.rb +21 -21
  25. data/lib/chef-dk/command/show_policy.rb +11 -11
  26. data/lib/chef-dk/command/undelete.rb +17 -17
  27. data/lib/chef-dk/command/update.rb +12 -12
  28. data/lib/chef-dk/command/verify.rb +63 -63
  29. data/lib/chef-dk/component_test.rb +3 -3
  30. data/lib/chef-dk/exceptions.rb +5 -5
  31. data/lib/chef-dk/generator.rb +61 -61
  32. data/lib/chef-dk/helpers.rb +1 -1
  33. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
  34. data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
  35. data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
  36. data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
  37. data/lib/chef-dk/policyfile/uploader.rb +4 -4
  38. data/lib/chef-dk/policyfile_compiler.rb +1 -1
  39. data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
  40. data/lib/chef-dk/policyfile_services/install.rb +3 -3
  41. data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
  42. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
  43. data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
  44. data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
  45. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
  46. data/lib/chef-dk/version.rb +1 -1
  47. data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
  48. data/omnibus_overrides.rb +1 -1
  49. data/spec/spec_helper.rb +3 -3
  50. data/spec/unit/cli_spec.rb +9 -9
  51. data/spec/unit/command/base_spec.rb +25 -25
  52. data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
  53. data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
  54. data/spec/unit/command/delete_policy_group_spec.rb +6 -6
  55. data/spec/unit/command/delete_policy_spec.rb +6 -6
  56. data/spec/unit/command/export_spec.rb +10 -10
  57. data/spec/unit/command/generate_spec.rb +5 -5
  58. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
  59. data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
  60. data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
  61. data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
  62. data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
  63. data/spec/unit/command/install_spec.rb +15 -15
  64. data/spec/unit/command/provision_spec.rb +25 -25
  65. data/spec/unit/command/push_spec.rb +12 -12
  66. data/spec/unit/command/shell_init_spec.rb +59 -59
  67. data/spec/unit/command/show_policy_spec.rb +6 -6
  68. data/spec/unit/command/undelete_spec.rb +6 -6
  69. data/spec/unit/command/update_spec.rb +30 -30
  70. data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
  71. data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
  72. data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
  73. data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
  74. data/spec/unit/policyfile/differ_spec.rb +361 -361
  75. data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
  76. data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
  77. data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
  78. data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
  79. data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
  80. data/spec/unit/policyfile/uploader_spec.rb +27 -27
  81. data/spec/unit/policyfile_demands_spec.rb +84 -84
  82. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  83. data/spec/unit/policyfile_includes_spec.rb +1 -1
  84. data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
  85. data/spec/unit/policyfile_lock_build_spec.rb +58 -58
  86. data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
  87. data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
  88. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
  89. data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
  90. data/spec/unit/policyfile_services/install_spec.rb +4 -4
  91. data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
  92. data/spec/unit/policyfile_services/push_spec.rb +38 -38
  93. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
  94. data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
  95. data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
  96. data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
  97. data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
  98. data/spec/unit/policyfile_services/update_spec.rb +7 -7
  99. data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
  100. metadata +2 -2
@@ -84,9 +84,9 @@ describe ChefDK::PolicyfileServices::RmPolicy do
84
84
 
85
85
  before do
86
86
  expect(http_client).to receive(:get).with("/policies/appserver").and_return(policy_revisions_data)
87
- expect(http_client).to receive(:get).
88
- with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222").
89
- and_raise(http_exception)
87
+ expect(http_client).to receive(:get)
88
+ .with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
89
+ .and_raise(http_exception)
90
90
  end
91
91
 
92
92
  it "re-raises the error with a standardized exception class" do
@@ -182,9 +182,9 @@ describe ChefDK::PolicyfileServices::RmPolicy do
182
182
  expect(http_client).to receive(:get).with("/policies/appserver").and_return(policy_revisions_data)
183
183
  expect(http_client).to receive(:get).with("/policy_groups").and_return(policy_group_data)
184
184
 
185
- expect(http_client).to receive(:get).
186
- with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222").
187
- and_return(policy_appserver_2)
185
+ expect(http_client).to receive(:get)
186
+ .with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
187
+ .and_return(policy_appserver_2)
188
188
  expect(http_client).to receive(:delete).with("/policies/appserver")
189
189
 
190
190
  expect(undo_stack).to receive(:push).with(undo_record)
@@ -130,21 +130,21 @@ describe ChefDK::PolicyfileServices::ShowPolicy do
130
130
  end
131
131
 
132
132
  it "prints a message to stderr that there are no active policies" do
133
- expected_output = <<-OUTPUT
134
- appserver
135
- =========
133
+ expected_output = <<~OUTPUT
134
+ appserver
135
+ =========
136
136
 
137
- Policy appserver is not assigned to any groups
137
+ Policy appserver is not assigned to any groups
138
138
 
139
- load-balancer
140
- =============
139
+ load-balancer
140
+ =============
141
141
 
142
- Policy load-balancer is not assigned to any groups
142
+ Policy load-balancer is not assigned to any groups
143
143
 
144
- db
145
- ==
144
+ db
145
+ ==
146
146
 
147
- Policy db is not assigned to any groups
147
+ Policy db is not assigned to any groups
148
148
 
149
149
  OUTPUT
150
150
  expect(ui.output).to eq(expected_output)
@@ -155,39 +155,39 @@ OUTPUT
155
155
  let(:show_orphans) { true }
156
156
 
157
157
  it "shows all policies as orphaned" do
158
- expected_output = <<-OUTPUT
159
- appserver
160
- =========
158
+ expected_output = <<~OUTPUT
159
+ appserver
160
+ =========
161
161
 
162
- Policy appserver is not assigned to any groups
162
+ Policy appserver is not assigned to any groups
163
163
 
164
- Orphaned:
165
- ---------
164
+ Orphaned:
165
+ ---------
166
166
 
167
- * 1111111111
168
- * 2222222222
167
+ * 1111111111
168
+ * 2222222222
169
169
 
170
- load-balancer
171
- =============
170
+ load-balancer
171
+ =============
172
172
 
173
- Policy load-balancer is not assigned to any groups
173
+ Policy load-balancer is not assigned to any groups
174
174
 
175
- Orphaned:
176
- ---------
175
+ Orphaned:
176
+ ---------
177
177
 
178
- * 5555555555
179
- * 6666666666
178
+ * 5555555555
179
+ * 6666666666
180
180
 
181
- db
182
- ==
181
+ db
182
+ ==
183
183
 
184
- Policy db is not assigned to any groups
184
+ Policy db is not assigned to any groups
185
185
 
186
- Orphaned:
187
- ---------
186
+ Orphaned:
187
+ ---------
188
188
 
189
- * 9999999999
190
- * aaaaaaaaaa
189
+ * 9999999999
190
+ * aaaaaaaaaa
191
191
 
192
192
  OUTPUT
193
193
  expect(ui.output).to eq(expected_output)
@@ -252,27 +252,27 @@ OUTPUT
252
252
  end
253
253
 
254
254
  it "shows each policy name, followed by a list of group_name -> revision" do
255
- expected_output = <<-OUTPUT
256
- appserver
257
- =========
255
+ expected_output = <<~OUTPUT
256
+ appserver
257
+ =========
258
258
 
259
- * dev: 1111111111
260
- * staging: 2222222222
261
- * prod: 2222222222
259
+ * dev: 1111111111
260
+ * staging: 2222222222
261
+ * prod: 2222222222
262
262
 
263
- load-balancer
264
- =============
263
+ load-balancer
264
+ =============
265
265
 
266
- * dev: 5555555555
267
- * staging: 5555555555
268
- * prod: 6666666666
266
+ * dev: 5555555555
267
+ * staging: 5555555555
268
+ * prod: 6666666666
269
269
 
270
- db
271
- ==
270
+ db
271
+ ==
272
272
 
273
- * dev: 9999999999
274
- * staging: 9999999999
275
- * prod: aaaaaaaaaa
273
+ * dev: 9999999999
274
+ * staging: 9999999999
275
+ * prod: aaaaaaaaaa
276
276
 
277
277
  OUTPUT
278
278
  expect(ui.output).to eq(expected_output)
@@ -322,27 +322,27 @@ OUTPUT
322
322
  end
323
323
 
324
324
  it "shows each policy name, followed by a list of group_name -> revision, followed by a list of orphaned policies" do
325
- expected_output = <<-OUTPUT
326
- appserver
327
- =========
325
+ expected_output = <<~OUTPUT
326
+ appserver
327
+ =========
328
328
 
329
- * dev: 1111111111
330
- * staging: 2222222222
331
- * prod: 2222222222
329
+ * dev: 1111111111
330
+ * staging: 2222222222
331
+ * prod: 2222222222
332
332
 
333
- load-balancer
334
- =============
333
+ load-balancer
334
+ =============
335
335
 
336
- * dev: 5555555555
337
- * staging: 5555555555
338
- * prod: 6666666666
336
+ * dev: 5555555555
337
+ * staging: 5555555555
338
+ * prod: 6666666666
339
339
 
340
- db
341
- ==
340
+ db
341
+ ==
342
342
 
343
- * dev: 9999999999
344
- * staging: 9999999999
345
- * prod: aaaaaaaaaa
343
+ * dev: 9999999999
344
+ * staging: 9999999999
345
+ * prod: aaaaaaaaaa
346
346
 
347
347
  OUTPUT
348
348
  expect(ui.output).to eq(expected_output)
@@ -353,42 +353,42 @@ OUTPUT
353
353
  let(:show_orphans) { true }
354
354
 
355
355
  it "shows each policy name, followed by a list of group_name -> revision, followed by a list of orphaned policies" do
356
- expected_output = <<-OUTPUT
357
- appserver
358
- =========
356
+ expected_output = <<~OUTPUT
357
+ appserver
358
+ =========
359
359
 
360
- * dev: 1111111111
361
- * staging: 2222222222
362
- * prod: 2222222222
360
+ * dev: 1111111111
361
+ * staging: 2222222222
362
+ * prod: 2222222222
363
363
 
364
- Orphaned:
365
- ---------
364
+ Orphaned:
365
+ ---------
366
366
 
367
- * 3333333333
367
+ * 3333333333
368
368
 
369
- load-balancer
370
- =============
369
+ load-balancer
370
+ =============
371
371
 
372
- * dev: 5555555555
373
- * staging: 5555555555
374
- * prod: 6666666666
372
+ * dev: 5555555555
373
+ * staging: 5555555555
374
+ * prod: 6666666666
375
375
 
376
- Orphaned:
377
- ---------
376
+ Orphaned:
377
+ ---------
378
378
 
379
- * 7777777777
379
+ * 7777777777
380
380
 
381
- db
382
- ==
381
+ db
382
+ ==
383
383
 
384
- * dev: 9999999999
385
- * staging: 9999999999
386
- * prod: aaaaaaaaaa
384
+ * dev: 9999999999
385
+ * staging: 9999999999
386
+ * prod: aaaaaaaaaa
387
387
 
388
- Orphaned:
389
- ---------
388
+ Orphaned:
389
+ ---------
390
390
 
391
- * bbbbbbbbbb
391
+ * bbbbbbbbbb
392
392
 
393
393
  OUTPUT
394
394
  expect(ui.output).to eq(expected_output)
@@ -441,34 +441,34 @@ OUTPUT
441
441
  end
442
442
 
443
443
  it "shows each policy name, followed by a list of group_name -> revision, omitting groups that don't have that policy" do
444
- expected_output = <<-OUTPUT
445
- appserver
446
- =========
444
+ expected_output = <<~OUTPUT
445
+ appserver
446
+ =========
447
447
 
448
- * dev: 1111111111
449
- * staging: 2222222222
450
- * prod: 2222222222
448
+ * dev: 1111111111
449
+ * staging: 2222222222
450
+ * prod: 2222222222
451
451
 
452
- load-balancer
453
- =============
452
+ load-balancer
453
+ =============
454
454
 
455
- * dev: 5555555555
456
- * staging: 5555555555
457
- * prod: 6666666666
455
+ * dev: 5555555555
456
+ * staging: 5555555555
457
+ * prod: 6666666666
458
458
 
459
- db
460
- ==
459
+ db
460
+ ==
461
461
 
462
- * dev: 9999999999
463
- * staging: 9999999999
464
- * prod: aaaaaaaaaa
462
+ * dev: 9999999999
463
+ * staging: 9999999999
464
+ * prod: aaaaaaaaaa
465
465
 
466
- memcache
467
- ========
466
+ memcache
467
+ ========
468
468
 
469
- * dev: dddddddddd
470
- * staging: dddddddddd
471
- * prod: *NOT APPLIED*
469
+ * dev: dddddddddd
470
+ * staging: dddddddddd
471
+ * prod: *NOT APPLIED*
472
472
 
473
473
  OUTPUT
474
474
  expect(ui.output).to eq(expected_output)
@@ -509,11 +509,11 @@ OUTPUT
509
509
  end
510
510
 
511
511
  it "prints a message to stderr that there are no copies of the policy on the server" do
512
- expected_output = <<-OUTPUT
513
- appserver
514
- =========
512
+ expected_output = <<~OUTPUT
513
+ appserver
514
+ =========
515
515
 
516
- No policies named 'appserver' are associated with a policy group
516
+ No policies named 'appserver' are associated with a policy group
517
517
 
518
518
  OUTPUT
519
519
 
@@ -559,11 +559,11 @@ OUTPUT
559
559
  end
560
560
 
561
561
  it "prints a message to stderr that there are no copies of the policy on the server" do
562
- expected_output = <<-OUTPUT
563
- appserver
564
- =========
562
+ expected_output = <<~OUTPUT
563
+ appserver
564
+ =========
565
565
 
566
- No policies named 'appserver' are associated with a policy group
566
+ No policies named 'appserver' are associated with a policy group
567
567
 
568
568
  OUTPUT
569
569
 
@@ -589,11 +589,11 @@ OUTPUT
589
589
  end
590
590
 
591
591
  it "explains that no policies are assigned to a group" do
592
- expected_output = <<-OUTPUT
593
- appserver
594
- =========
592
+ expected_output = <<~OUTPUT
593
+ appserver
594
+ =========
595
595
 
596
- No policies named 'appserver' are associated with a policy group
596
+ No policies named 'appserver' are associated with a policy group
597
597
 
598
598
  OUTPUT
599
599
 
@@ -628,13 +628,13 @@ OUTPUT
628
628
  }
629
629
  end
630
630
  it "lists each of the groups with the associated revision" do
631
- expected_output = <<-OUTPUT
632
- appserver
633
- =========
631
+ expected_output = <<~OUTPUT
632
+ appserver
633
+ =========
634
634
 
635
- * dev: 2222222222
636
- * staging: 2222222222
637
- * prod: 2222222222
635
+ * dev: 2222222222
636
+ * staging: 2222222222
637
+ * prod: 2222222222
638
638
 
639
639
  OUTPUT
640
640
  expect(ui.output).to eq(expected_output)
@@ -670,13 +670,13 @@ OUTPUT
670
670
  end
671
671
 
672
672
  it "lists each of the groups with the associated revision" do
673
- expected_output = <<-OUTPUT
674
- appserver
675
- =========
673
+ expected_output = <<~OUTPUT
674
+ appserver
675
+ =========
676
676
 
677
- * dev: 2222222222
678
- * staging: 2222222222
679
- * prod: 1111111111
677
+ * dev: 2222222222
678
+ * staging: 2222222222
679
+ * prod: 1111111111
680
680
 
681
681
  OUTPUT
682
682
  expect(ui.output).to eq(expected_output)
@@ -739,30 +739,30 @@ OUTPUT
739
739
  let(:summary_diff) { true }
740
740
 
741
741
  it "lists each of the groups and displays the version and identifier of the differing cookbooks" do
742
- expected_output = <<-OUTPUT
743
- appserver
744
- =========
742
+ expected_output = <<~OUTPUT
743
+ appserver
744
+ =========
745
745
 
746
- dev: 2222222222
747
- -------------------
746
+ dev: 2222222222
747
+ -------------------
748
748
 
749
- * apache2: 2.0.5 (aaa1230000)
750
- * yum: 4.5.2 (8675309999)
751
- * other_cookbook: 9.8.7 (1131130000)
749
+ * apache2: 2.0.5 (aaa1230000)
750
+ * yum: 4.5.2 (8675309999)
751
+ * other_cookbook: 9.8.7 (1131130000)
752
752
 
753
- staging: 2222222222
754
- -------------------
753
+ staging: 2222222222
754
+ -------------------
755
755
 
756
- * apache2: 2.0.5 (aaa1230000)
757
- * yum: 4.5.2 (8675309999)
758
- * other_cookbook: 9.8.7 (1131130000)
756
+ * apache2: 2.0.5 (aaa1230000)
757
+ * yum: 4.5.2 (8675309999)
758
+ * other_cookbook: 9.8.7 (1131130000)
759
759
 
760
- prod: 1111111111
761
- -------------------
760
+ prod: 1111111111
761
+ -------------------
762
762
 
763
- * apache2: 2.1.3 (abcdef0000)
764
- * yum: 4.5.6 (123abc0000)
765
- * other_cookbook: *NONE*
763
+ * apache2: 2.1.3 (abcdef0000)
764
+ * yum: 4.5.6 (123abc0000)
765
+ * other_cookbook: *NONE*
766
766
 
767
767
  OUTPUT
768
768
  expect(ui.output).to eq(expected_output)
@@ -774,18 +774,18 @@ OUTPUT
774
774
  let(:show_orphans) { true }
775
775
 
776
776
  it "lists each of the groups, then lists the orphaned revisions" do
777
- expected_output = <<-OUTPUT
778
- appserver
779
- =========
777
+ expected_output = <<~OUTPUT
778
+ appserver
779
+ =========
780
780
 
781
- * dev: 2222222222
782
- * staging: 2222222222
783
- * prod: 1111111111
781
+ * dev: 2222222222
782
+ * staging: 2222222222
783
+ * prod: 1111111111
784
784
 
785
- Orphaned:
786
- ---------
785
+ Orphaned:
786
+ ---------
787
787
 
788
- * 3333333333
788
+ * 3333333333
789
789
 
790
790
  OUTPUT
791
791