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
@@ -15,8 +15,8 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef-dk/cookbook_omnifetch"
|
19
|
+
require "chef-dk/exceptions"
|
20
20
|
|
21
21
|
module ChefDK
|
22
22
|
module Policyfile
|
@@ -45,14 +45,14 @@ module ChefDK
|
|
45
45
|
raise InvalidPolicyfileFilename, "Policyfile filenames must end with `.rb' extension (you gave: `#{policyfile_filename}')"
|
46
46
|
end
|
47
47
|
@policyfile_filename = policyfile_filename
|
48
|
-
@policyfile_lock_filename = policyfile_filename.sub(/\.rb\Z/,
|
48
|
+
@policyfile_lock_filename = policyfile_filename.sub(/\.rb\Z/, ".lock.json")
|
49
49
|
@relative_paths_root = File.dirname(policyfile_filename)
|
50
50
|
self
|
51
51
|
end
|
52
52
|
|
53
53
|
def use_policyfile_lock(policyfile_lock_filename)
|
54
54
|
@policyfile_lock_filename = policyfile_lock_filename
|
55
|
-
@policyfile_filename = policyfile_lock_filename.sub(/\.lock\.json\Z/,
|
55
|
+
@policyfile_filename = policyfile_lock_filename.sub(/\.lock\.json\Z/, ".rb")
|
56
56
|
@relative_paths_root = File.dirname(policyfile_lock_filename)
|
57
57
|
self
|
58
58
|
end
|
@@ -100,4 +100,3 @@ module ChefDK
|
|
100
100
|
|
101
101
|
end
|
102
102
|
end
|
103
|
-
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "chef-dk/exceptions"
|
19
19
|
|
20
20
|
module ChefDK
|
21
21
|
module Policyfile
|
@@ -35,7 +35,7 @@ module ChefDK
|
|
35
35
|
{
|
36
36
|
"policy_name" => policy_name,
|
37
37
|
"policy_group" => policy_group,
|
38
|
-
"data" => data
|
38
|
+
"data" => data,
|
39
39
|
}
|
40
40
|
end
|
41
41
|
|
@@ -71,7 +71,7 @@ module ChefDK
|
|
71
71
|
unless data.kind_of?(Hash)
|
72
72
|
raise InvalidUndoRecord, "Undo data is incorrectly formatted. Must be a Hash, got '#{data}'."
|
73
73
|
end
|
74
|
-
missing_fields = %w
|
74
|
+
missing_fields = %w{ format_version description backup_data }.select { |key| !data.key?(key) }
|
75
75
|
unless missing_fields.empty?
|
76
76
|
raise InvalidUndoRecord, "Undo data is missing mandatory field(s) #{missing_fields.join(', ')}. Undo data: '#{data}'"
|
77
77
|
end
|
@@ -82,7 +82,7 @@ module ChefDK
|
|
82
82
|
unless policy_data.kind_of?(Hash)
|
83
83
|
raise InvalidUndoRecord, "'backup_data' in the undo record is incorrectly formatted. Must be a Hash, got '#{policy_data}'"
|
84
84
|
end
|
85
|
-
missing_policy_data_fields = %w
|
85
|
+
missing_policy_data_fields = %w{ policy_groups policy_revisions }.select { |key| !policy_data.key?(key) }
|
86
86
|
unless missing_policy_data_fields.empty?
|
87
87
|
raise InvalidUndoRecord,
|
88
88
|
"'backup_data' in the undo record is missing mandatory field(s) #{missing_policy_data_fields.join(', ')}. Backup data: #{policy_data}"
|
@@ -121,8 +121,8 @@ module ChefDK
|
|
121
121
|
"description" => description,
|
122
122
|
"backup_data" => {
|
123
123
|
"policy_groups" => policy_groups,
|
124
|
-
"policy_revisions" => policy_revisions.map(&:for_serialization)
|
125
|
-
}
|
124
|
+
"policy_revisions" => policy_revisions.map(&:for_serialization),
|
125
|
+
},
|
126
126
|
}
|
127
127
|
end
|
128
128
|
|
@@ -137,6 +137,3 @@ module ChefDK
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
140
|
-
|
141
|
-
|
142
|
-
|
@@ -15,12 +15,12 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "fileutils"
|
19
19
|
|
20
|
-
require
|
20
|
+
require "ffi_yajl"
|
21
21
|
|
22
|
-
require
|
23
|
-
require
|
22
|
+
require "chef-dk/helpers"
|
23
|
+
require "chef-dk/policyfile/undo_record"
|
24
24
|
|
25
25
|
module ChefDK
|
26
26
|
module Policyfile
|
@@ -114,17 +114,15 @@ module ChefDK
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def undo_record_files
|
117
|
-
Dir[File.join(undo_dir,
|
117
|
+
Dir[File.join(undo_dir, "*")].sort
|
118
118
|
end
|
119
119
|
|
120
120
|
def ensure_undo_dir_exists
|
121
121
|
return false if File.directory?(undo_dir)
|
122
122
|
|
123
|
-
|
124
123
|
FileUtils.mkdir_p(undo_dir)
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
128
127
|
end
|
129
128
|
end
|
130
|
-
|
@@ -15,11 +15,11 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "chef/cookbook_uploader"
|
19
|
+
require "chef-dk/policyfile/read_cookbook_for_compat_mode_upload"
|
20
20
|
|
21
|
-
require
|
22
|
-
require
|
21
|
+
require "chef-dk/ui"
|
22
|
+
require "chef-dk/policyfile/reports/upload"
|
23
23
|
|
24
24
|
module ChefDK
|
25
25
|
module Policyfile
|
@@ -77,7 +77,7 @@ DRAGONS
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def data_bag_create
|
80
|
-
http_client.post("data", {"name" => COMPAT_MODE_DATA_BAG_NAME})
|
80
|
+
http_client.post("data", { "name" => COMPAT_MODE_DATA_BAG_NAME })
|
81
81
|
rescue Net::HTTPServerException => e
|
82
82
|
raise e unless e.response.code == "409"
|
83
83
|
end
|
@@ -95,7 +95,7 @@ DRAGONS
|
|
95
95
|
"raw_data" => lock_data,
|
96
96
|
# we'd prefer to leave this out, but the "compatibility mode"
|
97
97
|
# implementation in chef-client relies on magical class inflation
|
98
|
-
"json_class" => "Chef::DataBagItem"
|
98
|
+
"json_class" => "Chef::DataBagItem",
|
99
99
|
}
|
100
100
|
|
101
101
|
upload_lockfile_as_data_bag_item(policy_id, data_item)
|
@@ -182,9 +182,9 @@ DRAGONS
|
|
182
182
|
|
183
183
|
def list_cookbooks_url
|
184
184
|
if using_policy_document_native_api?
|
185
|
-
|
185
|
+
"cookbook_artifacts?num_versions=all"
|
186
186
|
else
|
187
|
-
|
187
|
+
"cookbooks?num_versions=all"
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
@@ -15,17 +15,17 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
18
|
+
require "set"
|
19
|
+
require "forwardable"
|
20
20
|
|
21
|
-
require
|
22
|
-
require
|
21
|
+
require "solve"
|
22
|
+
require "chef/run_list"
|
23
23
|
|
24
|
-
require
|
25
|
-
require
|
26
|
-
require
|
27
|
-
require
|
28
|
-
require
|
24
|
+
require "chef-dk/policyfile/dsl"
|
25
|
+
require "chef-dk/policyfile_lock"
|
26
|
+
require "chef-dk/ui"
|
27
|
+
require "chef-dk/policyfile/reports/install"
|
28
|
+
require "chef-dk/exceptions"
|
29
29
|
|
30
30
|
module ChefDK
|
31
31
|
|
@@ -33,7 +33,7 @@ module ChefDK
|
|
33
33
|
|
34
34
|
extend Forwardable
|
35
35
|
|
36
|
-
DEFAULT_DEMAND_CONSTRAINT =
|
36
|
+
DEFAULT_DEMAND_CONSTRAINT = ">= 0.0.0".freeze
|
37
37
|
|
38
38
|
# Cookbooks from these sources lock that cookbook to exactly one version
|
39
39
|
SOURCE_TYPES_WITH_FIXED_VERSIONS = [:git, :path].freeze
|
@@ -95,7 +95,7 @@ module ChefDK
|
|
95
95
|
end
|
96
96
|
|
97
97
|
def normalized_named_run_lists
|
98
|
-
expanded_named_run_lists.inject({}) do |normalized,(name, run_list)|
|
98
|
+
expanded_named_run_lists.inject({}) do |normalized, (name, run_list)|
|
99
99
|
normalized[name] = run_list.map { |i| normalize_recipe(i) }
|
100
100
|
normalized
|
101
101
|
end
|
@@ -126,14 +126,14 @@ module ChefDK
|
|
126
126
|
|
127
127
|
graph_solution.each do |cookbook_name, version|
|
128
128
|
spec = cookbook_location_spec_for(cookbook_name)
|
129
|
-
if spec.nil?
|
129
|
+
if spec.nil? || !spec.version_fixed?
|
130
130
|
spec = create_spec_for_cookbook(cookbook_name, version)
|
131
131
|
install_report.installing_cookbook(spec)
|
132
132
|
spec.ensure_cached
|
133
133
|
end
|
134
134
|
|
135
135
|
required_recipes = cookbook_and_recipe_list.select { |cb_name, _recipe| cb_name == spec.name }
|
136
|
-
missing_recipes = required_recipes.select {|_cb_name, recipe| !spec.cookbook_has_recipe?(recipe) }
|
136
|
+
missing_recipes = required_recipes.select { |_cb_name, recipe| !spec.cookbook_has_recipe?(recipe) }
|
137
137
|
|
138
138
|
unless missing_recipes.empty?
|
139
139
|
missing_recipes_by_cb_spec[spec] = missing_recipes
|
@@ -143,7 +143,7 @@ module ChefDK
|
|
143
143
|
unless missing_recipes_by_cb_spec.empty?
|
144
144
|
message = "The installed cookbooks do not contain all the recipes required by your run list(s):\n"
|
145
145
|
missing_recipes_by_cb_spec.each do |spec, missing_items|
|
146
|
-
message << "#{spec
|
146
|
+
message << "#{spec}\nis missing the following required recipes:\n"
|
147
147
|
missing_items.each { |_cb, recipe| message << "* #{recipe}\n" }
|
148
148
|
end
|
149
149
|
|
@@ -152,8 +152,6 @@ module ChefDK
|
|
152
152
|
|
153
153
|
raise CookbookDoesNotContainRequiredRecipe, message
|
154
154
|
end
|
155
|
-
|
156
|
-
|
157
155
|
end
|
158
156
|
|
159
157
|
def create_spec_for_cookbook(cookbook_name, version)
|
@@ -265,7 +263,7 @@ module ChefDK
|
|
265
263
|
end
|
266
264
|
|
267
265
|
def version_constraint_for(cookbook_name)
|
268
|
-
if (cookbook_location_spec = cookbook_location_spec_for(cookbook_name))
|
266
|
+
if (cookbook_location_spec = cookbook_location_spec_for(cookbook_name)) && cookbook_location_spec.version_fixed?
|
269
267
|
version = cookbook_location_spec.version
|
270
268
|
"= #{version}"
|
271
269
|
else
|
@@ -282,7 +280,7 @@ module ChefDK
|
|
282
280
|
end
|
283
281
|
|
284
282
|
def cookbooks_in_run_list
|
285
|
-
recipes = combined_run_lists.map {|recipe| recipe.name }
|
283
|
+
recipes = combined_run_lists.map { |recipe| recipe.name }
|
286
284
|
recipes.map { |r| r[/^([^:]+)/, 1] }
|
287
285
|
end
|
288
286
|
|
@@ -298,7 +296,6 @@ module ChefDK
|
|
298
296
|
end
|
299
297
|
end
|
300
298
|
|
301
|
-
|
302
299
|
def build
|
303
300
|
yield @dsl
|
304
301
|
self
|
@@ -358,7 +355,6 @@ module ChefDK
|
|
358
355
|
end
|
359
356
|
end
|
360
357
|
|
361
|
-
|
362
358
|
def preferred_source_for_cookbook(conflicting_cb_name)
|
363
359
|
default_source.find { |s| s.preferred_source_for?(conflicting_cb_name) }
|
364
360
|
end
|
@@ -16,12 +16,12 @@
|
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
18
|
|
19
|
-
require
|
19
|
+
require "digest/sha2"
|
20
20
|
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
21
|
+
require "chef-dk/policyfile/storage_config"
|
22
|
+
require "chef-dk/policyfile/cookbook_locks"
|
23
|
+
require "chef-dk/policyfile/solution_dependencies"
|
24
|
+
require "chef-dk/ui"
|
25
25
|
|
26
26
|
module ChefDK
|
27
27
|
|
@@ -65,7 +65,7 @@ module ChefDK
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
RUN_LIST_ITEM_FORMAT = /\Arecipe\[[^\s]+::[^\s]+\]\Z
|
68
|
+
RUN_LIST_ITEM_FORMAT = /\Arecipe\[[^\s]+::[^\s]+\]\Z/
|
69
69
|
|
70
70
|
def self.build(storage_config)
|
71
71
|
lock = new(storage_config)
|
@@ -319,7 +319,7 @@ module ChefDK
|
|
319
319
|
# keys to UTF-8 first so that the sort order uses the UTF-8 strings.
|
320
320
|
item_with_normalized_keys = item.inject({}) do |normalized_item, (key, value)|
|
321
321
|
validate_attr_key(key)
|
322
|
-
normalized_item[key.encode(
|
322
|
+
normalized_item[key.encode("utf-8")] = value
|
323
323
|
normalized_item
|
324
324
|
end
|
325
325
|
elements = item_with_normalized_keys.keys.sort.map do |key|
|
@@ -327,12 +327,12 @@ module ChefDK
|
|
327
327
|
v = canonicalize_elements(item_with_normalized_keys[key])
|
328
328
|
k << v
|
329
329
|
end
|
330
|
-
"{" << elements.join(
|
330
|
+
"{" << elements.join(",") << "}"
|
331
331
|
when String
|
332
|
-
'"' << item.encode(
|
332
|
+
'"' << item.encode("utf-8") << '"'
|
333
333
|
when Array
|
334
334
|
elements = item.map { |i| canonicalize_elements(i) }
|
335
|
-
|
335
|
+
"[" << elements.join(",") << "]"
|
336
336
|
when Integer
|
337
337
|
item.to_s
|
338
338
|
when Float
|
@@ -396,7 +396,6 @@ module ChefDK
|
|
396
396
|
end
|
397
397
|
|
398
398
|
@name = name_attribute
|
399
|
-
|
400
399
|
end
|
401
400
|
|
402
401
|
def set_run_list_from_lock_data(lock_data)
|
@@ -15,9 +15,9 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
18
|
+
require "chef-dk/exceptions"
|
19
|
+
require "chef-dk/service_exceptions"
|
20
|
+
require "chef-dk/policyfile/lister"
|
21
21
|
|
22
22
|
module ChefDK
|
23
23
|
module PolicyfileServices
|
@@ -15,10 +15,10 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "set"
|
19
19
|
|
20
|
-
require
|
21
|
-
require
|
20
|
+
require "chef-dk/authenticated_http"
|
21
|
+
require "chef-dk/service_exceptions"
|
22
22
|
|
23
23
|
module ChefDK
|
24
24
|
module PolicyfileServices
|
@@ -59,7 +59,6 @@ module ChefDK
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
-
|
63
62
|
def all_cookbooks
|
64
63
|
cookbook_list = http_client.get("/cookbook_artifacts")
|
65
64
|
cookbook_list.inject({}) do |cb_map, (name, cb_info)|
|
@@ -122,4 +121,3 @@ module ChefDK
|
|
122
121
|
end
|
123
122
|
end
|
124
123
|
end
|
125
|
-
|
@@ -15,18 +15,18 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
19
|
-
require
|
20
|
-
require
|
21
|
-
require
|
18
|
+
require "pathname"
|
19
|
+
require "fileutils"
|
20
|
+
require "tmpdir"
|
21
|
+
require "zlib"
|
22
22
|
|
23
|
-
require
|
23
|
+
require "archive/tar/minitar"
|
24
24
|
|
25
|
-
require
|
25
|
+
require "chef/cookbook/chefignore"
|
26
26
|
|
27
|
-
require
|
28
|
-
require
|
29
|
-
require
|
27
|
+
require "chef-dk/service_exceptions"
|
28
|
+
require "chef-dk/policyfile_lock"
|
29
|
+
require "chef-dk/policyfile/storage_config"
|
30
30
|
|
31
31
|
module ChefDK
|
32
32
|
module PolicyfileServices
|
@@ -37,7 +37,7 @@ module ChefDK
|
|
37
37
|
# have multiple active iterations of a policy at once, but we don't need
|
38
38
|
# this when serving a single exported policy via Chef Zero, so hardcode
|
39
39
|
# it to a "well known" value:
|
40
|
-
POLICY_GROUP =
|
40
|
+
POLICY_GROUP = "local".freeze
|
41
41
|
|
42
42
|
include Policyfile::StorageConfigDelegation
|
43
43
|
|
@@ -211,9 +211,9 @@ module ChefDK
|
|
211
211
|
data = {
|
212
212
|
"policies" => {
|
213
213
|
policyfile_lock.name => {
|
214
|
-
"revision_id" => policyfile_lock.revision_id
|
215
|
-
}
|
216
|
-
}
|
214
|
+
"revision_id" => policyfile_lock.revision_id,
|
215
|
+
},
|
216
|
+
},
|
217
217
|
}
|
218
218
|
|
219
219
|
File.open(policy_group_repo_item_path, "wb+") do |f|
|
@@ -418,4 +418,3 @@ README
|
|
418
418
|
|
419
419
|
end
|
420
420
|
end
|
421
|
-
|
@@ -15,13 +15,13 @@
|
|
15
15
|
# limitations under the License.
|
16
16
|
#
|
17
17
|
|
18
|
-
require
|
18
|
+
require "ffi_yajl"
|
19
19
|
|
20
|
-
require
|
21
|
-
require
|
22
|
-
require
|
23
|
-
require
|
24
|
-
require
|
20
|
+
require "chef-dk/helpers"
|
21
|
+
require "chef-dk/service_exceptions"
|
22
|
+
require "chef-dk/policyfile_compiler"
|
23
|
+
require "chef-dk/policyfile/storage_config"
|
24
|
+
require "chef-dk/policyfile_lock"
|
25
25
|
|
26
26
|
module ChefDK
|
27
27
|
module PolicyfileServices
|