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.
- checksums.yaml +4 -4
- data/Gemfile +8 -12
- data/Gemfile.lock +120 -116
- data/README.md +4 -3
- data/Rakefile +54 -0
- data/acceptance/Gemfile.lock +36 -47
- data/bin/chef +1 -1
- data/chef-dk.gemspec +9 -9
- data/lib/chef-dk/authenticated_http.rb +6 -7
- data/lib/chef-dk/builtin_commands.rb +3 -4
- data/lib/chef-dk/chef_runner.rb +7 -8
- data/lib/chef-dk/cli.rb +11 -11
- data/lib/chef-dk/command/base.rb +4 -4
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +4 -5
- data/lib/chef-dk/command/clean_policy_revisions.rb +4 -6
- data/lib/chef-dk/command/delete_policy.rb +4 -6
- data/lib/chef-dk/command/delete_policy_group.rb +6 -8
- data/lib/chef-dk/command/diff.rb +9 -10
- data/lib/chef-dk/command/env.rb +26 -27
- data/lib/chef-dk/command/exec.rb +5 -6
- data/lib/chef-dk/command/export.rb +8 -10
- data/lib/chef-dk/command/gem.rb +5 -5
- data/lib/chef-dk/command/generate.rb +19 -19
- data/lib/chef-dk/command/generator_commands.rb +8 -8
- data/lib/chef-dk/command/generator_commands/app.rb +2 -3
- data/lib/chef-dk/command/generator_commands/attribute.rb +2 -3
- data/lib/chef-dk/command/generator_commands/base.rb +13 -13
- data/lib/chef-dk/command/generator_commands/build_cookbook.rb +2 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +2 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +1 -2
- data/lib/chef-dk/command/generator_commands/chef_exts/recipe_dsl_ext.rb +1 -2
- data/lib/chef-dk/command/generator_commands/cookbook.rb +2 -2
- data/lib/chef-dk/command/generator_commands/cookbook_code_file.rb +3 -3
- data/lib/chef-dk/command/generator_commands/cookbook_file.rb +2 -2
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +4 -7
- data/lib/chef-dk/command/generator_commands/lwrp.rb +2 -2
- data/lib/chef-dk/command/generator_commands/policyfile.rb +2 -3
- data/lib/chef-dk/command/generator_commands/recipe.rb +2 -2
- data/lib/chef-dk/command/generator_commands/repo.rb +1 -3
- data/lib/chef-dk/command/generator_commands/template.rb +2 -2
- data/lib/chef-dk/command/install.rb +4 -5
- data/lib/chef-dk/command/provision.rb +12 -14
- data/lib/chef-dk/command/push.rb +5 -6
- data/lib/chef-dk/command/push_archive.rb +4 -5
- data/lib/chef-dk/command/shell_init.rb +15 -16
- data/lib/chef-dk/command/show_policy.rb +5 -7
- data/lib/chef-dk/command/undelete.rb +6 -7
- data/lib/chef-dk/command/update.rb +5 -6
- data/lib/chef-dk/command/verify.rb +30 -31
- data/lib/chef-dk/commands_map.rb +1 -3
- data/lib/chef-dk/component_test.rb +13 -13
- data/lib/chef-dk/configurable.rb +2 -2
- data/lib/chef-dk/cookbook_metadata.rb +2 -2
- data/lib/chef-dk/cookbook_omnifetch.rb +7 -8
- data/lib/chef-dk/cookbook_profiler/git.rb +8 -8
- data/lib/chef-dk/cookbook_profiler/identifiers.rb +7 -7
- data/lib/chef-dk/cookbook_profiler/null_scm.rb +0 -1
- data/lib/chef-dk/exceptions.rb +1 -1
- data/lib/chef-dk/generator.rb +9 -7
- data/lib/chef-dk/helpers.rb +15 -15
- data/lib/chef-dk/pager.rb +2 -3
- data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +4 -4
- data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +6 -6
- data/lib/chef-dk/policyfile/community_cookbook_source.rb +4 -5
- data/lib/chef-dk/policyfile/comparison_base.rb +3 -4
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +6 -6
- data/lib/chef-dk/policyfile/cookbook_locks.rb +11 -11
- data/lib/chef-dk/policyfile/cookbook_sources.rb +5 -5
- data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +8 -9
- data/lib/chef-dk/policyfile/differ.rb +7 -10
- data/lib/chef-dk/policyfile/dsl.rb +10 -11
- data/lib/chef-dk/policyfile/lister.rb +3 -6
- data/lib/chef-dk/policyfile/null_cookbook_source.rb +3 -3
- data/lib/chef-dk/policyfile/read_cookbook_for_compat_mode_upload.rb +3 -3
- data/lib/chef-dk/policyfile/reports/install.rb +3 -4
- data/lib/chef-dk/policyfile/reports/table_printer.rb +0 -1
- data/lib/chef-dk/policyfile/reports/upload.rb +4 -4
- data/lib/chef-dk/policyfile/solution_dependencies.rb +22 -22
- data/lib/chef-dk/policyfile/source_uri.rb +2 -2
- data/lib/chef-dk/policyfile/storage_config.rb +4 -5
- data/lib/chef-dk/policyfile/undo_record.rb +6 -9
- data/lib/chef-dk/policyfile/undo_stack.rb +5 -7
- data/lib/chef-dk/policyfile/uploader.rb +8 -8
- data/lib/chef-dk/policyfile_compiler.rb +16 -20
- data/lib/chef-dk/policyfile_lock.rb +10 -11
- data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
- data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +3 -5
- data/lib/chef-dk/policyfile_services/export_repo.rb +13 -14
- data/lib/chef-dk/policyfile_services/install.rb +6 -6
- data/lib/chef-dk/policyfile_services/push.rb +6 -8
- data/lib/chef-dk/policyfile_services/push_archive.rb +6 -10
- data/lib/chef-dk/policyfile_services/rm_policy.rb +4 -5
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +4 -5
- data/lib/chef-dk/policyfile_services/show_policy.rb +5 -6
- data/lib/chef-dk/policyfile_services/undelete.rb +3 -3
- data/lib/chef-dk/policyfile_services/update_attributes.rb +4 -6
- data/lib/chef-dk/service_exception_inspectors.rb +2 -3
- data/lib/chef-dk/service_exception_inspectors/base.rb +0 -1
- data/lib/chef-dk/service_exception_inspectors/http.rb +1 -3
- data/lib/chef-dk/service_exceptions.rb +1 -2
- data/lib/chef-dk/shell_out.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/.kitchen.yml +2 -2
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/README.md +2 -2
- data/lib/chef-dk/skeletons/code_generator/files/default/build_cookbook/test-fixture-recipe.rb +1 -0
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/recipes/default.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/metadata.rb +0 -1
- data/lib/chef-dk/skeletons/code_generator/recipes/app.rb +6 -6
- data/lib/chef-dk/skeletons/code_generator/recipes/attribute.rb +3 -3
- data/lib/chef-dk/skeletons/code_generator/recipes/build_cookbook.rb +43 -39
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook.rb +31 -22
- data/lib/chef-dk/skeletons/code_generator/recipes/cookbook_file.rb +5 -5
- data/lib/chef-dk/skeletons/code_generator/recipes/lwrp.rb +4 -4
- data/lib/chef-dk/skeletons/code_generator/recipes/policyfile.rb +1 -1
- data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +8 -8
- data/lib/chef-dk/skeletons/code_generator/recipes/repo.rb +15 -15
- data/lib/chef-dk/skeletons/code_generator/recipes/template.rb +6 -6
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/Berksfile.erb +0 -2
- data/lib/chef-dk/skeletons/code_generator/templates/default/build_cookbook/metadata.rb.erb +1 -0
- data/lib/chef-dk/skeletons/code_generator/templates/default/inspec_default_test.rb.erb +4 -4
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen.yml.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/kitchen_policyfile.yml.erb +1 -1
- data/lib/chef-dk/skeletons/code_generator/templates/default/metadata.rb.erb +4 -3
- data/lib/chef-dk/skeletons/code_generator/templates/default/recipe_spec.rb.erb +4 -2
- data/lib/chef-dk/ui.rb +0 -1
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +7 -7
- data/omnibus_overrides.rb +3 -3
- data/spec/shared/a_file_generator.rb +3 -3
- data/spec/shared/custom_generator_cookbook.rb +6 -6
- data/spec/shared/fixture_cookbook_checksums.rb +2 -3
- data/spec/shared/setup_git_committer_config.rb +1 -1
- data/spec/shared/setup_git_cookbooks.rb +2 -2
- data/spec/spec_helper.rb +5 -5
- data/spec/test_helpers.rb +2 -2
- data/spec/unit/chef_runner_spec.rb +5 -7
- data/spec/unit/cli_spec.rb +36 -37
- data/spec/unit/command/base_spec.rb +4 -5
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +8 -9
- data/spec/unit/command/clean_policy_revisions_spec.rb +8 -9
- data/spec/unit/command/delete_policy_group_spec.rb +11 -12
- data/spec/unit/command/delete_policy_spec.rb +11 -12
- data/spec/unit/command/diff_spec.rb +5 -6
- data/spec/unit/command/env_spec.rb +5 -5
- data/spec/unit/command/exec_spec.rb +18 -19
- data/spec/unit/command/export_spec.rb +5 -6
- data/spec/unit/command/generate_spec.rb +10 -10
- data/spec/unit/command/generator_commands/app_spec.rb +6 -6
- data/spec/unit/command/generator_commands/attribute_spec.rb +3 -4
- data/spec/unit/command/generator_commands/base_spec.rb +46 -46
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +50 -16
- data/spec/unit/command/generator_commands/chef_exts/generator_desc_resource_spec.rb +9 -9
- data/spec/unit/command/generator_commands/chef_exts/recipe_dsl_ext_spec.rb +16 -16
- data/spec/unit/command/generator_commands/cookbook_file_spec.rb +3 -4
- data/spec/unit/command/generator_commands/cookbook_spec.rb +23 -26
- data/spec/unit/command/generator_commands/generator_generator_spec.rb +4 -6
- data/spec/unit/command/generator_commands/lwrp_spec.rb +3 -4
- data/spec/unit/command/generator_commands/policyfile_spec.rb +3 -5
- data/spec/unit/command/generator_commands/recipe_spec.rb +4 -4
- data/spec/unit/command/generator_commands/repo_spec.rb +11 -11
- data/spec/unit/command/generator_commands/template_spec.rb +3 -4
- data/spec/unit/command/install_spec.rb +6 -6
- data/spec/unit/command/provision_spec.rb +27 -30
- data/spec/unit/command/push_archive_spec.rb +3 -3
- data/spec/unit/command/push_spec.rb +5 -6
- data/spec/unit/command/shell_init_spec.rb +17 -19
- data/spec/unit/command/show_policy_spec.rb +11 -12
- data/spec/unit/command/undelete_spec.rb +12 -14
- data/spec/unit/command/update_spec.rb +8 -8
- data/spec/unit/command/verify_spec.rb +10 -10
- data/spec/unit/commands_map_spec.rb +4 -4
- data/spec/unit/component_test_spec.rb +3 -3
- data/spec/unit/configurable_spec.rb +7 -7
- data/spec/unit/cookbook_metadata_spec.rb +5 -7
- data/spec/unit/cookbook_profiler/git_spec.rb +6 -7
- data/spec/unit/cookbook_profiler/identifiers_spec.rb +5 -7
- data/spec/unit/fixtures/command/cli_test_command.rb +2 -2
- data/spec/unit/fixtures/configurable/test_configurable.rb +1 -1
- data/spec/unit/fixtures/cookbooks_api/update_fixtures.rb +13 -16
- data/spec/unit/fixtures/eg_omnibus_dir/valid/embedded/apps/berkshelf/verify_me +1 -1
- data/spec/unit/gemfile_util_spec.rb +4 -4
- data/spec/unit/generator_spec.rb +10 -10
- data/spec/unit/helpers_spec.rb +31 -31
- data/spec/unit/pager_spec.rb +5 -7
- data/spec/unit/policyfile/chef_repo_cookbook_source_spec.rb +11 -11
- data/spec/unit/policyfile/chef_server_cookbook_source_spec.rb +13 -13
- data/spec/unit/policyfile/community_cookbook_source_spec.rb +3 -4
- data/spec/unit/policyfile/comparison_base_spec.rb +3 -6
- data/spec/unit/policyfile/cookbook_location_specification_spec.rb +3 -3
- data/spec/unit/policyfile/cookbook_locks_spec.rb +7 -9
- data/spec/unit/policyfile/delivery_supermarket_source_spec.rb +16 -17
- data/spec/unit/policyfile/differ_spec.rb +4 -5
- data/spec/unit/policyfile/lister_spec.rb +31 -35
- data/spec/unit/policyfile/null_cookbook_source_spec.rb +2 -3
- data/spec/unit/policyfile/read_cookbook_for_compat_mode_upload_spec.rb +3 -3
- data/spec/unit/policyfile/reports/install_spec.rb +4 -5
- data/spec/unit/policyfile/reports/upload_spec.rb +4 -6
- data/spec/unit/policyfile/solution_dependencies_spec.rb +13 -13
- data/spec/unit/policyfile/source_uri_spec.rb +5 -5
- data/spec/unit/policyfile/storage_config_spec.rb +3 -7
- data/spec/unit/policyfile/undo_record_spec.rb +21 -23
- data/spec/unit/policyfile/undo_stack_spec.rb +5 -6
- data/spec/unit/policyfile/uploader_spec.rb +73 -75
- data/spec/unit/policyfile_demands_spec.rb +93 -99
- data/spec/unit/policyfile_evaluation_spec.rb +14 -14
- data/spec/unit/policyfile_lock_build_spec.rb +64 -65
- data/spec/unit/policyfile_lock_install_spec.rb +5 -6
- data/spec/unit/policyfile_lock_serialization_spec.rb +14 -15
- data/spec/unit/policyfile_lock_validation_spec.rb +17 -20
- data/spec/unit/policyfile_services/clean_policies_spec.rb +16 -16
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +26 -29
- data/spec/unit/policyfile_services/export_repo_spec.rb +3 -6
- data/spec/unit/policyfile_services/install_spec.rb +5 -7
- data/spec/unit/policyfile_services/push_archive_spec.rb +4 -8
- data/spec/unit/policyfile_services/push_spec.rb +3 -3
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +16 -20
- data/spec/unit/policyfile_services/rm_policy_spec.rb +14 -17
- data/spec/unit/policyfile_services/show_policy_spec.rb +78 -80
- data/spec/unit/policyfile_services/undelete_spec.rb +5 -7
- data/spec/unit/policyfile_services/update_attributes_spec.rb +34 -35
- data/spec/unit/service_exception_inspectors/base_spec.rb +2 -4
- data/spec/unit/service_exception_inspectors/http_spec.rb +9 -11
- data/spec/unit/shell_out_spec.rb +2 -2
- data/spec/unit/tasks/helpers_spec.rb +2 -2
- data/tasks/bin/bundle-platform +1 -1
- data/tasks/bundle_util.rb +1 -1
- data/tasks/dependencies.rb +21 -7
- data/tasks/gemfile_util.rb +1 -1
- data/tasks/helpers.rb +2 -2
- data/tasks/version.rb +26 -1
- data/version_policy.rb +6 -6
- metadata +3 -3
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
18
|
+
require "spec_helper"
|
|
19
|
+
require "chef-dk/policyfile_compiler"
|
|
20
20
|
|
|
21
21
|
describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph demands" do
|
|
22
22
|
|
|
@@ -49,7 +49,7 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
49
49
|
"nginx" => {
|
|
50
50
|
"1.0.0" => [ [ "apt", "~> 2.0" ], [ "yum", "~> 1.0" ] ],
|
|
51
51
|
"1.2.0" => [ [ "apt", "~> 2.1" ], [ "yum", "~> 1.0" ] ],
|
|
52
|
-
"2.0.0" => [ [ "apt", "~> 3.0" ], [ "yum", "~> 1.0" ], [ "ohai", "~> 2.0" ] ]
|
|
52
|
+
"2.0.0" => [ [ "apt", "~> 3.0" ], [ "yum", "~> 1.0" ], [ "ohai", "~> 2.0" ] ],
|
|
53
53
|
},
|
|
54
54
|
|
|
55
55
|
"mysql" => {
|
|
@@ -59,30 +59,30 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
"local-cookbook" => {
|
|
62
|
-
"9.9.9" => [ ["local-cookbook-on-community-dep", "= 1.0.0"] ]
|
|
62
|
+
"9.9.9" => [ ["local-cookbook-on-community-dep", "= 1.0.0"] ],
|
|
63
63
|
},
|
|
64
64
|
|
|
65
65
|
"git-sourced-cookbook" => {
|
|
66
|
-
"10.10.10" => [ ["git-sourced-cookbook-dep", "= 1.0.0"] ]
|
|
66
|
+
"10.10.10" => [ ["git-sourced-cookbook-dep", "= 1.0.0"] ],
|
|
67
67
|
},
|
|
68
68
|
|
|
69
69
|
"remote-cb" => {
|
|
70
70
|
"0.1.0" => [ ],
|
|
71
|
-
"1.1.1" => [ ]
|
|
71
|
+
"1.1.1" => [ ],
|
|
72
72
|
},
|
|
73
73
|
|
|
74
74
|
"remote-cb-two" => {
|
|
75
75
|
"0.1.0" => [ ],
|
|
76
|
-
"1.1.1" => [ ]
|
|
76
|
+
"1.1.1" => [ ],
|
|
77
77
|
},
|
|
78
78
|
|
|
79
79
|
"local-cookbook-dep-one" => {
|
|
80
|
-
"1.5.0" => [ ]
|
|
80
|
+
"1.5.0" => [ ],
|
|
81
81
|
},
|
|
82
82
|
|
|
83
83
|
"git-sourced-cookbook-dep" => {
|
|
84
|
-
"2.8.0" => [ ]
|
|
85
|
-
}
|
|
84
|
+
"2.8.0" => [ ],
|
|
85
|
+
},
|
|
86
86
|
|
|
87
87
|
}
|
|
88
88
|
end
|
|
@@ -103,29 +103,28 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
103
103
|
},
|
|
104
104
|
|
|
105
105
|
"local-cookbook" => {
|
|
106
|
-
"9.9.9" => [ ["local-cookbook-on-community-dep", "= 1.0.0"] ]
|
|
106
|
+
"9.9.9" => [ ["local-cookbook-on-community-dep", "= 1.0.0"] ],
|
|
107
107
|
},
|
|
108
108
|
|
|
109
109
|
"remote-cb" => {
|
|
110
|
-
"1.1.1" => [ ]
|
|
110
|
+
"1.1.1" => [ ],
|
|
111
111
|
},
|
|
112
112
|
|
|
113
113
|
"git-sourced-cookbook" => {
|
|
114
|
-
"10.10.10" => [ ["git-sourced-cookbook-dep", "= 1.0.0"] ]
|
|
114
|
+
"10.10.10" => [ ["git-sourced-cookbook-dep", "= 1.0.0"] ],
|
|
115
115
|
},
|
|
116
116
|
|
|
117
117
|
"private-cookbook" => {
|
|
118
|
-
"0.1.0" => [ ]
|
|
118
|
+
"0.1.0" => [ ],
|
|
119
119
|
},
|
|
120
120
|
|
|
121
121
|
"local-cookbook-dep-one" => {
|
|
122
|
-
"1.6.0" => [ ]
|
|
122
|
+
"1.6.0" => [ ],
|
|
123
123
|
},
|
|
124
124
|
|
|
125
125
|
"git-sourced-cookbook-dep" => {
|
|
126
|
-
"2.9.0" => [ ]
|
|
127
|
-
}
|
|
128
|
-
|
|
126
|
+
"2.9.0" => [ ],
|
|
127
|
+
},
|
|
129
128
|
|
|
130
129
|
}
|
|
131
130
|
end
|
|
@@ -189,8 +188,8 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
189
188
|
let(:trimmed_cookbook_universe) do
|
|
190
189
|
{
|
|
191
190
|
"remote-cb" => {
|
|
192
|
-
"1.1.1" => [ ]
|
|
193
|
-
}
|
|
191
|
+
"1.1.1" => [ ],
|
|
192
|
+
},
|
|
194
193
|
|
|
195
194
|
}
|
|
196
195
|
end
|
|
@@ -229,7 +228,6 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
229
228
|
with("remote-cb", "1.1.1").
|
|
230
229
|
and_return(remote_cb_source_opts)
|
|
231
230
|
|
|
232
|
-
|
|
233
231
|
allow(ChefDK::Policyfile::CookbookLocationSpecification).to receive(:new).
|
|
234
232
|
with("remote-cb", "= 1.1.1", remote_cb_source_opts, policyfile.storage_config).
|
|
235
233
|
and_return(cb_location_spec)
|
|
@@ -301,7 +299,7 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
301
299
|
let(:run_list) { ["remote-cb::this_recipe_doesnt_exist"] }
|
|
302
300
|
|
|
303
301
|
it "emits an error" do
|
|
304
|
-
message
|
|
302
|
+
message = <<-MESSAGE
|
|
305
303
|
The installed cookbooks do not contain all the recipes required by your run list(s):
|
|
306
304
|
Cookbook 'remote-cb' = 1.1.1 {:artifactserver=>"https://supermarket.example/c/remote-cb/1.1.1/download", :version=>"1.1.1"}
|
|
307
305
|
is missing the following required recipes:
|
|
@@ -329,11 +327,10 @@ MESSAGE
|
|
|
329
327
|
and_return(false)
|
|
330
328
|
end
|
|
331
329
|
|
|
332
|
-
|
|
333
330
|
let(:run_list) { ["remote-cb::default", "remote-cb::this_recipe_doesnt_exist"] }
|
|
334
331
|
|
|
335
332
|
it "emits an error" do
|
|
336
|
-
message
|
|
333
|
+
message = <<-MESSAGE
|
|
337
334
|
The installed cookbooks do not contain all the recipes required by your run list(s):
|
|
338
335
|
Cookbook 'remote-cb' = 1.1.1 {:artifactserver=>"https://supermarket.example/c/remote-cb/1.1.1/download", :version=>"1.1.1"}
|
|
339
336
|
is missing the following required recipes:
|
|
@@ -365,7 +362,7 @@ MESSAGE
|
|
|
365
362
|
let(:run_list) { ["remote-cb::this_recipe_doesnt_exist", "remote-cb::this_also_doesnt_exist"] }
|
|
366
363
|
|
|
367
364
|
it "emits an error" do
|
|
368
|
-
message
|
|
365
|
+
message = <<-MESSAGE
|
|
369
366
|
The installed cookbooks do not contain all the recipes required by your run list(s):
|
|
370
367
|
Cookbook 'remote-cb' = 1.1.1 {:artifactserver=>"https://supermarket.example/c/remote-cb/1.1.1/download", :version=>"1.1.1"}
|
|
371
368
|
is missing the following required recipes:
|
|
@@ -384,7 +381,6 @@ MESSAGE
|
|
|
384
381
|
|
|
385
382
|
end
|
|
386
383
|
|
|
387
|
-
|
|
388
384
|
end
|
|
389
385
|
end
|
|
390
386
|
|
|
@@ -408,7 +404,7 @@ MESSAGE
|
|
|
408
404
|
it "has an empty set of solution_dependencies" do
|
|
409
405
|
expected_solution_deps = {
|
|
410
406
|
"Policyfile" => [],
|
|
411
|
-
"dependencies" => {}
|
|
407
|
+
"dependencies" => {},
|
|
412
408
|
}
|
|
413
409
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
414
410
|
end
|
|
@@ -452,13 +448,13 @@ MESSAGE
|
|
|
452
448
|
|
|
453
449
|
it "uses the community cookbook in the solution" do
|
|
454
450
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
455
|
-
expect(policyfile.graph_solution).to eq({"remote-cb" => "1.1.1"})
|
|
451
|
+
expect(policyfile.graph_solution).to eq({ "remote-cb" => "1.1.1" })
|
|
456
452
|
end
|
|
457
453
|
|
|
458
454
|
it "includes the cookbook in the solution dependencies" do
|
|
459
455
|
expected_solution_deps = {
|
|
460
456
|
"Policyfile" => [],
|
|
461
|
-
"dependencies" => { "remote-cb (1.1.1)" => [] }
|
|
457
|
+
"dependencies" => { "remote-cb (1.1.1)" => [] },
|
|
462
458
|
}
|
|
463
459
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
464
460
|
end
|
|
@@ -479,17 +475,17 @@ MESSAGE
|
|
|
479
475
|
|
|
480
476
|
it "uses the chef-server cookbook in the solution" do
|
|
481
477
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
482
|
-
expect(policyfile.graph_solution).to eq({"remote-cb" => "1.1.1"})
|
|
478
|
+
expect(policyfile.graph_solution).to eq({ "remote-cb" => "1.1.1" })
|
|
483
479
|
end
|
|
484
480
|
end
|
|
485
481
|
end
|
|
486
482
|
|
|
487
483
|
context "Given a local cookbook and only that cookbook in the run list" do
|
|
488
484
|
|
|
489
|
-
let(:run_list) { [
|
|
485
|
+
let(:run_list) { ["local-cookbook"] }
|
|
490
486
|
|
|
491
487
|
before do
|
|
492
|
-
policyfile.dsl.cookbook(
|
|
488
|
+
policyfile.dsl.cookbook("local-cookbook", path: "/foo")
|
|
493
489
|
allow(policyfile.cookbook_location_spec_for("local-cookbook")).to receive(:version).and_return("2.3.4")
|
|
494
490
|
allow(policyfile.cookbook_location_spec_for("local-cookbook")).to receive(:dependencies).and_return([])
|
|
495
491
|
allow(policyfile.cookbook_location_spec_for("local-cookbook")).to receive(:ensure_cached).and_return(true)
|
|
@@ -501,7 +497,7 @@ MESSAGE
|
|
|
501
497
|
|
|
502
498
|
it "includes the local cookbook in the artifact universe" do
|
|
503
499
|
expected_artifacts_graph = {
|
|
504
|
-
"local-cookbook" => { "2.3.4" => [] }
|
|
500
|
+
"local-cookbook" => { "2.3.4" => [] },
|
|
505
501
|
}
|
|
506
502
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
507
503
|
end
|
|
@@ -509,7 +505,7 @@ MESSAGE
|
|
|
509
505
|
it "includes the cookbook in the solution dependencies" do
|
|
510
506
|
expected_solution_deps = {
|
|
511
507
|
"Policyfile" => [ [ "local-cookbook", ">= 0.0.0" ] ],
|
|
512
|
-
"dependencies" => { "local-cookbook (2.3.4)" => [] }
|
|
508
|
+
"dependencies" => { "local-cookbook (2.3.4)" => [] },
|
|
513
509
|
}
|
|
514
510
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
515
511
|
end
|
|
@@ -518,7 +514,7 @@ MESSAGE
|
|
|
518
514
|
|
|
519
515
|
context "Given a local cookbook with a dependency and only the local cookbook in the run list" do
|
|
520
516
|
|
|
521
|
-
let(:run_list) { [
|
|
517
|
+
let(:run_list) { ["local-cookbook"] }
|
|
522
518
|
|
|
523
519
|
context "And the default source is the community site" do
|
|
524
520
|
|
|
@@ -538,14 +534,14 @@ MESSAGE
|
|
|
538
534
|
it "overrides the community site universe with the local cookbook and its dependencies" do
|
|
539
535
|
expected_artifacts_graph = external_cookbook_universe.dup
|
|
540
536
|
expected_artifacts_graph["local-cookbook"] = {
|
|
541
|
-
"2.3.4" =>
|
|
537
|
+
"2.3.4" => [ [ "local-cookbook-dep-one", "~> 1.0" ] ],
|
|
542
538
|
}
|
|
543
539
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
544
540
|
end
|
|
545
541
|
|
|
546
542
|
it "uses the local cookbook in the solution and gets dependencies remotely" do
|
|
547
543
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
548
|
-
expect(policyfile.graph_solution).to eq({"local-cookbook" => "2.3.4", "local-cookbook-dep-one" => "1.5.0"})
|
|
544
|
+
expect(policyfile.graph_solution).to eq({ "local-cookbook" => "2.3.4", "local-cookbook-dep-one" => "1.5.0" })
|
|
549
545
|
end
|
|
550
546
|
|
|
551
547
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -553,8 +549,8 @@ MESSAGE
|
|
|
553
549
|
"Policyfile" => [ [ "local-cookbook", ">= 0.0.0" ] ],
|
|
554
550
|
"dependencies" => {
|
|
555
551
|
"local-cookbook (2.3.4)" => [[ "local-cookbook-dep-one", "~> 1.0"]],
|
|
556
|
-
"local-cookbook-dep-one (1.5.0)" => []
|
|
557
|
-
}
|
|
552
|
+
"local-cookbook-dep-one (1.5.0)" => [],
|
|
553
|
+
},
|
|
558
554
|
|
|
559
555
|
}
|
|
560
556
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -582,14 +578,14 @@ MESSAGE
|
|
|
582
578
|
# cookbook with the same name and version but different deps.
|
|
583
579
|
expected_artifacts_graph = external_cookbook_universe.dup
|
|
584
580
|
expected_artifacts_graph["local-cookbook"] = {
|
|
585
|
-
"2.3.4" => [ [ "local-cookbook-dep-one", "~> 1.0" ] ]
|
|
581
|
+
"2.3.4" => [ [ "local-cookbook-dep-one", "~> 1.0" ] ],
|
|
586
582
|
}
|
|
587
583
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
588
584
|
end
|
|
589
585
|
|
|
590
586
|
it "uses the local cookbook in the solution and gets dependencies remotely" do
|
|
591
587
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
592
|
-
expect(policyfile.graph_solution).to eq({"local-cookbook" => "2.3.4", "local-cookbook-dep-one" => "1.6.0"})
|
|
588
|
+
expect(policyfile.graph_solution).to eq({ "local-cookbook" => "2.3.4", "local-cookbook-dep-one" => "1.6.0" })
|
|
593
589
|
end
|
|
594
590
|
|
|
595
591
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -597,8 +593,8 @@ MESSAGE
|
|
|
597
593
|
"Policyfile" => [ [ "local-cookbook", ">= 0.0.0" ] ],
|
|
598
594
|
"dependencies" => {
|
|
599
595
|
"local-cookbook (2.3.4)" => [[ "local-cookbook-dep-one", "~> 1.0"]],
|
|
600
|
-
"local-cookbook-dep-one (1.6.0)" => []
|
|
601
|
-
}
|
|
596
|
+
"local-cookbook-dep-one (1.6.0)" => [],
|
|
597
|
+
},
|
|
602
598
|
|
|
603
599
|
}
|
|
604
600
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -624,22 +620,22 @@ MESSAGE
|
|
|
624
620
|
|
|
625
621
|
it "includes the git-sourced cookbook in the universe graph" do
|
|
626
622
|
expected_artifacts_graph = {
|
|
627
|
-
"git-sourced-cookbook" => { "8.6.7" => [ ] }
|
|
623
|
+
"git-sourced-cookbook" => { "8.6.7" => [ ] },
|
|
628
624
|
}
|
|
629
625
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
630
626
|
end
|
|
631
627
|
|
|
632
628
|
it "uses the git sourced cookbook in the solution" do
|
|
633
629
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
634
|
-
expect(policyfile.graph_solution).to eq({"git-sourced-cookbook" => "8.6.7"})
|
|
630
|
+
expect(policyfile.graph_solution).to eq({ "git-sourced-cookbook" => "8.6.7" })
|
|
635
631
|
end
|
|
636
632
|
|
|
637
633
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
638
634
|
expected_solution_deps = {
|
|
639
635
|
"Policyfile" => [ [ "git-sourced-cookbook", ">= 0.0.0" ] ],
|
|
640
636
|
"dependencies" => {
|
|
641
|
-
"git-sourced-cookbook (8.6.7)" => []
|
|
642
|
-
}
|
|
637
|
+
"git-sourced-cookbook (8.6.7)" => [],
|
|
638
|
+
},
|
|
643
639
|
|
|
644
640
|
}
|
|
645
641
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -669,14 +665,14 @@ MESSAGE
|
|
|
669
665
|
it "overrides the community site universe with the git-sourced cookbook and deps" do
|
|
670
666
|
expected_artifacts_graph = external_cookbook_universe.dup
|
|
671
667
|
expected_artifacts_graph["git-sourced-cookbook"] = {
|
|
672
|
-
"8.6.7" => [ ["git-sourced-cookbook-dep", "~> 2.2" ] ]
|
|
668
|
+
"8.6.7" => [ ["git-sourced-cookbook-dep", "~> 2.2" ] ],
|
|
673
669
|
}
|
|
674
670
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
675
671
|
end
|
|
676
672
|
|
|
677
673
|
it "uses the git sourced cookbook with remote dependencies in the solution" do
|
|
678
674
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
679
|
-
expect(policyfile.graph_solution).to eq({"git-sourced-cookbook" => "8.6.7", "git-sourced-cookbook-dep" => "2.8.0"})
|
|
675
|
+
expect(policyfile.graph_solution).to eq({ "git-sourced-cookbook" => "8.6.7", "git-sourced-cookbook-dep" => "2.8.0" })
|
|
680
676
|
end
|
|
681
677
|
|
|
682
678
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -684,8 +680,8 @@ MESSAGE
|
|
|
684
680
|
"Policyfile" => [ [ "git-sourced-cookbook", ">= 0.0.0" ] ],
|
|
685
681
|
"dependencies" => {
|
|
686
682
|
"git-sourced-cookbook (8.6.7)" => [ [ "git-sourced-cookbook-dep", "~> 2.2" ] ],
|
|
687
|
-
"git-sourced-cookbook-dep (2.8.0)" => []
|
|
688
|
-
}
|
|
683
|
+
"git-sourced-cookbook-dep (2.8.0)" => [],
|
|
684
|
+
},
|
|
689
685
|
|
|
690
686
|
}
|
|
691
687
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -704,14 +700,14 @@ MESSAGE
|
|
|
704
700
|
it "overrides the chef server universe with the git-sourced cookbook and deps" do
|
|
705
701
|
expected_artifacts_graph = external_cookbook_universe.dup
|
|
706
702
|
expected_artifacts_graph["git-sourced-cookbook"] = {
|
|
707
|
-
"8.6.7" => [ ["git-sourced-cookbook-dep", "~> 2.2" ] ]
|
|
703
|
+
"8.6.7" => [ ["git-sourced-cookbook-dep", "~> 2.2" ] ],
|
|
708
704
|
}
|
|
709
705
|
expect(policyfile.artifacts_graph).to eq(expected_artifacts_graph)
|
|
710
706
|
end
|
|
711
707
|
|
|
712
708
|
it "uses the git sourced cookbook with remote dependencies in the solution" do
|
|
713
709
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
714
|
-
expect(policyfile.graph_solution).to eq({"git-sourced-cookbook" => "8.6.7", "git-sourced-cookbook-dep" => "2.9.0"})
|
|
710
|
+
expect(policyfile.graph_solution).to eq({ "git-sourced-cookbook" => "8.6.7", "git-sourced-cookbook-dep" => "2.9.0" })
|
|
715
711
|
end
|
|
716
712
|
|
|
717
713
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -719,8 +715,8 @@ MESSAGE
|
|
|
719
715
|
"Policyfile" => [ [ "git-sourced-cookbook", ">= 0.0.0" ] ],
|
|
720
716
|
"dependencies" => {
|
|
721
717
|
"git-sourced-cookbook (8.6.7)" => [ [ "git-sourced-cookbook-dep", "~> 2.2" ] ],
|
|
722
|
-
"git-sourced-cookbook-dep (2.9.0)" => []
|
|
723
|
-
}
|
|
718
|
+
"git-sourced-cookbook-dep (2.9.0)" => [],
|
|
719
|
+
},
|
|
724
720
|
|
|
725
721
|
}
|
|
726
722
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -731,7 +727,7 @@ MESSAGE
|
|
|
731
727
|
|
|
732
728
|
context "Given a local cookbook with a run list containing the local cookbook and another cookbook" do
|
|
733
729
|
|
|
734
|
-
let(:run_list) { [
|
|
730
|
+
let(:run_list) { ["local-cookbook", "remote-cb"] }
|
|
735
731
|
|
|
736
732
|
before do
|
|
737
733
|
policyfile.dsl.cookbook("local-cookbook", path: "foo/")
|
|
@@ -756,7 +752,7 @@ MESSAGE
|
|
|
756
752
|
|
|
757
753
|
it "uses the locally specified cookbook and remote cookbooks in the solution" do
|
|
758
754
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
759
|
-
expect(policyfile.graph_solution).to eq({"local-cookbook" => "2.3.4", "remote-cb" => "1.1.1"})
|
|
755
|
+
expect(policyfile.graph_solution).to eq({ "local-cookbook" => "2.3.4", "remote-cb" => "1.1.1" })
|
|
760
756
|
end
|
|
761
757
|
|
|
762
758
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -764,8 +760,8 @@ MESSAGE
|
|
|
764
760
|
"Policyfile" => [ [ "local-cookbook", ">= 0.0.0" ] ],
|
|
765
761
|
"dependencies" => {
|
|
766
762
|
"local-cookbook (2.3.4)" => [],
|
|
767
|
-
"remote-cb (1.1.1)" => []
|
|
768
|
-
}
|
|
763
|
+
"remote-cb (1.1.1)" => [],
|
|
764
|
+
},
|
|
769
765
|
|
|
770
766
|
}
|
|
771
767
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -789,7 +785,7 @@ MESSAGE
|
|
|
789
785
|
|
|
790
786
|
it "uses the locally specified cookbook and remote cookbooks in the solution" do
|
|
791
787
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
792
|
-
expect(policyfile.graph_solution).to eq({"local-cookbook" => "2.3.4", "remote-cb" => "1.1.1"})
|
|
788
|
+
expect(policyfile.graph_solution).to eq({ "local-cookbook" => "2.3.4", "remote-cb" => "1.1.1" })
|
|
793
789
|
end
|
|
794
790
|
|
|
795
791
|
it "includes the cookbook and dependencies in the solution dependencies" do
|
|
@@ -797,8 +793,8 @@ MESSAGE
|
|
|
797
793
|
"Policyfile" => [ [ "local-cookbook", ">= 0.0.0" ] ],
|
|
798
794
|
"dependencies" => {
|
|
799
795
|
"local-cookbook (2.3.4)" => [],
|
|
800
|
-
"remote-cb (1.1.1)" => []
|
|
801
|
-
}
|
|
796
|
+
"remote-cb (1.1.1)" => [],
|
|
797
|
+
},
|
|
802
798
|
|
|
803
799
|
}
|
|
804
800
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -811,7 +807,7 @@ MESSAGE
|
|
|
811
807
|
|
|
812
808
|
include_context "community default source"
|
|
813
809
|
|
|
814
|
-
let(:run_list) { [
|
|
810
|
+
let(:run_list) { ["remote-cb"] }
|
|
815
811
|
|
|
816
812
|
before do
|
|
817
813
|
policyfile.dsl.cookbook("remote-cb", "~> 0.1")
|
|
@@ -823,15 +819,15 @@ MESSAGE
|
|
|
823
819
|
|
|
824
820
|
it "emits a solution that satisfies the policyfile constraint" do
|
|
825
821
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
826
|
-
expect(policyfile.graph_solution).to eq({"remote-cb" => "0.1.0"})
|
|
822
|
+
expect(policyfile.graph_solution).to eq({ "remote-cb" => "0.1.0" })
|
|
827
823
|
end
|
|
828
824
|
|
|
829
825
|
it "includes the policyfile constraint in the solution dependencies" do
|
|
830
826
|
expected_solution_deps = {
|
|
831
827
|
"Policyfile" => [ [ "remote-cb", "~> 0.1" ] ],
|
|
832
828
|
"dependencies" => {
|
|
833
|
-
"remote-cb (0.1.0)" => []
|
|
834
|
-
}
|
|
829
|
+
"remote-cb (0.1.0)" => [],
|
|
830
|
+
},
|
|
835
831
|
|
|
836
832
|
}
|
|
837
833
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -842,7 +838,7 @@ MESSAGE
|
|
|
842
838
|
|
|
843
839
|
include_context "community default source"
|
|
844
840
|
|
|
845
|
-
let(:run_list) { [
|
|
841
|
+
let(:run_list) { ["local-cookbook"] }
|
|
846
842
|
|
|
847
843
|
before do
|
|
848
844
|
policyfile.dsl.cookbook("remote-cb", "~> 0.1")
|
|
@@ -860,7 +856,7 @@ MESSAGE
|
|
|
860
856
|
|
|
861
857
|
it "emits a solution that satisfies the policyfile constraint" do
|
|
862
858
|
expect(policyfile).to receive(:ensure_cache_dir_exists)
|
|
863
|
-
expect(policyfile.graph_solution).to eq({"local-cookbook" => "2.3.4", "remote-cb" => "0.1.0"})
|
|
859
|
+
expect(policyfile.graph_solution).to eq({ "local-cookbook" => "2.3.4", "remote-cb" => "0.1.0" })
|
|
864
860
|
end
|
|
865
861
|
|
|
866
862
|
it "includes the policyfile constraint in the solution dependencies" do
|
|
@@ -868,8 +864,8 @@ MESSAGE
|
|
|
868
864
|
"Policyfile" => [ [ "remote-cb", "~> 0.1" ], [ "local-cookbook", ">= 0.0.0"] ],
|
|
869
865
|
"dependencies" => {
|
|
870
866
|
"local-cookbook (2.3.4)" => [],
|
|
871
|
-
"remote-cb (0.1.0)" => []
|
|
872
|
-
}
|
|
867
|
+
"remote-cb (0.1.0)" => [],
|
|
868
|
+
},
|
|
873
869
|
|
|
874
870
|
}
|
|
875
871
|
expect(policyfile.solution_dependencies.to_lock).to eq(expected_solution_deps)
|
|
@@ -879,9 +875,9 @@ MESSAGE
|
|
|
879
875
|
context "Given a run_list and named run_lists" do
|
|
880
876
|
|
|
881
877
|
before do
|
|
882
|
-
policyfile.dsl.named_run_list(:foo,
|
|
883
|
-
policyfile.dsl.named_run_list(:bar,
|
|
884
|
-
policyfile.dsl.run_list(
|
|
878
|
+
policyfile.dsl.named_run_list(:foo, "local-cookbook", "nginx")
|
|
879
|
+
policyfile.dsl.named_run_list(:bar, "remote-cb", "nginx")
|
|
880
|
+
policyfile.dsl.run_list("private-cookbook", "nginx")
|
|
885
881
|
end
|
|
886
882
|
|
|
887
883
|
it "demands a solution that satisfies all of the run lists, with no duplicates" do
|
|
@@ -904,7 +900,7 @@ MESSAGE
|
|
|
904
900
|
|
|
905
901
|
include_context "community default source"
|
|
906
902
|
|
|
907
|
-
let(:run_list) { [
|
|
903
|
+
let(:run_list) { [ "repo-cookbook-one", "remote-cb", "remote-cb-two" ] }
|
|
908
904
|
|
|
909
905
|
before do
|
|
910
906
|
policyfile.default_source(:chef_repo, "path/to/repo")
|
|
@@ -921,16 +917,16 @@ MESSAGE
|
|
|
921
917
|
let(:repo_cookbook_universe) do
|
|
922
918
|
{
|
|
923
919
|
"repo-cookbook-one" => {
|
|
924
|
-
"1.0.0" => [ ]
|
|
920
|
+
"1.0.0" => [ ],
|
|
925
921
|
},
|
|
926
922
|
|
|
927
923
|
"repo-cookbook-two" => {
|
|
928
|
-
"9.9.9" => [ ["repo-cookbook-on-community-dep", "= 1.0.0"] ]
|
|
924
|
+
"9.9.9" => [ ["repo-cookbook-on-community-dep", "= 1.0.0"] ],
|
|
929
925
|
},
|
|
930
926
|
|
|
931
927
|
"private-cookbook" => {
|
|
932
|
-
"0.1.0" => [ ]
|
|
933
|
-
}
|
|
928
|
+
"0.1.0" => [ ],
|
|
929
|
+
},
|
|
934
930
|
}
|
|
935
931
|
end
|
|
936
932
|
|
|
@@ -942,7 +938,7 @@ MESSAGE
|
|
|
942
938
|
end
|
|
943
939
|
|
|
944
940
|
it "solves the graph demands using cookbooks from both sources" do
|
|
945
|
-
expected = {"repo-cookbook-one" => "1.0.0", "remote-cb" => "1.1.1", "remote-cb-two" => "1.1.1"}
|
|
941
|
+
expected = { "repo-cookbook-one" => "1.0.0", "remote-cb" => "1.1.1", "remote-cb-two" => "1.1.1" }
|
|
946
942
|
expect(policyfile.graph_solution).to eq(expected)
|
|
947
943
|
end
|
|
948
944
|
|
|
@@ -976,7 +972,6 @@ MESSAGE
|
|
|
976
972
|
with("repo-cookbook-one", "1.0.0").
|
|
977
973
|
and_return(expected_repo_options)
|
|
978
974
|
|
|
979
|
-
|
|
980
975
|
repo_cb_location = policyfile.create_spec_for_cookbook("repo-cookbook-one", "1.0.0")
|
|
981
976
|
expect(repo_cb_location.source_options).to eq(expected_repo_options)
|
|
982
977
|
|
|
@@ -998,15 +993,15 @@ MESSAGE
|
|
|
998
993
|
let(:repo_cookbook_universe) do
|
|
999
994
|
{
|
|
1000
995
|
"repo-cookbook-one" => {
|
|
1001
|
-
"1.0.0" => [ ]
|
|
996
|
+
"1.0.0" => [ ],
|
|
1002
997
|
},
|
|
1003
998
|
|
|
1004
999
|
"repo-cookbook-two" => {
|
|
1005
|
-
"9.9.9" => [ ["repo-cookbook-on-community-dep", "= 1.0.0"] ]
|
|
1000
|
+
"9.9.9" => [ ["repo-cookbook-on-community-dep", "= 1.0.0"] ],
|
|
1006
1001
|
},
|
|
1007
1002
|
|
|
1008
1003
|
"private-cookbook" => {
|
|
1009
|
-
"0.1.0" => [ ]
|
|
1004
|
+
"0.1.0" => [ ],
|
|
1010
1005
|
},
|
|
1011
1006
|
|
|
1012
1007
|
# NOTE: cookbooks are considered to conflict when both sources have
|
|
@@ -1021,12 +1016,12 @@ MESSAGE
|
|
|
1021
1016
|
# This makes the compiler take a slightly different code path than if
|
|
1022
1017
|
# the cookbook was just in the dep graphs.
|
|
1023
1018
|
"remote-cb" => {
|
|
1024
|
-
"99.99.99" => [ ]
|
|
1019
|
+
"99.99.99" => [ ],
|
|
1025
1020
|
},
|
|
1026
1021
|
|
|
1027
1022
|
# This also conflicts, but only via the graphs
|
|
1028
1023
|
"remote-cb-two" => {
|
|
1029
|
-
"1.2.3" => [ ]
|
|
1024
|
+
"1.2.3" => [ ],
|
|
1030
1025
|
},
|
|
1031
1026
|
|
|
1032
1027
|
# This has a dependency on a conflicting cookbook
|
|
@@ -1037,16 +1032,16 @@ MESSAGE
|
|
|
1037
1032
|
# inspection of the graph, so the expected behavior is to error if
|
|
1038
1033
|
# any possible solution could have a conflict.
|
|
1039
1034
|
"1.0.0" => [ ["remote-cb-two", ">= 0.0.0" ] ],
|
|
1040
|
-
"2.0.0" => [ ]
|
|
1035
|
+
"2.0.0" => [ ],
|
|
1041
1036
|
|
|
1042
|
-
}
|
|
1037
|
+
},
|
|
1043
1038
|
|
|
1044
1039
|
}
|
|
1045
1040
|
end
|
|
1046
1041
|
|
|
1047
1042
|
context "and the conflicting cookbook is in the run list" do
|
|
1048
1043
|
|
|
1049
|
-
let(:run_list) { [
|
|
1044
|
+
let(:run_list) { [ "repo-cookbook-one", "remote-cb", "remote-cb-two" ] }
|
|
1050
1045
|
|
|
1051
1046
|
context "and no explicit source is given for the conflicting cookbook" do
|
|
1052
1047
|
|
|
@@ -1109,25 +1104,25 @@ ERROR
|
|
|
1109
1104
|
{
|
|
1110
1105
|
"remote-cb" => {
|
|
1111
1106
|
"1.1.1" => {
|
|
1112
|
-
"download_url" => "https://supermarket.chef.io/api/v1/cookbooks/remote-cb/versions/1.1.1/download"
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1107
|
+
"download_url" => "https://supermarket.chef.io/api/v1/cookbooks/remote-cb/versions/1.1.1/download",
|
|
1108
|
+
},
|
|
1109
|
+
},
|
|
1115
1110
|
}
|
|
1116
1111
|
end
|
|
1117
1112
|
|
|
1118
1113
|
let(:cookbook_version_paths) do
|
|
1119
1114
|
{
|
|
1120
1115
|
"remote-cb-two" => {
|
|
1121
|
-
"1.1.1" => "path/to/repo/remote-cb-two"
|
|
1122
|
-
}
|
|
1116
|
+
"1.1.1" => "path/to/repo/remote-cb-two",
|
|
1117
|
+
},
|
|
1123
1118
|
}
|
|
1124
1119
|
end
|
|
1125
1120
|
|
|
1126
1121
|
before do
|
|
1127
|
-
community_source.preferred_for
|
|
1122
|
+
community_source.preferred_for "remote-cb"
|
|
1128
1123
|
allow(community_source).to receive(:full_community_graph).and_return(full_universe_graph)
|
|
1129
1124
|
allow(repo_source).to receive(:cookbook_version_paths).and_return(cookbook_version_paths)
|
|
1130
|
-
repo_source.preferred_for
|
|
1125
|
+
repo_source.preferred_for "remote-cb-two"
|
|
1131
1126
|
end
|
|
1132
1127
|
|
|
1133
1128
|
it "solves the graph" do
|
|
@@ -1137,14 +1132,14 @@ ERROR
|
|
|
1137
1132
|
it "assigns the correct source options to the cookbook" do
|
|
1138
1133
|
expected_remote_cb_source_opts = {
|
|
1139
1134
|
artifactserver: "https://supermarket.chef.io/api/v1/cookbooks/remote-cb/versions/1.1.1/download",
|
|
1140
|
-
version: "1.1.1"
|
|
1135
|
+
version: "1.1.1",
|
|
1141
1136
|
}
|
|
1142
1137
|
actual_remote_cb_source_opts = policyfile.create_spec_for_cookbook("remote-cb", "1.1.1").source_options
|
|
1143
1138
|
expect(actual_remote_cb_source_opts).to eq(expected_remote_cb_source_opts)
|
|
1144
1139
|
|
|
1145
1140
|
expected_remote_cb_two_source_opts = {
|
|
1146
1141
|
path: "path/to/repo/remote-cb-two",
|
|
1147
|
-
version: "1.1.1"
|
|
1142
|
+
version: "1.1.1",
|
|
1148
1143
|
}
|
|
1149
1144
|
actual_remote_cb_two_source_opts = policyfile.create_spec_for_cookbook("remote-cb-two", "1.1.1").source_options
|
|
1150
1145
|
expect(actual_remote_cb_two_source_opts).to eq(expected_remote_cb_two_source_opts)
|
|
@@ -1181,7 +1176,7 @@ ERROR
|
|
|
1181
1176
|
|
|
1182
1177
|
context "when the conflicting cookbook could not be in the solution set" do
|
|
1183
1178
|
|
|
1184
|
-
let(:run_list) { [
|
|
1179
|
+
let(:run_list) { [ "local_cookbook" ] }
|
|
1185
1180
|
|
|
1186
1181
|
it "creates the merged graph without error" do
|
|
1187
1182
|
expect { policyfile.remote_artifacts_graph }.to_not raise_error
|
|
@@ -1195,7 +1190,6 @@ ERROR
|
|
|
1195
1190
|
|
|
1196
1191
|
end
|
|
1197
1192
|
|
|
1198
|
-
|
|
1199
1193
|
end
|
|
1200
1194
|
|
|
1201
1195
|
end
|