chef-dk 1.2.22 → 1.3.40

Sign up to get free protection for your applications and to get access to all the features.
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'
19
- require 'shared/fixture_cookbook_checksums'
20
- require 'chef-dk/policyfile_lock.rb'
18
+ require "spec_helper"
19
+ require "shared/fixture_cookbook_checksums"
20
+ require "chef-dk/policyfile_lock.rb"
21
21
 
22
22
  describe ChefDK::PolicyfileLock, "installing cookbooks from a lockfile" do
23
23
 
@@ -33,7 +33,7 @@ describe ChefDK::PolicyfileLock, "installing cookbooks from a lockfile" do
33
33
 
34
34
  let(:name) { "application-server" }
35
35
 
36
- let(:run_list) { [ 'recipe[erlang::default]', 'recipe[erchef::prereqs]', 'recipe[erchef::app]' ] }
36
+ let(:run_list) { [ "recipe[erlang::default]", "recipe[erchef::prereqs]", "recipe[erchef::app]" ] }
37
37
 
38
38
  let(:storage_config) do
39
39
  ChefDK::Policyfile::StorageConfig.new( cache_path: cache_path, relative_paths_root: local_cookbooks_root )
@@ -122,10 +122,9 @@ describe ChefDK::PolicyfileLock, "installing cookbooks from a lockfile" do
122
122
  location_spec = local_cookbook_lock.cookbook_location_spec
123
123
  expect(location_spec).to be_an_instance_of(ChefDK::Policyfile::CookbookLocationSpecification)
124
124
 
125
- expect(location_spec.relative_path).to eq('local-cookbook')
125
+ expect(location_spec.relative_path).to eq("local-cookbook")
126
126
  end
127
127
 
128
-
129
128
  it "ensures the cookbooks are installed" do
130
129
  expect(remote_cookbook_lock.cookbook_location_spec).to receive(:ensure_cached)
131
130
  expect(local_cookbook_lock.cookbook_location_spec).to receive(:ensure_cached)
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile_lock'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile_lock"
20
20
 
21
21
  describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
22
22
 
@@ -25,7 +25,7 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
25
25
  "name" => "example",
26
26
  "run_list" => [ "recipe[cookbook::recipe_name]" ],
27
27
  "named_run_lists" => {
28
- "fast-deploy" => [ "recipe[cookbook::deployit]" ]
28
+ "fast-deploy" => [ "recipe[cookbook::deployit]" ],
29
29
  },
30
30
  "cookbook_locks" => {
31
31
  # TODO: add some valid locks
@@ -34,8 +34,8 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
34
34
  "override_attributes" => { "override_foo" => "override_bar" },
35
35
  "solution_dependencies" => {
36
36
  "Policyfile" => [],
37
- "dependencies" => {}
38
- }
37
+ "dependencies" => {},
38
+ },
39
39
  }
40
40
  end
41
41
 
@@ -62,8 +62,8 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
62
62
  end
63
63
 
64
64
  it "includes the attributes" do
65
- expect(lockfile.default_attributes).to eq({"foo" => "bar"})
66
- expect(lockfile.override_attributes).to eq({"override_foo" => "override_bar"})
65
+ expect(lockfile.default_attributes).to eq({ "foo" => "bar" })
66
+ expect(lockfile.override_attributes).to eq({ "override_foo" => "override_bar" })
67
67
  end
68
68
 
69
69
  end
@@ -197,7 +197,7 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
197
197
  expect { lockfile.build_from_lock_data(missing_keys_soln_deps) }.to raise_error(ChefDK::InvalidLockfile)
198
198
 
199
199
  missing_policyfile_key = valid_lock_data.dup
200
- missing_policyfile_key["solution_dependencies"] = {"dependencies" => {} }
200
+ missing_policyfile_key["solution_dependencies"] = { "dependencies" => {} }
201
201
  expect { lockfile.build_from_lock_data(missing_policyfile_key) }.to raise_error(ChefDK::InvalidLockfile)
202
202
 
203
203
  missing_dependencies_key = valid_lock_data.dup
@@ -207,11 +207,11 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
207
207
 
208
208
  it "requires the Policyfile dependencies be an Array" do
209
209
  invalid_policyfile_deps = valid_lock_data.dup
210
- invalid_policyfile_deps["solution_dependencies"] = {"Policyfile" => 42, "dependencies" => {} }
210
+ invalid_policyfile_deps["solution_dependencies"] = { "Policyfile" => 42, "dependencies" => {} }
211
211
  expect { lockfile.build_from_lock_data(invalid_policyfile_deps) }.to raise_error(ChefDK::InvalidLockfile)
212
212
  end
213
213
 
214
- it %q(requires the Policyfile dependencies be formatted like [ "COOKBOOK_NAME", "CONSTRAINT" ]) do
214
+ it %q{requires the Policyfile dependencies be formatted like [ "COOKBOOK_NAME", "CONSTRAINT" ]} do
215
215
  invalid_policyfile_deps_content = valid_lock_data.dup
216
216
  invalid_policyfile_deps_content["solution_dependencies"] = { "Policyfile" => [ "bad" ], "dependencies" => {} }
217
217
  expect { lockfile.build_from_lock_data(invalid_policyfile_deps_content) }.to raise_error(ChefDK::InvalidLockfile)
@@ -221,7 +221,7 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
221
221
  expect { lockfile.build_from_lock_data(invalid_policyfile_deps_content2) }.to raise_error(ChefDK::InvalidLockfile)
222
222
 
223
223
  invalid_policyfile_deps_content3 = valid_lock_data.dup
224
- invalid_policyfile_deps_content3["solution_dependencies"] = { "Policyfile" => [ ["cookbook_name", "bad"] ], "dependencies" => {} }
224
+ invalid_policyfile_deps_content3["solution_dependencies"] = { "Policyfile" => [ %w{cookbook_name bad} ], "dependencies" => {} }
225
225
  expect { lockfile.build_from_lock_data(invalid_policyfile_deps_content3) }.to raise_error(ChefDK::InvalidLockfile)
226
226
  end
227
227
 
@@ -263,7 +263,7 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
263
263
  "identifier" => "68c13b136a49b4e66cfe9d8aa2b5a85167b5bf9b",
264
264
  "dotted_decimal_identifier" => "111.222.333",
265
265
  "cache_key" => "foo-1.0.0",
266
- "source_options" => {}
266
+ "source_options" => {},
267
267
  }
268
268
  end
269
269
 
@@ -386,8 +386,8 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
386
386
  "dotted_decimal_identifier" => "111.222.333",
387
387
  "cache_key" => nil,
388
388
  "source" => "path/to/foo",
389
- "source_options" => { path: "path/to/foo"},
390
- "scm_info" => nil
389
+ "source_options" => { path: "path/to/foo" },
390
+ "scm_info" => nil,
391
391
  }
392
392
  end
393
393
 
@@ -419,7 +419,6 @@ describe ChefDK::PolicyfileLock, "when reading a Policyfile.lock" do
419
419
  expect(locks["foo"].to_lock).to eq(valid_cookbook_lock)
420
420
  end
421
421
 
422
-
423
422
  end
424
423
 
425
424
  end
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile_lock.rb'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile_lock.rb"
20
20
 
21
21
  describe ChefDK::PolicyfileLock, "validating locked cookbooks" do
22
22
 
@@ -42,7 +42,7 @@ describe ChefDK::PolicyfileLock, "validating locked cookbooks" do
42
42
 
43
43
  let(:name) { "application-server" }
44
44
 
45
- let(:run_list) { [ 'recipe[erlang::default]', 'recipe[erchef::prereqs]', 'recipe[erchef::app]' ] }
45
+ let(:run_list) { [ "recipe[erlang::default]", "recipe[erchef::prereqs]", "recipe[erchef::app]" ] }
46
46
 
47
47
  let(:storage_config) do
48
48
  ChefDK::Policyfile::StorageConfig.new( cache_path: cache_path, relative_paths_root: local_cookbooks_root )
@@ -53,8 +53,8 @@ describe ChefDK::PolicyfileLock, "validating locked cookbooks" do
53
53
  "Policyfile" => [],
54
54
  "dependencies" => {
55
55
  "foo (1.0.0)" => [],
56
- "local-cookbook (2.3.4)" => []
57
- }
56
+ "local-cookbook (2.3.4)" => [],
57
+ },
58
58
  }
59
59
  end
60
60
 
@@ -114,7 +114,7 @@ describe ChefDK::PolicyfileLock, "validating locked cookbooks" do
114
114
  # Validate the metadata is correct, so we know the test setup code
115
115
  # hasn't done something wrong.
116
116
  def ensure_metadata_as_expected!
117
- expected_metadata_rb=<<-E
117
+ expected_metadata_rb = <<-E
118
118
  name 'local-cookbook'
119
119
  maintainer ''
120
120
  maintainer_email ''
@@ -157,7 +157,6 @@ version '2.3.4'
157
157
  E
158
158
  end
159
159
 
160
-
161
160
  before do
162
161
  ensure_metadata_as_expected!
163
162
  with_file(metadata_path) { |f| f.print(new_metadata) }
@@ -216,8 +215,8 @@ E
216
215
  {
217
216
  "Policyfile" => [],
218
217
  "dependencies" => {
219
- "foo (1.0.0)" => [ [ "local-cookbook", "~> 2.0" ] ]
220
- }
218
+ "foo (1.0.0)" => [ [ "local-cookbook", "~> 2.0" ] ],
219
+ },
221
220
  }
222
221
  end
223
222
 
@@ -319,7 +318,7 @@ E
319
318
  actual = policyfile_lock.solution_dependencies.to_lock["dependencies"]
320
319
  expected = {
321
320
  "local-cookbook (2.3.4)" => [ ["foo", "= 1.0.0"] ],
322
- "foo (1.0.0)" => []
321
+ "foo (1.0.0)" => [],
323
322
  }
324
323
  expect(actual).to eq(expected)
325
324
  end
@@ -363,8 +362,8 @@ E
363
362
  "Policyfile" => [],
364
363
  "dependencies" => {
365
364
  "foo (1.0.0)" => [],
366
- "local-cookbook (2.3.4)" => [ ["foo", ">= 0.0.0"] ]
367
- }
365
+ "local-cookbook (2.3.4)" => [ ["foo", ">= 0.0.0"] ],
366
+ },
368
367
  }
369
368
  end
370
369
 
@@ -393,7 +392,7 @@ E
393
392
  actual = policyfile_lock.solution_dependencies.to_lock["dependencies"]
394
393
  expected = {
395
394
  "local-cookbook (2.3.4)" => [ ["foo", ">= 1.0.0"] ],
396
- "foo (1.0.0)" => []
395
+ "foo (1.0.0)" => [],
397
396
  }
398
397
  expect(actual).to eq(expected)
399
398
  end
@@ -428,7 +427,6 @@ E
428
427
  expect { policyfile_lock.validate_cookbooks! }.to raise_error(ChefDK::DependencyConflict, error_message)
429
428
  end
430
429
 
431
-
432
430
  end
433
431
 
434
432
  context "when a :path source cookbook has updated it's version and another path source cookbook has updated its constraint" do
@@ -471,8 +469,8 @@ E
471
469
  "dependencies" => {
472
470
  "foo (1.0.0)" => [],
473
471
  "local-cookbook (2.3.4)" => [ ],
474
- "another-local-cookbook (0.1.0)" => [ ["local-cookbook", "= 2.3.4"] ]
475
- }
472
+ "another-local-cookbook (0.1.0)" => [ ["local-cookbook", "= 2.3.4"] ],
473
+ },
476
474
  }
477
475
  end
478
476
 
@@ -505,7 +503,7 @@ E
505
503
  end
506
504
 
507
505
  let(:metadata_path_another_local_cookbook) do
508
- File.join(local_cookbooks_root, 'another-local-cookbook', 'metadata.rb')
506
+ File.join(local_cookbooks_root, "another-local-cookbook", "metadata.rb")
509
507
  end
510
508
 
511
509
  before do
@@ -522,7 +520,7 @@ E
522
520
  expected = {
523
521
  "local-cookbook (3.0.0)" => [ ],
524
522
  "another-local-cookbook (0.1.0)" => [ [ "local-cookbook", "= 3.0.0" ] ],
525
- "foo (1.0.0)" => []
523
+ "foo (1.0.0)" => [],
526
524
  }
527
525
  expect(actual).to eq(expected)
528
526
  end
@@ -543,7 +541,7 @@ E
543
541
  # Validate the metadata is correct, so we know the test setup code
544
542
  # hasn't done something wrong.
545
543
  def ensure_metadata_as_expected!
546
- expected_metadata_rb=<<-E
544
+ expected_metadata_rb = <<-E
547
545
  name 'foo'
548
546
  maintainer ''
549
547
  maintainer_email ''
@@ -608,4 +606,3 @@ E
608
606
  end
609
607
  end
610
608
  end
611
-
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile_services/clean_policies'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile_services/clean_policies"
20
20
 
21
21
  describe ChefDK::PolicyfileServices::CleanPolicies do
22
22
 
@@ -97,12 +97,12 @@ describe ChefDK::PolicyfileServices::CleanPolicies do
97
97
  {
98
98
  "appserver" => {
99
99
  "1111111111111111111111111111111111111111111111111111111111111111" => {},
100
- "2222222222222222222222222222222222222222222222222222222222222222" => {}
100
+ "2222222222222222222222222222222222222222222222222222222222222222" => {},
101
101
  },
102
102
  "load-balancer" => {
103
103
  "5555555555555555555555555555555555555555555555555555555555555555" => {},
104
- "6666666666666666666666666666666666666666666666666666666666666666" => {}
105
- }
104
+ "6666666666666666666666666666666666666666666666666666666666666666" => {},
105
+ },
106
106
  }
107
107
  end
108
108
 
@@ -110,16 +110,16 @@ describe ChefDK::PolicyfileServices::CleanPolicies do
110
110
  {
111
111
  "dev" => {
112
112
  "appserver" => "1111111111111111111111111111111111111111111111111111111111111111",
113
- "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555"
113
+ "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555",
114
114
  },
115
115
  "staging" => {
116
116
  "appserver" => "2222222222222222222222222222222222222222222222222222222222222222",
117
- "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555"
117
+ "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555",
118
118
  },
119
119
  "prod" => {
120
120
  "appserver" => "2222222222222222222222222222222222222222222222222222222222222222",
121
- "load-balancer" => "6666666666666666666666666666666666666666666666666666666666666666"
122
- }
121
+ "load-balancer" => "6666666666666666666666666666666666666666666666666666666666666666",
122
+ },
123
123
  }
124
124
  end
125
125
 
@@ -141,13 +141,13 @@ describe ChefDK::PolicyfileServices::CleanPolicies do
141
141
  "appserver" => {
142
142
  "1111111111111111111111111111111111111111111111111111111111111111" => {},
143
143
  "2222222222222222222222222222222222222222222222222222222222222222" => {},
144
- "4444444444444444444444444444444444444444444444444444444444444444" => {}
144
+ "4444444444444444444444444444444444444444444444444444444444444444" => {},
145
145
  },
146
146
  "load-balancer" => {
147
147
  "5555555555555555555555555555555555555555555555555555555555555555" => {},
148
148
  "6666666666666666666666666666666666666666666666666666666666666666" => {},
149
- "7777777777777777777777777777777777777777777777777777777777777777" => {}
150
- }
149
+ "7777777777777777777777777777777777777777777777777777777777777777" => {},
150
+ },
151
151
  }
152
152
  end
153
153
 
@@ -155,16 +155,16 @@ describe ChefDK::PolicyfileServices::CleanPolicies do
155
155
  {
156
156
  "dev" => {
157
157
  "appserver" => "1111111111111111111111111111111111111111111111111111111111111111",
158
- "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555"
158
+ "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555",
159
159
  },
160
160
  "staging" => {
161
161
  "appserver" => "2222222222222222222222222222222222222222222222222222222222222222",
162
- "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555"
162
+ "load-balancer" => "5555555555555555555555555555555555555555555555555555555555555555",
163
163
  },
164
164
  "prod" => {
165
165
  "appserver" => "2222222222222222222222222222222222222222222222222222222222222222",
166
- "load-balancer" => "6666666666666666666666666666666666666666666666666666666666666666"
167
- }
166
+ "load-balancer" => "6666666666666666666666666666666666666666666666666666666666666666",
167
+ },
168
168
  }
169
169
  end
170
170
 
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require 'spec_helper'
19
- require 'chef-dk/policyfile_services/clean_policy_cookbooks'
18
+ require "spec_helper"
19
+ require "chef-dk/policyfile_services/clean_policy_cookbooks"
20
20
 
21
21
  describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
22
22
 
@@ -25,27 +25,27 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
25
25
  "mysql" => {
26
26
  "versions" => [
27
27
  {
28
- "identifier" => "6b506252cae939c874bd59b560c339b01c31326b"
29
- }
30
- ]
28
+ "identifier" => "6b506252cae939c874bd59b560c339b01c31326b",
29
+ },
30
+ ],
31
31
  },
32
32
  "build-essential" => {
33
33
  "versions" => [
34
34
  {
35
- "identifier" => "2db3df121028894f45497f847de91b91fbf76824"
35
+ "identifier" => "2db3df121028894f45497f847de91b91fbf76824",
36
36
  },
37
37
  {
38
- "identifier" => "d8ce58401d154378599b0fead81d2c390615602b"
39
- }
40
- ]
41
- }
38
+ "identifier" => "d8ce58401d154378599b0fead81d2c390615602b",
39
+ },
40
+ ],
41
+ },
42
42
  }
43
43
  end
44
44
 
45
45
  let(:cookbook_ids_by_name) do
46
46
  {
47
47
  "mysql" => [ "6b506252cae939c874bd59b560c339b01c31326b" ],
48
- "build-essential" => [ "2db3df121028894f45497f847de91b91fbf76824", "d8ce58401d154378599b0fead81d2c390615602b" ]
48
+ "build-essential" => %w{2db3df121028894f45497f847de91b91fbf76824 d8ce58401d154378599b0fead81d2c390615602b},
49
49
  }
50
50
  end
51
51
 
@@ -60,15 +60,15 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
60
60
  {
61
61
  "aar" => {
62
62
  "revisions" => {
63
- "37f9b658cdd1d9319bac8920581723efcc2014304b5f3827ee0779e10ffbdcc9" => { }
64
- }
63
+ "37f9b658cdd1d9319bac8920581723efcc2014304b5f3827ee0779e10ffbdcc9" => {},
64
+ },
65
65
  },
66
66
  "jenkins" => {
67
67
  "revisions" => {
68
- "613f803bdd035d574df7fa6da525b38df45a74ca82b38b79655efed8a189e073" => { },
69
- "6fe753184c8946052d3231bb4212116df28d89a3a5f7ae52832ad408419dd5eb" => { }
70
- }
71
- }
68
+ "613f803bdd035d574df7fa6da525b38df45a74ca82b38b79655efed8a189e073" => {},
69
+ "6fe753184c8946052d3231bb4212116df28d89a3a5f7ae52832ad408419dd5eb" => {},
70
+ },
71
+ },
72
72
  }
73
73
  end
74
74
 
@@ -87,7 +87,6 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
87
87
  described_class.new(ui: ui, config: chef_config)
88
88
  end
89
89
 
90
-
91
90
  it "configures an HTTP client with the user's credentials" do
92
91
  expect(ChefDK::AuthenticatedHTTP).to receive(:new).with("https://localhost:10443",
93
92
  signing_key_filename: "/path/to/client/key.pem",
@@ -160,8 +159,8 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
160
159
  let(:policy_aar_37f9b65) do
161
160
  {
162
161
  "cookbook_locks" => {
163
- "mysql" => { "identifier" => "6b506252cae939c874bd59b560c339b01c31326b" }
164
- }
162
+ "mysql" => { "identifier" => "6b506252cae939c874bd59b560c339b01c31326b" },
163
+ },
165
164
  }
166
165
  end
167
166
 
@@ -169,8 +168,8 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
169
168
  {
170
169
  "cookbook_locks" => {
171
170
  "mysql" => { "identifier" => "6b506252cae939c874bd59b560c339b01c31326b" },
172
- "build-essential" => { "identifier" => "2db3df121028894f45497f847de91b91fbf76824" }
173
- }
171
+ "build-essential" => { "identifier" => "2db3df121028894f45497f847de91b91fbf76824" },
172
+ },
174
173
  }
175
174
  end
176
175
 
@@ -178,8 +177,8 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
178
177
  {
179
178
  "cookbook_locks" => {
180
179
  "mysql" => { "identifier" => "6b506252cae939c874bd59b560c339b01c31326b" },
181
- "build-essential" => { "identifier" => "d8ce58401d154378599b0fead81d2c390615602b" }
182
- }
180
+ "build-essential" => { "identifier" => "d8ce58401d154378599b0fead81d2c390615602b" },
181
+ },
183
182
  }
184
183
  end
185
184
 
@@ -195,7 +194,6 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
195
194
  and_return(policy_jenkins_6fe7531)
196
195
  end
197
196
 
198
-
199
197
  context "and all cookbooks are active" do
200
198
 
201
199
  it "lists all the cookbooks" do
@@ -223,15 +221,15 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
223
221
  "cookbook_locks" => {
224
222
  "mysql" => { "identifier" => "6b506252cae939c874bd59b560c339b01c31326b" },
225
223
  # this is changed to reference the same cookbook as policy_jenkins_613f803
226
- "build-essential" => { "identifier" => "2db3df121028894f45497f847de91b91fbf76824" }
227
- }
224
+ "build-essential" => { "identifier" => "2db3df121028894f45497f847de91b91fbf76824" },
225
+ },
228
226
  }
229
227
  end
230
228
 
231
229
  let(:expected_active_cookbooks) do
232
230
  {
233
231
  "mysql" => Set.new([ "6b506252cae939c874bd59b560c339b01c31326b" ]),
234
- "build-essential" => Set.new([ "2db3df121028894f45497f847de91b91fbf76824" ])
232
+ "build-essential" => Set.new([ "2db3df121028894f45497f847de91b91fbf76824" ]),
235
233
  }
236
234
  end
237
235
 
@@ -272,4 +270,3 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
272
270
  end
273
271
 
274
272
  end
275
-