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.
- 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
data/spec/unit/pager_spec.rb
CHANGED
@@ -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/pager"
|
20
20
|
|
21
21
|
describe ChefDK::Pager do
|
22
22
|
|
@@ -34,7 +34,7 @@ describe ChefDK::Pager do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "enables paging" do
|
37
|
-
expect(pager).to receive(:env).and_return({"PAGER" => "less"})
|
37
|
+
expect(pager).to receive(:env).and_return({ "PAGER" => "less" })
|
38
38
|
expect(pager).to receive(:have_tty?).and_return(true)
|
39
39
|
expect(pager.pager_enabled?).to be(true)
|
40
40
|
end
|
@@ -44,7 +44,7 @@ describe ChefDK::Pager do
|
|
44
44
|
|
45
45
|
subject(:pager) do
|
46
46
|
ChefDK::Pager.new(enable_pager: true).tap do |p|
|
47
|
-
allow(p).to receive(:env).and_return({"PAGER" => "less"})
|
47
|
+
allow(p).to receive(:env).and_return({ "PAGER" => "less" })
|
48
48
|
allow(p).to receive(:have_tty?).and_return(true)
|
49
49
|
end
|
50
50
|
end
|
@@ -85,7 +85,7 @@ describe ChefDK::Pager do
|
|
85
85
|
|
86
86
|
subject(:pager) do
|
87
87
|
ChefDK::Pager.new(enable_pager: false).tap do |p|
|
88
|
-
allow(p).to receive(:env).and_return({"PAGER" => "less"})
|
88
|
+
allow(p).to receive(:env).and_return({ "PAGER" => "less" })
|
89
89
|
allow(p).to receive(:have_tty?).and_return(true)
|
90
90
|
end
|
91
91
|
end
|
@@ -94,7 +94,6 @@ describe ChefDK::Pager do
|
|
94
94
|
expect(IO).to_not receive(:pipe)
|
95
95
|
end
|
96
96
|
|
97
|
-
|
98
97
|
it "provides a UI with stdout set to stdout" do
|
99
98
|
expect(pager.ui.out_stream).to eq($stdout)
|
100
99
|
end
|
@@ -116,4 +115,3 @@ describe ChefDK::Pager do
|
|
116
115
|
|
117
116
|
end
|
118
117
|
end
|
119
|
-
|
@@ -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/chef_repo_cookbook_source"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::ChefRepoCookbookSource do
|
22
22
|
|
@@ -28,17 +28,17 @@ describe ChefDK::Policyfile::ChefRepoCookbookSource do
|
|
28
28
|
|
29
29
|
let(:local_repo_universe) {
|
30
30
|
{
|
31
|
-
"another-local-cookbook"=>{
|
32
|
-
"0.1.0"=>[],
|
31
|
+
"another-local-cookbook" => {
|
32
|
+
"0.1.0" => [],
|
33
33
|
},
|
34
|
-
"local-cookbook"=>{
|
35
|
-
"2.3.4"=>[],
|
34
|
+
"local-cookbook" => {
|
35
|
+
"2.3.4" => [],
|
36
36
|
},
|
37
|
-
"cookbook-with-a-dep"=>{
|
38
|
-
"9.9.9"=>[["another-local-cookbook", "~> 0.1"]],
|
37
|
+
"cookbook-with-a-dep" => {
|
38
|
+
"9.9.9" => [["another-local-cookbook", "~> 0.1"]],
|
39
39
|
},
|
40
|
-
"noignore"=>{
|
41
|
-
"0.1.0"=>[],
|
40
|
+
"noignore" => {
|
41
|
+
"0.1.0" => [],
|
42
42
|
},
|
43
43
|
}
|
44
44
|
}
|
@@ -78,7 +78,7 @@ describe ChefDK::Policyfile::ChefRepoCookbookSource do
|
|
78
78
|
end
|
79
79
|
|
80
80
|
it "sets the source preferences as given" do
|
81
|
-
expect(cookbook_source.preferred_cookbooks).to eq( %w
|
81
|
+
expect(cookbook_source.preferred_cookbooks).to eq( %w{ foo bar baz } )
|
82
82
|
end
|
83
83
|
|
84
84
|
it "is the preferred source for the requested cookbooks" do
|
@@ -15,41 +15,41 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/policyfile/chef_server_cookbook_source"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::ChefServerCookbookSource do
|
22
22
|
subject { described_class.new(cookbook_source) }
|
23
23
|
|
24
|
-
let(:cookbook_source) {
|
24
|
+
let(:cookbook_source) { "https://chef.example.com/organizations/example" }
|
25
25
|
|
26
|
-
let(:http_connection) { double(
|
26
|
+
let(:http_connection) { double("ChefDK::AuthenticatedHTTP") }
|
27
27
|
|
28
|
-
let(:universe_response_encoded) { JSON.parse(IO.read(File.join(fixtures_path,
|
28
|
+
let(:universe_response_encoded) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/chef_server_universe.json"))) }
|
29
29
|
|
30
30
|
let(:pruned_universe) { JSON.parse(IO.read(File.join(fixtures_path, "cookbooks_api/pruned_chef_server_universe.json"))) }
|
31
31
|
|
32
|
-
describe
|
32
|
+
describe "fetching the Universe graph" do
|
33
33
|
|
34
34
|
before do
|
35
35
|
expect(subject).to receive(:http_connection_for).with(cookbook_source).and_return(http_connection)
|
36
36
|
end
|
37
37
|
|
38
|
-
it
|
39
|
-
expect(http_connection).to receive(:get).with(
|
38
|
+
it "fetches the universe graph" do
|
39
|
+
expect(http_connection).to receive(:get).with("/universe").and_return(universe_response_encoded)
|
40
40
|
actual_universe = subject.universe_graph
|
41
|
-
expect(actual_universe).to have_key(
|
42
|
-
expect(actual_universe[
|
41
|
+
expect(actual_universe).to have_key("apt")
|
42
|
+
expect(actual_universe["apt"]).to eq(pruned_universe["apt"])
|
43
43
|
expect(subject.universe_graph).to eq(pruned_universe)
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
46
|
+
it "generates location options for a cookbook from the given graph" do
|
47
47
|
expected_opts = {
|
48
48
|
chef_server: "https://chef.example.com/organizations/example",
|
49
49
|
http_client: http_connection,
|
50
|
-
version: "4.2.3"
|
50
|
+
version: "4.2.3",
|
51
51
|
}
|
52
|
-
expect(subject.source_options_for(
|
52
|
+
expect(subject.source_options_for("ohai", "4.2.3")).to eq(expected_opts)
|
53
53
|
end
|
54
54
|
end
|
55
55
|
end
|
@@ -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/community_cookbook_source"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::CommunityCookbookSource do
|
22
22
|
|
@@ -68,7 +68,7 @@ describe ChefDK::Policyfile::CommunityCookbookSource do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
it "sets the source preferences as given" do
|
71
|
-
expect(cookbook_source.preferred_cookbooks).to eq( %w
|
71
|
+
expect(cookbook_source.preferred_cookbooks).to eq( %w{ foo bar baz } )
|
72
72
|
end
|
73
73
|
|
74
74
|
it "is the preferred source for the requested cookbooks" do
|
@@ -81,4 +81,3 @@ describe ChefDK::Policyfile::CommunityCookbookSource do
|
|
81
81
|
end
|
82
82
|
|
83
83
|
end
|
84
|
-
|
@@ -15,13 +15,13 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "spec_helper"
|
19
|
+
require "chef-dk/policyfile/comparison_base"
|
20
20
|
|
21
21
|
describe "Policyfile Comparison Bases" do
|
22
22
|
|
23
23
|
let(:minimal_lockfile_json) do
|
24
|
-
|
24
|
+
<<-E
|
25
25
|
{
|
26
26
|
"revision_id": "6fe753184c8946052d3231bb4212116df28d89a3a5f7ae52832ad408419dd5eb",
|
27
27
|
"name": "install-example",
|
@@ -308,10 +308,8 @@ E
|
|
308
308
|
expect(exception).to_not be_nil
|
309
309
|
end
|
310
310
|
|
311
|
-
|
312
311
|
end
|
313
312
|
|
314
|
-
|
315
313
|
context "when a non-HTTP error occurs fetching the policyfile lock" do
|
316
314
|
|
317
315
|
before do
|
@@ -340,4 +338,3 @@ E
|
|
340
338
|
|
341
339
|
end
|
342
340
|
end
|
343
|
-
|
@@ -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/cookbook_location_specification"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::CookbookLocationSpecification do
|
22
22
|
|
@@ -64,7 +64,7 @@ describe ChefDK::Policyfile::CookbookLocationSpecification do
|
|
64
64
|
different_constraint = described_class.new(cookbook_name, ">= 1.0.0", source_options, storage_config)
|
65
65
|
expect(cookbook_location_spec).to_not eq(different_constraint)
|
66
66
|
|
67
|
-
different_opts = described_class.new(cookbook_name, version_constraint, {git: "git://example.com/wat.git"}, storage_config)
|
67
|
+
different_opts = described_class.new(cookbook_name, version_constraint, { git: "git://example.com/wat.git" }, storage_config)
|
68
68
|
expect(cookbook_location_spec).to_not eq(different_opts)
|
69
69
|
end
|
70
70
|
|
@@ -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/cookbook_locks"
|
20
20
|
|
21
21
|
shared_examples_for "Cookbook Lock" do
|
22
22
|
|
@@ -125,7 +125,7 @@ shared_examples_for "Cookbook Lock" do
|
|
125
125
|
"version" => "1.2.3",
|
126
126
|
"source_options" => { "sourcekey" => "location info" },
|
127
127
|
"cache_key" => nil,
|
128
|
-
"source" => "cookbooks_local_path"
|
128
|
+
"source" => "cookbooks_local_path",
|
129
129
|
}
|
130
130
|
end
|
131
131
|
|
@@ -152,7 +152,6 @@ shared_examples_for "Cookbook Lock" do
|
|
152
152
|
|
153
153
|
end
|
154
154
|
|
155
|
-
|
156
155
|
describe ChefDK::Policyfile::CachedCookbook do
|
157
156
|
|
158
157
|
let(:cookbook_name) { "nginx" }
|
@@ -318,9 +317,9 @@ describe ChefDK::Policyfile::LocalCookbook do
|
|
318
317
|
"version" => "1.2.3",
|
319
318
|
"source" => "../my_repo/nginx",
|
320
319
|
"source_options" => {
|
321
|
-
"path" => "../my_repo/nginx"
|
320
|
+
"path" => "../my_repo/nginx",
|
322
321
|
},
|
323
|
-
"cache_key" => nil
|
322
|
+
"cache_key" => nil,
|
324
323
|
}
|
325
324
|
end
|
326
325
|
|
@@ -450,10 +449,10 @@ describe ChefDK::Policyfile::ArchivedCookbook do
|
|
450
449
|
# when getting the cookbook location spec, source options needs to have
|
451
450
|
# symbolic keys, so a round trip via LocalCookbook#build_from_lock_data
|
452
451
|
# will result in this being a symbol
|
453
|
-
:path => "../my_repo/nginx"
|
452
|
+
:path => "../my_repo/nginx",
|
454
453
|
},
|
455
454
|
"cache_key" => nil,
|
456
|
-
"scm_info" => {}
|
455
|
+
"scm_info" => {},
|
457
456
|
}
|
458
457
|
end
|
459
458
|
|
@@ -523,7 +522,6 @@ describe ChefDK::Policyfile::ArchivedCookbook do
|
|
523
522
|
expect(cookbook_lock.to_lock).to eq(wrapped_cookbook_lock_data)
|
524
523
|
end
|
525
524
|
|
526
|
-
|
527
525
|
end
|
528
526
|
|
529
527
|
end
|
@@ -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/delivery_supermarket_source"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::DeliverySupermarketSource do
|
22
22
|
|
@@ -37,16 +37,16 @@ describe ChefDK::Policyfile::DeliverySupermarketSource do
|
|
37
37
|
"build-essential" => "~> 2.0.0",
|
38
38
|
"ohai" => "~> 2.0.0",
|
39
39
|
"runit" => "~> 1.2.0",
|
40
|
-
"yum-epel" => "~> 0.3.0"
|
41
|
-
}
|
40
|
+
"yum-epel" => "~> 0.3.0",
|
41
|
+
},
|
42
42
|
},
|
43
43
|
"mysql" => {
|
44
44
|
"5.3.6" => {
|
45
|
-
"yum-mysql-community" => ">= 0.0.0"
|
46
|
-
}
|
45
|
+
"yum-mysql-community" => ">= 0.0.0",
|
46
|
+
},
|
47
47
|
},
|
48
48
|
"application" => {
|
49
|
-
"4.1.4" => {}
|
49
|
+
"4.1.4" => {},
|
50
50
|
},
|
51
51
|
"database" => {
|
52
52
|
"2.2.0" => {
|
@@ -54,25 +54,25 @@ describe ChefDK::Policyfile::DeliverySupermarketSource do
|
|
54
54
|
"postgresql" => ">= 1.0.0",
|
55
55
|
"aws" => ">= 0.0.0",
|
56
56
|
"xfs" => ">= 0.0.0",
|
57
|
-
"mysql-chef_gem" => ">= 0.0.0"
|
58
|
-
}
|
57
|
+
"mysql-chef_gem" => ">= 0.0.0",
|
58
|
+
},
|
59
59
|
},
|
60
60
|
"postgresql" => {
|
61
61
|
"3.4.1" => {
|
62
62
|
"apt" => ">= 1.9.0",
|
63
63
|
"build-essential" => ">= 0.0.0",
|
64
|
-
"openssl" => ">= 0.0.0"
|
65
|
-
}
|
64
|
+
"openssl" => ">= 0.0.0",
|
65
|
+
},
|
66
66
|
},
|
67
67
|
"apache2" => {
|
68
68
|
"1.10.4" => {
|
69
69
|
"iptables" => ">= 0.0.0",
|
70
70
|
"logrotate" => ">= 0.0.0",
|
71
|
-
"pacman" => ">= 0.0.0"
|
72
|
-
}
|
71
|
+
"pacman" => ">= 0.0.0",
|
72
|
+
},
|
73
73
|
},
|
74
|
-
"apt" => { "2.4.0" => {}},
|
75
|
-
"yum" => { "3.2.2" => {}}
|
74
|
+
"apt" => { "2.4.0" => {} },
|
75
|
+
"yum" => { "3.2.2" => {} },
|
76
76
|
}
|
77
77
|
end
|
78
78
|
|
@@ -114,7 +114,7 @@ describe ChefDK::Policyfile::DeliverySupermarketSource do
|
|
114
114
|
end
|
115
115
|
|
116
116
|
it "sets the source preferences as given" do
|
117
|
-
expect(cookbook_source.preferred_cookbooks).to eq( %w
|
117
|
+
expect(cookbook_source.preferred_cookbooks).to eq( %w{ foo bar baz } )
|
118
118
|
end
|
119
119
|
|
120
120
|
it "is the preferred source for the requested cookbooks" do
|
@@ -127,4 +127,3 @@ describe ChefDK::Policyfile::DeliverySupermarketSource do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
end
|
130
|
-
|
@@ -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/differ"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::Differ do
|
22
22
|
|
@@ -469,8 +469,8 @@ E
|
|
469
469
|
"origin" => "https://supermarket.chef.io/api/v1/cookbooks/bluepill/versions/2.3.2/download",
|
470
470
|
"source_options" => {
|
471
471
|
"artifactserver" => "https://supermarket.chef.io/api/v1/cookbooks/bluepill/versions/2.3.2/download",
|
472
|
-
"version" => "2.3.2"
|
473
|
-
}
|
472
|
+
"version" => "2.3.2",
|
473
|
+
},
|
474
474
|
}
|
475
475
|
end
|
476
476
|
|
@@ -684,4 +684,3 @@ E
|
|
684
684
|
end
|
685
685
|
|
686
686
|
end
|
687
|
-
|
@@ -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/lister"
|
20
20
|
|
21
21
|
describe ChefDK::Policyfile::Lister do
|
22
22
|
|
@@ -24,7 +24,6 @@ describe ChefDK::Policyfile::Lister do
|
|
24
24
|
"https://chef.example/organizations/myorg/#{org_specific_path}"
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
27
|
let(:config) do
|
29
28
|
double("Chef::Config",
|
30
29
|
chef_server_url: "https://localhost:10443",
|
@@ -45,7 +44,6 @@ describe ChefDK::Policyfile::Lister do
|
|
45
44
|
info_fetcher.http_client
|
46
45
|
end
|
47
46
|
|
48
|
-
|
49
47
|
context "when the data is fetched successfully from the server" do
|
50
48
|
|
51
49
|
before do
|
@@ -89,8 +87,8 @@ describe ChefDK::Policyfile::Lister do
|
|
89
87
|
"1111111111111111111111111111111111111111" => {},
|
90
88
|
"2222222222222222222222222222222222222222" => {},
|
91
89
|
"3333333333333333333333333333333333333333" => {},
|
92
|
-
"4444444444444444444444444444444444444444" => {}
|
93
|
-
}
|
90
|
+
"4444444444444444444444444444444444444444" => {},
|
91
|
+
},
|
94
92
|
},
|
95
93
|
"db" => {
|
96
94
|
"uri" => api_url("policies/db"),
|
@@ -98,16 +96,16 @@ describe ChefDK::Policyfile::Lister do
|
|
98
96
|
"6666666666666666666666666666666666666666" => {},
|
99
97
|
"7777777777777777777777777777777777777777" => {},
|
100
98
|
"8888888888888888888888888888888888888888" => {},
|
101
|
-
"9999999999999999999999999999999999999999" => {}
|
102
|
-
}
|
99
|
+
"9999999999999999999999999999999999999999" => {},
|
100
|
+
},
|
103
101
|
},
|
104
102
|
"cache" => {
|
105
103
|
"uri" => api_url("policies/cache"),
|
106
104
|
"revisions" => {
|
107
105
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" => {},
|
108
|
-
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => {}
|
109
|
-
}
|
110
|
-
}
|
106
|
+
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => {},
|
107
|
+
},
|
108
|
+
},
|
111
109
|
}
|
112
110
|
end
|
113
111
|
|
@@ -117,8 +115,8 @@ describe ChefDK::Policyfile::Lister do
|
|
117
115
|
"policies" => {
|
118
116
|
"db" => { "revision_id" => "6666666666666666666666666666666666666666" },
|
119
117
|
"appserver" => { "revision_id" => "1111111111111111111111111111111111111111" },
|
120
|
-
"cache" => { "revision_id" => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" }
|
121
|
-
}
|
118
|
+
"cache" => { "revision_id" => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" },
|
119
|
+
},
|
122
120
|
}
|
123
121
|
end
|
124
122
|
|
@@ -128,8 +126,8 @@ describe ChefDK::Policyfile::Lister do
|
|
128
126
|
"policies" => {
|
129
127
|
"db" => { "revision_id" => "7777777777777777777777777777777777777777" },
|
130
128
|
"appserver" => { "revision_id" => "2222222222222222222222222222222222222222" },
|
131
|
-
"cache" => { "revision_id" => "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" }
|
132
|
-
}
|
129
|
+
"cache" => { "revision_id" => "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" },
|
130
|
+
},
|
133
131
|
}
|
134
132
|
end
|
135
133
|
|
@@ -138,8 +136,8 @@ describe ChefDK::Policyfile::Lister do
|
|
138
136
|
"uri" => api_url("policy_groups/prod"),
|
139
137
|
"policies" => {
|
140
138
|
"db" => { "revision_id" => "8888888888888888888888888888888888888888" },
|
141
|
-
"appserver" => { "revision_id" => "3333333333333333333333333333333333333333" }
|
142
|
-
}
|
139
|
+
"appserver" => { "revision_id" => "3333333333333333333333333333333333333333" },
|
140
|
+
},
|
143
141
|
}
|
144
142
|
end
|
145
143
|
|
@@ -147,7 +145,7 @@ describe ChefDK::Policyfile::Lister do
|
|
147
145
|
{
|
148
146
|
"dev" => dev_group_data,
|
149
147
|
"test" => test_group_data,
|
150
|
-
"prod" => prod_group_data
|
148
|
+
"prod" => prod_group_data,
|
151
149
|
}
|
152
150
|
end
|
153
151
|
|
@@ -157,18 +155,18 @@ describe ChefDK::Policyfile::Lister do
|
|
157
155
|
"1111111111111111111111111111111111111111" => {},
|
158
156
|
"2222222222222222222222222222222222222222" => {},
|
159
157
|
"3333333333333333333333333333333333333333" => {},
|
160
|
-
"4444444444444444444444444444444444444444" => {}
|
158
|
+
"4444444444444444444444444444444444444444" => {},
|
161
159
|
},
|
162
160
|
"db" => {
|
163
161
|
"6666666666666666666666666666666666666666" => {},
|
164
162
|
"7777777777777777777777777777777777777777" => {},
|
165
163
|
"8888888888888888888888888888888888888888" => {},
|
166
|
-
"9999999999999999999999999999999999999999" => {}
|
164
|
+
"9999999999999999999999999999999999999999" => {},
|
167
165
|
},
|
168
166
|
"cache" => {
|
169
167
|
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" => {},
|
170
|
-
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => {}
|
171
|
-
}
|
168
|
+
"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => {},
|
169
|
+
},
|
172
170
|
}
|
173
171
|
end
|
174
172
|
|
@@ -177,21 +175,20 @@ describe ChefDK::Policyfile::Lister do
|
|
177
175
|
"dev" => {
|
178
176
|
"db" => "6666666666666666666666666666666666666666",
|
179
177
|
"appserver" => "1111111111111111111111111111111111111111",
|
180
|
-
"cache" => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
178
|
+
"cache" => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
181
179
|
},
|
182
180
|
"test" => {
|
183
181
|
"db" => "7777777777777777777777777777777777777777",
|
184
182
|
"appserver" => "2222222222222222222222222222222222222222",
|
185
|
-
"cache" => "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"
|
183
|
+
"cache" => "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
186
184
|
},
|
187
185
|
"prod" => {
|
188
|
-
"db" =>"8888888888888888888888888888888888888888",
|
189
|
-
"appserver" => "3333333333333333333333333333333333333333"
|
190
|
-
}
|
186
|
+
"db" => "8888888888888888888888888888888888888888",
|
187
|
+
"appserver" => "3333333333333333333333333333333333333333",
|
188
|
+
},
|
191
189
|
}
|
192
190
|
end
|
193
191
|
|
194
|
-
|
195
192
|
it "gives a Hash of policy revisions by policy name" do
|
196
193
|
expect(info_fetcher.policies_by_name).to eq(expected_policy_list)
|
197
194
|
end
|
@@ -212,8 +209,8 @@ describe ChefDK::Policyfile::Lister do
|
|
212
209
|
end
|
213
210
|
|
214
211
|
it "lists orphaned revisions for a given policy" do
|
215
|
-
expect(info_fetcher.orphaned_revisions("db")).to eq(%w
|
216
|
-
expect(info_fetcher.orphaned_revisions("appserver")).to eq(%w
|
212
|
+
expect(info_fetcher.orphaned_revisions("db")).to eq(%w{ 9999999999999999999999999999999999999999 })
|
213
|
+
expect(info_fetcher.orphaned_revisions("appserver")).to eq(%w{ 4444444444444444444444444444444444444444 })
|
217
214
|
expect(info_fetcher.orphaned_revisions("cache")).to eq([])
|
218
215
|
end
|
219
216
|
|
@@ -227,7 +224,7 @@ describe ChefDK::Policyfile::Lister do
|
|
227
224
|
appserver_rev_ids = {
|
228
225
|
"dev" => "1111111111111111111111111111111111111111",
|
229
226
|
"test" => "2222222222222222222222222222222222222222",
|
230
|
-
"prod" => "3333333333333333333333333333333333333333"
|
227
|
+
"prod" => "3333333333333333333333333333333333333333",
|
231
228
|
}
|
232
229
|
|
233
230
|
expect(map["appserver"].revision_ids_by_group).to eq(appserver_rev_ids)
|
@@ -235,7 +232,7 @@ describe ChefDK::Policyfile::Lister do
|
|
235
232
|
db_rev_ids = {
|
236
233
|
"dev" => "6666666666666666666666666666666666666666",
|
237
234
|
"test" => "7777777777777777777777777777777777777777",
|
238
|
-
"prod" => "8888888888888888888888888888888888888888"
|
235
|
+
"prod" => "8888888888888888888888888888888888888888",
|
239
236
|
}
|
240
237
|
|
241
238
|
expect(map["db"].revision_ids_by_group).to eq(db_rev_ids)
|
@@ -243,7 +240,7 @@ describe ChefDK::Policyfile::Lister do
|
|
243
240
|
cache_rev_ids = {
|
244
241
|
"dev" => "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
245
242
|
"test" => "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
|
246
|
-
"prod" => nil
|
243
|
+
"prod" => nil,
|
247
244
|
}
|
248
245
|
expect(map["cache"].revision_ids_by_group).to eq(cache_rev_ids)
|
249
246
|
end
|
@@ -252,7 +249,7 @@ describe ChefDK::Policyfile::Lister do
|
|
252
249
|
|
253
250
|
let(:dev_group_data) do
|
254
251
|
{
|
255
|
-
"uri" => api_url("policy_groups/dev")
|
252
|
+
"uri" => api_url("policy_groups/dev"),
|
256
253
|
}
|
257
254
|
end
|
258
255
|
|
@@ -269,4 +266,3 @@ describe ChefDK::Policyfile::Lister do
|
|
269
266
|
end
|
270
267
|
|
271
268
|
end
|
272
|
-
|