chef-dk 1.2.22 → 1.3.40

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.
Files changed (232) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +8 -12
  3. data/Gemfile.lock +120 -116
  4. data/README.md +4 -3
  5. data/Rakefile +54 -0
  6. data/acceptance/Gemfile.lock +36 -47
  7. data/bin/chef +1 -1
  8. data/chef-dk.gemspec +9 -9
  9. data/lib/chef-dk/authenticated_http.rb +6 -7
  10. data/lib/chef-dk/builtin_commands.rb +3 -4
  11. data/lib/chef-dk/chef_runner.rb +7 -8
  12. data/lib/chef-dk/cli.rb +11 -11
  13. data/lib/chef-dk/command/base.rb +4 -4
  14. data/lib/chef-dk/command/clean_policy_cookbooks.rb +4 -5
  15. data/lib/chef-dk/command/clean_policy_revisions.rb +4 -6
  16. data/lib/chef-dk/command/delete_policy.rb +4 -6
  17. data/lib/chef-dk/command/delete_policy_group.rb +6 -8
  18. data/lib/chef-dk/command/diff.rb +9 -10
  19. data/lib/chef-dk/command/env.rb +26 -27
  20. data/lib/chef-dk/command/exec.rb +5 -6
  21. data/lib/chef-dk/command/export.rb +8 -10
  22. data/lib/chef-dk/command/gem.rb +5 -5
  23. data/lib/chef-dk/command/generate.rb +19 -19
  24. data/lib/chef-dk/command/generator_commands.rb +8 -8
  25. data/lib/chef-dk/command/generator_commands/app.rb +2 -3
  26. data/lib/chef-dk/command/generator_commands/attribute.rb +2 -3
  27. data/lib/chef-dk/command/generator_commands/base.rb +13 -13
  28. data/lib/chef-dk/command/generator_commands/build_cookbook.rb +2 -2
  29. data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +2 -2
  30. data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +1 -2
  31. data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +1 -2
  32. data/lib/chef-dk/command/generator_commands/cookbook.rb +2 -2
  33. data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +3 -3
  34. data/lib/chef-dk/command/generator_commands/cookbook_file.rb +2 -2
  35. data/lib/chef-dk/command/generator_commands/generator_generator.rb +4 -7
  36. data/lib/chef-dk/command/generator_commands/lwrp.rb +2 -2
  37. data/lib/chef-dk/command/generator_commands/policyfile.rb +2 -3
  38. data/lib/chef-dk/command/generator_commands/recipe.rb +2 -2
  39. data/lib/chef-dk/command/generator_commands/repo.rb +1 -3
  40. data/lib/chef-dk/command/generator_commands/template.rb +2 -2
  41. data/lib/chef-dk/command/install.rb +4 -5
  42. data/lib/chef-dk/command/provision.rb +12 -14
  43. data/lib/chef-dk/command/push.rb +5 -6
  44. data/lib/chef-dk/command/push_archive.rb +4 -5
  45. data/lib/chef-dk/command/shell_init.rb +15 -16
  46. data/lib/chef-dk/command/show_policy.rb +5 -7
  47. data/lib/chef-dk/command/undelete.rb +6 -7
  48. data/lib/chef-dk/command/update.rb +5 -6
  49. data/lib/chef-dk/command/verify.rb +30 -31
  50. data/lib/chef-dk/commands_map.rb +1 -3
  51. data/lib/chef-dk/component_test.rb +13 -13
  52. data/lib/chef-dk/configurable.rb +2 -2
  53. data/lib/chef-dk/cookbook_metadata.rb +2 -2
  54. data/lib/chef-dk/cookbook_omnifetch.rb +7 -8
  55. data/lib/chef-dk/cookbook_profiler/git.rb +8 -8
  56. data/lib/chef-dk/cookbook_profiler/identifiers.rb +7 -7
  57. data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -1
  58. data/lib/chef-dk/exceptions.rb +1 -1
  59. data/lib/chef-dk/generator.rb +9 -7
  60. data/lib/chef-dk/helpers.rb +15 -15
  61. data/lib/chef-dk/pager.rb +2 -3
  62. data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +4 -4
  63. data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +6 -6
  64. data/lib/chef-dk/policyfile/community_cookbook_source.rb +4 -5
  65. data/lib/chef-dk/policyfile/comparison_base.rb +3 -4
  66. data/lib/chef-dk/policyfile/cookbook_location_specification.rb +6 -6
  67. data/lib/chef-dk/policyfile/cookbook_locks.rb +11 -11
  68. data/lib/chef-dk/policyfile/cookbook_sources.rb +5 -5
  69. data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +8 -9
  70. data/lib/chef-dk/policyfile/differ.rb +7 -10
  71. data/lib/chef-dk/policyfile/dsl.rb +10 -11
  72. data/lib/chef-dk/policyfile/lister.rb +3 -6
  73. data/lib/chef-dk/policyfile/null_cookbook_source.rb +3 -3
  74. data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +3 -3
  75. data/lib/chef-dk/policyfile/reports/install.rb +3 -4
  76. data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -1
  77. data/lib/chef-dk/policyfile/reports/upload.rb +4 -4
  78. data/lib/chef-dk/policyfile/solution_dependencies.rb +22 -22
  79. data/lib/chef-dk/policyfile/source_uri.rb +2 -2
  80. data/lib/chef-dk/policyfile/storage_config.rb +4 -5
  81. data/lib/chef-dk/policyfile/undo_record.rb +6 -9
  82. data/lib/chef-dk/policyfile/undo_stack.rb +5 -7
  83. data/lib/chef-dk/policyfile/uploader.rb +8 -8
  84. data/lib/chef-dk/policyfile_compiler.rb +16 -20
  85. data/lib/chef-dk/policyfile_lock.rb +10 -11
  86. data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
  87. data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +3 -5
  88. data/lib/chef-dk/policyfile_services/export_repo.rb +13 -14
  89. data/lib/chef-dk/policyfile_services/install.rb +6 -6
  90. data/lib/chef-dk/policyfile_services/push.rb +6 -8
  91. data/lib/chef-dk/policyfile_services/push_archive.rb +6 -10
  92. data/lib/chef-dk/policyfile_services/rm_policy.rb +4 -5
  93. data/lib/chef-dk/policyfile_services/rm_policy_group.rb +4 -5
  94. data/lib/chef-dk/policyfile_services/show_policy.rb +5 -6
  95. data/lib/chef-dk/policyfile_services/undelete.rb +3 -3
  96. data/lib/chef-dk/policyfile_services/update_attributes.rb +4 -6
  97. data/lib/chef-dk/service_exception_inspectors.rb +2 -3
  98. data/lib/chef-dk/service_exception_inspectors/base.rb +0 -1
  99. data/lib/chef-dk/service_exception_inspectors/http.rb +1 -3
  100. data/lib/chef-dk/service_exceptions.rb +1 -2
  101. data/lib/chef-dk/shell_out.rb +1 -1
  102. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/.kitchen.yml +2 -2
  103. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +2 -2
  104. data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
  105. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -1
  106. data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -1
  107. data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -1
  108. data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +6 -6
  109. data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +3 -3
  110. data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +43 -39
  111. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +31 -22
  112. data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +5 -5
  113. data/lib/chef-dk/skeletons/code_generator/recipes/lwrp.rb +4 -4
  114. data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -1
  115. data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +8 -8
  116. data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +15 -15
  117. data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +6 -6
  118. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -2
  119. data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -0
  120. data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +4 -4
  121. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
  122. data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
  123. data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +4 -3
  124. data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +4 -2
  125. data/lib/chef-dk/ui.rb +0 -1
  126. data/lib/chef-dk/version.rb +1 -1
  127. data/lib/kitchen/provisioner/policyfile_zero.rb +7 -7
  128. data/omnibus_overrides.rb +3 -3
  129. data/spec/shared/a_file_generator.rb +3 -3
  130. data/spec/shared/custom_generator_cookbook.rb +6 -6
  131. data/spec/shared/fixture_cookbook_checksums.rb +2 -3
  132. data/spec/shared/setup_git_committer_config.rb +1 -1
  133. data/spec/shared/setup_git_cookbooks.rb +2 -2
  134. data/spec/spec_helper.rb +5 -5
  135. data/spec/test_helpers.rb +2 -2
  136. data/spec/unit/chef_runner_spec.rb +5 -7
  137. data/spec/unit/cli_spec.rb +36 -37
  138. data/spec/unit/command/base_spec.rb +4 -5
  139. data/spec/unit/command/clean_policy_cookbooks_spec.rb +8 -9
  140. data/spec/unit/command/clean_policy_revisions_spec.rb +8 -9
  141. data/spec/unit/command/delete_policy_group_spec.rb +11 -12
  142. data/spec/unit/command/delete_policy_spec.rb +11 -12
  143. data/spec/unit/command/diff_spec.rb +5 -6
  144. data/spec/unit/command/env_spec.rb +5 -5
  145. data/spec/unit/command/exec_spec.rb +18 -19
  146. data/spec/unit/command/export_spec.rb +5 -6
  147. data/spec/unit/command/generate_spec.rb +10 -10
  148. data/spec/unit/command/generator_commands/app_spec.rb +6 -6
  149. data/spec/unit/command/generator_commands/attribute_spec.rb +3 -4
  150. data/spec/unit/command/generator_commands/base_spec.rb +46 -46
  151. data/spec/unit/command/generator_commands/build_cookbook_spec.rb +50 -16
  152. data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +9 -9
  153. data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +16 -16
  154. data/spec/unit/command/generator_commands/cookbook_file_spec.rb +3 -4
  155. data/spec/unit/command/generator_commands/cookbook_spec.rb +23 -26
  156. data/spec/unit/command/generator_commands/generator_generator_spec.rb +4 -6
  157. data/spec/unit/command/generator_commands/lwrp_spec.rb +3 -4
  158. data/spec/unit/command/generator_commands/policyfile_spec.rb +3 -5
  159. data/spec/unit/command/generator_commands/recipe_spec.rb +4 -4
  160. data/spec/unit/command/generator_commands/repo_spec.rb +11 -11
  161. data/spec/unit/command/generator_commands/template_spec.rb +3 -4
  162. data/spec/unit/command/install_spec.rb +6 -6
  163. data/spec/unit/command/provision_spec.rb +27 -30
  164. data/spec/unit/command/push_archive_spec.rb +3 -3
  165. data/spec/unit/command/push_spec.rb +5 -6
  166. data/spec/unit/command/shell_init_spec.rb +17 -19
  167. data/spec/unit/command/show_policy_spec.rb +11 -12
  168. data/spec/unit/command/undelete_spec.rb +12 -14
  169. data/spec/unit/command/update_spec.rb +8 -8
  170. data/spec/unit/command/verify_spec.rb +10 -10
  171. data/spec/unit/commands_map_spec.rb +4 -4
  172. data/spec/unit/component_test_spec.rb +3 -3
  173. data/spec/unit/configurable_spec.rb +7 -7
  174. data/spec/unit/cookbook_metadata_spec.rb +5 -7
  175. data/spec/unit/cookbook_profiler/git_spec.rb +6 -7
  176. data/spec/unit/cookbook_profiler/identifiers_spec.rb +5 -7
  177. data/spec/unit/fixtures/command/cli_test_command.rb +2 -2
  178. data/spec/unit/fixtures/configurable/test_configurable.rb +1 -1
  179. data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +13 -16
  180. data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/berkshelf/verify_me +1 -1
  181. data/spec/unit/gemfile_util_spec.rb +4 -4
  182. data/spec/unit/generator_spec.rb +10 -10
  183. data/spec/unit/helpers_spec.rb +31 -31
  184. data/spec/unit/pager_spec.rb +5 -7
  185. data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +11 -11
  186. data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +13 -13
  187. data/spec/unit/policyfile/community_cookbook_source_spec.rb +3 -4
  188. data/spec/unit/policyfile/comparison_base_spec.rb +3 -6
  189. data/spec/unit/policyfile/cookbook_location_specification_spec.rb +3 -3
  190. data/spec/unit/policyfile/cookbook_locks_spec.rb +7 -9
  191. data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +16 -17
  192. data/spec/unit/policyfile/differ_spec.rb +4 -5
  193. data/spec/unit/policyfile/lister_spec.rb +31 -35
  194. data/spec/unit/policyfile/null_cookbook_source_spec.rb +2 -3
  195. data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +3 -3
  196. data/spec/unit/policyfile/reports/install_spec.rb +4 -5
  197. data/spec/unit/policyfile/reports/upload_spec.rb +4 -6
  198. data/spec/unit/policyfile/solution_dependencies_spec.rb +13 -13
  199. data/spec/unit/policyfile/source_uri_spec.rb +5 -5
  200. data/spec/unit/policyfile/storage_config_spec.rb +3 -7
  201. data/spec/unit/policyfile/undo_record_spec.rb +21 -23
  202. data/spec/unit/policyfile/undo_stack_spec.rb +5 -6
  203. data/spec/unit/policyfile/uploader_spec.rb +73 -75
  204. data/spec/unit/policyfile_demands_spec.rb +93 -99
  205. data/spec/unit/policyfile_evaluation_spec.rb +14 -14
  206. data/spec/unit/policyfile_lock_build_spec.rb +64 -65
  207. data/spec/unit/policyfile_lock_install_spec.rb +5 -6
  208. data/spec/unit/policyfile_lock_serialization_spec.rb +14 -15
  209. data/spec/unit/policyfile_lock_validation_spec.rb +17 -20
  210. data/spec/unit/policyfile_services/clean_policies_spec.rb +16 -16
  211. data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +26 -29
  212. data/spec/unit/policyfile_services/export_repo_spec.rb +3 -6
  213. data/spec/unit/policyfile_services/install_spec.rb +5 -7
  214. data/spec/unit/policyfile_services/push_archive_spec.rb +4 -8
  215. data/spec/unit/policyfile_services/push_spec.rb +3 -3
  216. data/spec/unit/policyfile_services/rm_policy_group_spec.rb +16 -20
  217. data/spec/unit/policyfile_services/rm_policy_spec.rb +14 -17
  218. data/spec/unit/policyfile_services/show_policy_spec.rb +78 -80
  219. data/spec/unit/policyfile_services/undelete_spec.rb +5 -7
  220. data/spec/unit/policyfile_services/update_attributes_spec.rb +34 -35
  221. data/spec/unit/service_exception_inspectors/base_spec.rb +2 -4
  222. data/spec/unit/service_exception_inspectors/http_spec.rb +9 -11
  223. data/spec/unit/shell_out_spec.rb +2 -2
  224. data/spec/unit/tasks/helpers_spec.rb +2 -2
  225. data/tasks/bin/bundle-platform +1 -1
  226. data/tasks/bundle_util.rb +1 -1
  227. data/tasks/dependencies.rb +21 -7
  228. data/tasks/gemfile_util.rb +1 -1
  229. data/tasks/helpers.rb +2 -2
  230. data/tasks/version.rb +26 -1
  231. data/version_policy.rb +6 -6
  232. metadata +3 -3
@@ -15,9 +15,9 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
18
+ require "spec_helper"
19
19
 
20
- require 'chef-dk/policyfile/null_cookbook_source'
20
+ require "chef-dk/policyfile/null_cookbook_source"
21
21
 
22
22
  describe ChefDK::Policyfile::NullCookbookSource do
23
23
 
@@ -32,4 +32,3 @@ describe ChefDK::Policyfile::NullCookbookSource do
32
32
  end
33
33
 
34
34
  end
35
-
@@ -15,9 +15,9 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/read_cookbook_for_compat_mode_upload'
20
- require 'chef-dk/helpers'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/read_cookbook_for_compat_mode_upload"
20
+ require "chef-dk/helpers"
21
21
 
22
22
  describe ChefDK::Policyfile::ReadCookbookForCompatModeUpload do
23
23
 
@@ -15,12 +15,12 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/reports/install'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/reports/install"
20
20
 
21
21
  # Used for verifying doubles
22
- require 'chef-dk/policyfile_compiler'
23
- require 'chef-dk/policyfile/cookbook_location_specification'
22
+ require "chef-dk/policyfile_compiler"
23
+ require "chef-dk/policyfile/cookbook_location_specification"
24
24
 
25
25
  describe ChefDK::Policyfile::Reports::Install do
26
26
 
@@ -112,4 +112,3 @@ describe ChefDK::Policyfile::Reports::Install do
112
112
 
113
113
  end
114
114
  end
115
-
@@ -15,14 +15,14 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/reports/upload'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/reports/upload"
20
20
 
21
21
  # For the LockedCookbookForUpload class:
22
- require 'chef-dk/policyfile/uploader'
22
+ require "chef-dk/policyfile/uploader"
23
23
 
24
24
  # Used for verifying doubles
25
- require 'chef-dk/policyfile/cookbook_locks'
25
+ require "chef-dk/policyfile/cookbook_locks"
26
26
 
27
27
  describe ChefDK::Policyfile::Reports::Upload do
28
28
 
@@ -92,5 +92,3 @@ E
92
92
  end
93
93
 
94
94
  end
95
-
96
-
@@ -15,12 +15,12 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/solution_dependencies'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/solution_dependencies"
20
20
 
21
21
  describe ChefDK::Policyfile::SolutionDependencies do
22
22
 
23
- let(:dependency_data) { {"Policyfile" => [], "dependencies" => {}} }
23
+ let(:dependency_data) { { "Policyfile" => [], "dependencies" => {} } }
24
24
 
25
25
  let(:solution_dependencies) do
26
26
  s = described_class.new
@@ -47,8 +47,8 @@ describe ChefDK::Policyfile::SolutionDependencies do
47
47
  "nginx (1.2.3)" => [ ["apt", "~> 2.3"], ["yum", "~>3.4"] ],
48
48
  "apt (2.5.6)" => [],
49
49
  "yum (3.4.1)" => [],
50
- "postgresql (5.0.0)" => []
51
- }
50
+ "postgresql (5.0.0)" => [],
51
+ },
52
52
  }
53
53
  end
54
54
 
@@ -62,7 +62,7 @@ describe ChefDK::Policyfile::SolutionDependencies do
62
62
  "nginx (1.2.3)" => [ ["apt", "~> 2.3"], ["yum", "~> 3.4"] ],
63
63
  "apt (2.5.6)" => [],
64
64
  "yum (3.4.1)" => [],
65
- "postgresql (5.0.0)" => []
65
+ "postgresql (5.0.0)" => [],
66
66
  }
67
67
  expect(solution_dependencies.cookbook_deps_for_lock).to eq(expected)
68
68
  end
@@ -76,7 +76,7 @@ describe ChefDK::Policyfile::SolutionDependencies do
76
76
  "nginx (1.2.3)" => [ ["apt", "~> 2.3"], ["yum", "~> 3.4"] ],
77
77
  "apt (2.5.6)" => [],
78
78
  "yum (3.4.1)" => [],
79
- "postgresql (5.0.0)" => []
79
+ "postgresql (5.0.0)" => [],
80
80
  }
81
81
  end
82
82
 
@@ -102,7 +102,7 @@ describe ChefDK::Policyfile::SolutionDependencies do
102
102
  end
103
103
 
104
104
  it "generates lock info containing both policyfile and cookbook dependencies" do
105
- expected = {"Policyfile" => expected_policyfile_deps_for_lock, "dependencies" => expected_deps_for_lock}
105
+ expected = { "Policyfile" => expected_policyfile_deps_for_lock, "dependencies" => expected_deps_for_lock }
106
106
  expect(solution_dependencies.to_lock).to eq(expected)
107
107
  end
108
108
 
@@ -110,33 +110,33 @@ describe ChefDK::Policyfile::SolutionDependencies do
110
110
 
111
111
  it "does not raise if a cookbook that's in the dependency set with a different version doesn't conflict" do
112
112
  solution_dependencies.update_cookbook_dep("yum", "3.5.0", [ ])
113
- expect(solution_dependencies.test_conflict!('yum', '3.5.0')).to be(false)
113
+ expect(solution_dependencies.test_conflict!("yum", "3.5.0")).to be(false)
114
114
  end
115
115
 
116
116
  it "raises if a cookbook is not in the current solution set" do
117
117
  expected_message = "Cookbook foo (1.0.0) not in the working set, cannot test for conflicts"
118
- expect { solution_dependencies.test_conflict!('foo', '1.0.0') }.to raise_error(ChefDK::CookbookNotInWorkingSet, expected_message)
118
+ expect { solution_dependencies.test_conflict!("foo", "1.0.0") }.to raise_error(ChefDK::CookbookNotInWorkingSet, expected_message)
119
119
  end
120
120
 
121
121
  it "raises when a cookbook conflicts with a Policyfile constraint" do
122
122
  solution_dependencies.update_cookbook_dep("nginx", "2.0.0", [])
123
123
 
124
124
  expected_message = "Cookbook nginx (2.0.0) conflicts with other dependencies:\nPolicyfile depends on nginx ~> 1.0"
125
- expect { solution_dependencies.test_conflict!('nginx', '2.0.0') }.to raise_error(ChefDK::DependencyConflict, expected_message)
125
+ expect { solution_dependencies.test_conflict!("nginx", "2.0.0") }.to raise_error(ChefDK::DependencyConflict, expected_message)
126
126
  end
127
127
 
128
128
  it "raises when a cookbook conflicts with another cookbook's dependency constraint" do
129
129
  solution_dependencies.update_cookbook_dep("apt", "3.0.0", [])
130
130
 
131
131
  expected_message = "Cookbook apt (3.0.0) conflicts with other dependencies:\nnginx (1.2.3) depends on apt ~> 2.3"
132
- expect { solution_dependencies.test_conflict!('apt', '3.0.0') }.to raise_error(ChefDK::DependencyConflict, expected_message)
132
+ expect { solution_dependencies.test_conflict!("apt", "3.0.0") }.to raise_error(ChefDK::DependencyConflict, expected_message)
133
133
  end
134
134
 
135
135
  it "raises when a cookbook's dependencies are no longer satisfiable" do
136
136
  solution_dependencies.update_cookbook_dep("nginx", "1.2.3", [ [ "apt", "~> 3.0" ] ])
137
137
  expected_message = "Cookbook nginx (1.2.3) has dependency constraints that cannot be met by the existing cookbook set:\n" +
138
138
  "Dependency on apt ~> 3.0 conflicts with existing version apt (2.5.6)"
139
- expect { solution_dependencies.test_conflict!('nginx', '1.2.3') }.to raise_error(ChefDK::DependencyConflict, expected_message)
139
+ expect { solution_dependencies.test_conflict!("nginx", "1.2.3") }.to raise_error(ChefDK::DependencyConflict, expected_message)
140
140
  end
141
141
 
142
142
  end
@@ -15,18 +15,18 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
18
+ require "spec_helper"
19
19
 
20
- require 'chef-dk/policyfile/source_uri'
20
+ require "chef-dk/policyfile/source_uri"
21
21
 
22
22
  describe ChefDK::Policyfile::SourceURI do
23
23
  subject { described_class.parse(source_uri) }
24
24
 
25
25
  describe '#validate' do
26
- context 'when the scheme is not https' do
27
- let(:source_uri) { 'ftp://chef.example.com' }
26
+ context "when the scheme is not https" do
27
+ let(:source_uri) { "ftp://chef.example.com" }
28
28
 
29
- it 'raises ChefDK::InvalidPolicyfileSourceURI' do
29
+ it "raises ChefDK::InvalidPolicyfileSourceURI" do
30
30
  expect do
31
31
  subject.validate
32
32
  end.to raise_error(ChefDK::InvalidPolicyfileSourceURI)
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/storage_config'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/storage_config"
20
20
 
21
21
  describe ChefDK::Policyfile::StorageConfig do
22
22
 
@@ -79,7 +79,7 @@ describe ChefDK::Policyfile::StorageConfig do
79
79
  end
80
80
 
81
81
  it "gives the expanded path to the policyfile" do
82
- expect(storage_config.policyfile_expanded_path).to eq(File.expand_path('/path/to/Policyfile.rb'))
82
+ expect(storage_config.policyfile_expanded_path).to eq(File.expand_path("/path/to/Policyfile.rb"))
83
83
  end
84
84
 
85
85
  context "when the policyfile is given as a relative path" do
@@ -129,7 +129,6 @@ describe ChefDK::Policyfile::StorageConfig do
129
129
 
130
130
  end
131
131
 
132
-
133
132
  describe "updating storage config for policyfile lock location" do
134
133
 
135
134
  before do
@@ -174,11 +173,8 @@ describe ChefDK::Policyfile::StorageConfig do
174
173
  expect(storage_config.policyfile_lock_expanded_path).to eq(File.expand_path("Policyfile.lock.json", "."))
175
174
  end
176
175
 
177
-
178
176
  end
179
177
 
180
178
  end
181
179
 
182
-
183
180
  end
184
-
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/undo_record'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/undo_record"
20
20
 
21
21
  describe ChefDK::Policyfile::UndoRecord do
22
22
 
@@ -25,7 +25,7 @@ describe ChefDK::Policyfile::UndoRecord do
25
25
  let(:policy_revision) do
26
26
  {
27
27
  "name" => "appserver",
28
- "revision_id" => "1111111111111111111111111111111111111111111111111111111111111111"
28
+ "revision_id" => "1111111111111111111111111111111111111111111111111111111111111111",
29
29
  }
30
30
  end
31
31
 
@@ -49,8 +49,8 @@ describe ChefDK::Policyfile::UndoRecord do
49
49
  "description" => "",
50
50
  "backup_data" => {
51
51
  "policy_groups" => [],
52
- "policy_revisions" => []
53
- }
52
+ "policy_revisions" => [],
53
+ },
54
54
  }
55
55
  expect(undo_record.for_serialization).to eq(expected)
56
56
  end
@@ -90,10 +90,10 @@ describe ChefDK::Policyfile::UndoRecord do
90
90
  {
91
91
  "policy_name" => "appserver",
92
92
  "policy_group" => "preprod",
93
- "data" => policy_revision
94
- }
95
- ]
96
- }
93
+ "data" => policy_revision,
94
+ },
95
+ ],
96
+ },
97
97
  }
98
98
  expect(undo_record.for_serialization).to eq(expected)
99
99
  end
@@ -130,7 +130,7 @@ describe ChefDK::Policyfile::UndoRecord do
130
130
  {
131
131
  "format_version" => 1,
132
132
  "description" => "delete-policy-group preprod",
133
- "backup_data" => []
133
+ "backup_data" => [],
134
134
  }
135
135
  end
136
136
 
@@ -146,7 +146,7 @@ describe ChefDK::Policyfile::UndoRecord do
146
146
  {
147
147
  "format_version" => 1,
148
148
  "description" => "delete-policy-group preprod",
149
- "backup_data" => {}
149
+ "backup_data" => {},
150
150
  }
151
151
  end
152
152
 
@@ -164,8 +164,8 @@ describe ChefDK::Policyfile::UndoRecord do
164
164
  "description" => "delete-policy-group preprod",
165
165
  "backup_data" => {
166
166
  "policy_groups" => nil,
167
- "policy_revisions" => []
168
- }
167
+ "policy_revisions" => [],
168
+ },
169
169
  }
170
170
  end
171
171
 
@@ -183,8 +183,8 @@ describe ChefDK::Policyfile::UndoRecord do
183
183
  "description" => "delete-policy-group preprod",
184
184
  "backup_data" => {
185
185
  "policy_groups" => [],
186
- "policy_revisions" => nil
187
- }
186
+ "policy_revisions" => nil,
187
+ },
188
188
  }
189
189
  end
190
190
 
@@ -202,8 +202,8 @@ describe ChefDK::Policyfile::UndoRecord do
202
202
  "description" => "delete-policy-group preprod",
203
203
  "backup_data" => {
204
204
  "policy_groups" => [],
205
- "policy_revisions" => [ nil ]
206
- }
205
+ "policy_revisions" => [ nil ],
206
+ },
207
207
  }
208
208
  end
209
209
 
@@ -225,10 +225,10 @@ describe ChefDK::Policyfile::UndoRecord do
225
225
  {
226
226
  "policy_name" => "appserver",
227
227
  "policy_group" => "preprod",
228
- "data" => policy_revision
229
- }
230
- ]
231
- }
228
+ "data" => policy_revision,
229
+ },
230
+ ],
231
+ },
232
232
  }
233
233
  end
234
234
 
@@ -252,9 +252,7 @@ describe ChefDK::Policyfile::UndoRecord do
252
252
  expect(undo_record.for_serialization).to eq(serialized_data)
253
253
  end
254
254
 
255
-
256
255
  end
257
256
  end
258
257
 
259
258
  end
260
-
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/undo_stack'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/undo_stack"
20
20
 
21
21
  describe ChefDK::Policyfile::UndoStack do
22
22
 
@@ -25,7 +25,7 @@ describe ChefDK::Policyfile::UndoStack do
25
25
  let(:policy_revision) do
26
26
  {
27
27
  "name" => "appserver",
28
- "revision_id" => "1111111111111111111111111111111111111111111111111111111111111111"
28
+ "revision_id" => "1111111111111111111111111111111111111111111111111111111111111111",
29
29
  }
30
30
  end
31
31
 
@@ -180,7 +180,6 @@ describe ChefDK::Policyfile::UndoStack do
180
180
 
181
181
  end
182
182
 
183
-
184
183
  context "when the stack is at the maximum configured size" do
185
184
  # `Time.new` is stubbed later on, need to force it to be evaluated before
186
185
  # then.
@@ -196,7 +195,7 @@ describe ChefDK::Policyfile::UndoStack do
196
195
  def incremented_undo_record(i)
197
196
  record = {
198
197
  "name" => "appserver",
199
- "revision_id" => i.to_s * 64
198
+ "revision_id" => i.to_s * 64,
200
199
  }
201
200
 
202
201
  ChefDK::Policyfile::UndoRecord.new.tap do |undo_record|
@@ -241,7 +240,7 @@ describe ChefDK::Policyfile::UndoStack do
241
240
 
242
241
  before do
243
242
  FileUtils.touch(older_record_path)
244
- expect(undo_stack_files.size).to eq(11)
243
+ expect(undo_stack_files.size).to eq(11)
245
244
  end
246
245
 
247
246
  describe "pushing a new undo record" do
@@ -15,33 +15,33 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile/uploader'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile/uploader"
20
20
 
21
21
  # We load this here to ensure we get the "verifying doubles" behavior from
22
22
  # RSpec. It's not used by Policyfile::Uploader, but it's a collaborator.
23
- require 'chef-dk/authenticated_http'
23
+ require "chef-dk/authenticated_http"
24
24
 
25
25
  describe ChefDK::Policyfile::Uploader do
26
26
 
27
27
  let(:policyfile_lock_data) do
28
28
  {
29
- "name"=> "example",
30
- "run_list"=> [ "recipe[omnibus::default]" ],
31
- "cookbook_locks"=> {
32
- "omnibus"=> {
33
- "version"=> "2.2.0",
34
- "identifier"=> "64b3e64306cff223206348e46af545b19032b170",
35
- "dotted_decimal_identifier"=> "28345299219435506.9887234981653237.76628930769264",
36
- "cache_key"=> "omnibus-2cf98f9797cacce9c8688fc4e74858b858e2bc14",
37
- "origin"=> "git@github.com:opscode-cookbooks/omnibus.git",
38
- "source_options"=> {
39
- "git"=> "git@github.com:opscode-cookbooks/omnibus.git",
40
- "revision"=> "2cf98f9797cacce9c8688fc4e74858b858e2bc14",
41
- "branch"=> "master"
42
- }
43
- }
44
- }
29
+ "name" => "example",
30
+ "run_list" => [ "recipe[omnibus::default]" ],
31
+ "cookbook_locks" => {
32
+ "omnibus" => {
33
+ "version" => "2.2.0",
34
+ "identifier" => "64b3e64306cff223206348e46af545b19032b170",
35
+ "dotted_decimal_identifier" => "28345299219435506.9887234981653237.76628930769264",
36
+ "cache_key" => "omnibus-2cf98f9797cacce9c8688fc4e74858b858e2bc14",
37
+ "origin" => "git@github.com:opscode-cookbooks/omnibus.git",
38
+ "source_options" => {
39
+ "git" => "git@github.com:opscode-cookbooks/omnibus.git",
40
+ "revision" => "2cf98f9797cacce9c8688fc4e74858b858e2bc14",
41
+ "branch" => "master",
42
+ },
43
+ },
44
+ },
45
45
  }
46
46
  end
47
47
 
@@ -66,7 +66,7 @@ describe ChefDK::Policyfile::Uploader do
66
66
  policyfile_as_data_bag_item = {
67
67
  "id" => "example-unit-test",
68
68
  "name" => "data_bag_item_policyfiles_example-unit-test",
69
- "data_bag" => "policyfiles"
69
+ "data_bag" => "policyfiles",
70
70
  }
71
71
  policyfile_as_data_bag_item["raw_data"] = policyfile_lock_data.dup
72
72
  policyfile_as_data_bag_item["raw_data"]["id"] = "example-unit-test"
@@ -210,7 +210,7 @@ describe ChefDK::Policyfile::Uploader do
210
210
  let(:expected_cookbooks_for_upload) do
211
211
  [
212
212
  cookbook_versions["my_apache2"],
213
- cookbook_versions["my_jenkins"]
213
+ cookbook_versions["my_jenkins"],
214
214
  ]
215
215
  end
216
216
 
@@ -218,7 +218,6 @@ describe ChefDK::Policyfile::Uploader do
218
218
  expect(policyfile_lock).to receive(:validate_cookbooks!)
219
219
  expect(http_client).to receive(:get).with(list_cookbooks_url).and_return(existing_cookbook_on_remote)
220
220
 
221
-
222
221
  expect(uploader.cookbook_versions_to_upload).to eq(expected_cookbooks_for_upload)
223
222
  end
224
223
 
@@ -273,35 +272,35 @@ describe ChefDK::Policyfile::Uploader do
273
272
 
274
273
  context "when configured for policy document compat mode" do
275
274
 
276
- let(:policyfiles_data_bag) { {"name" => "policyfiles" } }
275
+ let(:policyfiles_data_bag) { { "name" => "policyfiles" } }
277
276
 
278
- let(:list_cookbooks_url) { 'cookbooks?num_versions=all' }
277
+ let(:list_cookbooks_url) { "cookbooks?num_versions=all" }
279
278
 
280
279
  let(:existing_cookbook_on_remote) do
281
- {"apt"=>
282
- {"url"=>"http://localhost:8889/cookbooks/apt",
283
- "versions"=>
284
- [{"url"=>
280
+ { "apt" =>
281
+ { "url" => "http://localhost:8889/cookbooks/apt",
282
+ "versions" =>
283
+ [{ "url" =>
285
284
  "http://localhost:8889/cookbooks/apt/46097674477573307.43471642740453733.243606720748315",
286
- "version"=>"46097674477573307.43471642740453733.243606720748315"}]},
287
- "build-essential"=>
288
- {"url"=>"http://localhost:8889/cookbooks/build-essential",
289
- "versions"=>
290
- [{"url"=>
285
+ "version" => "46097674477573307.43471642740453733.243606720748315" }] },
286
+ "build-essential" =>
287
+ { "url" => "http://localhost:8889/cookbooks/build-essential",
288
+ "versions" =>
289
+ [{ "url" =>
291
290
  "http://localhost:8889/cookbooks/build-essential/67369247788170534.26353953100055918.55660493423796",
292
- "version"=>"67369247788170534.26353953100055918.55660493423796"}]},
293
- "java"=>
294
- {"url"=>"http://localhost:8889/cookbooks/java",
295
- "versions"=>
296
- [{"url"=>
291
+ "version" => "67369247788170534.26353953100055918.55660493423796" }] },
292
+ "java" =>
293
+ { "url" => "http://localhost:8889/cookbooks/java",
294
+ "versions" =>
295
+ [{ "url" =>
297
296
  "http://localhost:8889/cookbooks/java/5664982062912610.52588194571203830.6215746262253",
298
- "version"=>"5664982062912610.52588194571203830.6215746262253"}]},
299
- "jenkins"=>
300
- {"url"=>"http://localhost:8889/cookbooks/jenkins",
301
- "versions"=>
302
- [{"url"=>
297
+ "version" => "5664982062912610.52588194571203830.6215746262253" }] },
298
+ "jenkins" =>
299
+ { "url" => "http://localhost:8889/cookbooks/jenkins",
300
+ "versions" =>
301
+ [{ "url" =>
303
302
  "http://localhost:8889/cookbooks/jenkins/69194928762630300.30177357398946006.269829039948647",
304
- "version"=>"69194928762630300.30177357398946006.269829039948647"}]}
303
+ "version" => "69194928762630300.30177357398946006.269829039948647" }] },
305
304
  }
306
305
  end
307
306
 
@@ -311,14 +310,14 @@ describe ChefDK::Policyfile::Uploader do
311
310
  end
312
311
 
313
312
  it "ensures a data bag named 'policyfiles' exists" do
314
- expect(http_client).to receive(:post).with('data', policyfiles_data_bag)
313
+ expect(http_client).to receive(:post).with("data", policyfiles_data_bag)
315
314
  uploader.data_bag_create
316
315
  end
317
316
 
318
317
  it "does not error when the 'policyfiles' data bag exists" do
319
318
  response = double("Net::HTTP response", code: "409")
320
319
  error = Net::HTTPServerException.new("conflict", response)
321
- expect(http_client).to receive(:post).with('data', {"name" => "policyfiles"}).and_raise(error)
320
+ expect(http_client).to receive(:post).with("data", { "name" => "policyfiles" }).and_raise(error)
322
321
  expect { uploader.data_bag_create }.to_not raise_error
323
322
  end
324
323
 
@@ -326,24 +325,24 @@ describe ChefDK::Policyfile::Uploader do
326
325
  response = double("Net::HTTP response", code: "404")
327
326
  error = Net::HTTPServerException.new("Not Found", response)
328
327
  expect(http_client).to receive(:put).
329
- with('data/policyfiles/example-unit-test', policyfile_as_data_bag_item).
328
+ with("data/policyfiles/example-unit-test", policyfile_as_data_bag_item).
330
329
  and_raise(error)
331
330
  expect(http_client).to receive(:post).
332
- with('data/policyfiles', policyfile_as_data_bag_item)
331
+ with("data/policyfiles", policyfile_as_data_bag_item)
333
332
 
334
333
  uploader.data_bag_item_create
335
334
  end
336
335
 
337
336
  it "replaces an existing policyfile on the server if it exists" do
338
337
  expect(http_client).to receive(:put).
339
- with('data/policyfiles/example-unit-test', policyfile_as_data_bag_item)
338
+ with("data/policyfiles/example-unit-test", policyfile_as_data_bag_item)
340
339
  uploader.data_bag_item_create
341
340
  end
342
341
 
343
342
  it "creates the data bag and item to upload the policy" do
344
- expect(http_client).to receive(:post).with('data', policyfiles_data_bag)
343
+ expect(http_client).to receive(:post).with("data", policyfiles_data_bag)
345
344
  expect(http_client).to receive(:put).
346
- with('data/policyfiles/example-unit-test', policyfile_as_data_bag_item)
345
+ with("data/policyfiles/example-unit-test", policyfile_as_data_bag_item)
347
346
  uploader.upload_policy
348
347
  end
349
348
 
@@ -355,38 +354,38 @@ describe ChefDK::Policyfile::Uploader do
355
354
 
356
355
  let(:policy_document_native_api) { true }
357
356
 
358
- let(:list_cookbooks_url) { 'cookbook_artifacts?num_versions=all' }
357
+ let(:list_cookbooks_url) { "cookbook_artifacts?num_versions=all" }
359
358
 
360
359
  let(:existing_cookbook_on_remote) do
361
- {"apt"=>
362
- {"url"=>"http://localhost:8889/cookbook_artifacts/apt",
363
- "versions"=>
364
- [{"url"=>
360
+ { "apt" =>
361
+ { "url" => "http://localhost:8889/cookbook_artifacts/apt",
362
+ "versions" =>
363
+ [{ "url" =>
365
364
  "http://localhost:8889/cookbook_artifacts/apt/5f7045a8aeaf6ccda3b3594258df9ee982b3a023",
366
- "identifier"=>"5f7045a8aeaf6ccda3b3594258df9ee982b3a023"}]},
367
- "build-essential"=>
368
- {"url"=>"http://localhost:8889/cookbook_artifacts/build-essential",
369
- "versions"=>
370
- [{"url"=>
365
+ "identifier" => "5f7045a8aeaf6ccda3b3594258df9ee982b3a023" }] },
366
+ "build-essential" =>
367
+ { "url" => "http://localhost:8889/cookbook_artifacts/build-essential",
368
+ "versions" =>
369
+ [{ "url" =>
371
370
  "http://localhost:8889/cookbook_artifacts/build-essential/571d8ebd02b296fe90b2e4d68754af7e8e185f28",
372
- "identifier"=>"571d8ebd02b296fe90b2e4d68754af7e8e185f28"}]},
373
- "java"=>
374
- {"url"=>"http://localhost:8889/cookbook_artifacts/java",
375
- "versions"=>
376
- [{"url"=>
371
+ "identifier" => "571d8ebd02b296fe90b2e4d68754af7e8e185f28" }] },
372
+ "java" =>
373
+ { "url" => "http://localhost:8889/cookbook_artifacts/java",
374
+ "versions" =>
375
+ [{ "url" =>
377
376
  "http://localhost:8889/cookbook_artifacts/java/9178a38ad3e3baa55b49c1b8d9f4bf6a43dbc358",
378
- "identifier"=>"9178a38ad3e3baa55b49c1b8d9f4bf6a43dbc358"}]},
379
- "jenkins"=>
380
- {"url"=>"http://localhost:8889/cookbook_artifacts/jenkins",
381
- "versions"=>
382
- [{"url"=>
377
+ "identifier" => "9178a38ad3e3baa55b49c1b8d9f4bf6a43dbc358" }] },
378
+ "jenkins" =>
379
+ { "url" => "http://localhost:8889/cookbook_artifacts/jenkins",
380
+ "versions" =>
381
+ [{ "url" =>
383
382
  "http://localhost:8889/cookbook_artifacts/jenkins/0be380429add00d189b4431059ac967a60052323",
384
- "identifier"=>"0be380429add00d189b4431059ac967a60052323"}]}
383
+ "identifier" => "0be380429add00d189b4431059ac967a60052323" }] },
385
384
  }
386
385
  end
387
386
  def expect_policyfile_upload
388
387
  expect(http_client).to receive(:put).
389
- with('/policy_groups/unit-test/policies/example', policyfile_lock_data)
388
+ with("/policy_groups/unit-test/policies/example", policyfile_lock_data)
390
389
  end
391
390
 
392
391
  it "enables native document mode for policyfiles" do
@@ -395,7 +394,7 @@ describe ChefDK::Policyfile::Uploader do
395
394
 
396
395
  it "uploads the policyfile to the native API" do
397
396
  expect(http_client).to receive(:put).
398
- with('/policy_groups/unit-test/policies/example', policyfile_lock_data)
397
+ with("/policy_groups/unit-test/policies/example", policyfile_lock_data)
399
398
 
400
399
  uploader.upload_policy
401
400
  end
@@ -407,4 +406,3 @@ describe ChefDK::Policyfile::Uploader do
407
406
  end
408
407
 
409
408
  end
410
-