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,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/service_exceptions"
|
|
21
|
+
require "chef-dk/authenticated_http"
|
|
22
|
+
require "chef-dk/policyfile_compiler"
|
|
23
|
+
require "chef-dk/policyfile/uploader"
|
|
24
|
+
require "chef-dk/policyfile/storage_config"
|
|
25
25
|
|
|
26
26
|
module ChefDK
|
|
27
27
|
module PolicyfileServices
|
|
@@ -77,7 +77,6 @@ module ChefDK
|
|
|
77
77
|
validate_lockfile
|
|
78
78
|
write_updated_lockfile
|
|
79
79
|
upload_policy
|
|
80
|
-
|
|
81
80
|
end
|
|
82
81
|
|
|
83
82
|
def policyfile_lock
|
|
@@ -111,4 +110,3 @@ module ChefDK
|
|
|
111
110
|
end
|
|
112
111
|
end
|
|
113
112
|
end
|
|
114
|
-
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
18
|
+
require "zlib"
|
|
19
|
+
require "archive/tar/minitar"
|
|
20
20
|
|
|
21
|
-
require
|
|
22
|
-
require
|
|
23
|
-
require
|
|
24
|
-
require
|
|
21
|
+
require "chef-dk/service_exceptions"
|
|
22
|
+
require "chef-dk/policyfile_lock"
|
|
23
|
+
require "chef-dk/authenticated_http"
|
|
24
|
+
require "chef-dk/policyfile/uploader"
|
|
25
25
|
|
|
26
26
|
module ChefDK
|
|
27
27
|
module PolicyfileServices
|
|
@@ -37,7 +37,6 @@ module ChefDK
|
|
|
37
37
|
|
|
38
38
|
attr_reader :policyfile_lock
|
|
39
39
|
|
|
40
|
-
|
|
41
40
|
def initialize(archive_file: nil, policy_group: nil, root_dir: nil, ui: nil, config: nil)
|
|
42
41
|
@archive_file = archive_file
|
|
43
42
|
@policy_group = policy_group
|
|
@@ -104,7 +103,6 @@ MESSAGE
|
|
|
104
103
|
raise InvalidPolicyArchive, "Archive does not contain a cookbook_artifacts directory"
|
|
105
104
|
end
|
|
106
105
|
|
|
107
|
-
|
|
108
106
|
policy_data = load_policy_data(policyfile_lock_path)
|
|
109
107
|
storage_config = Policyfile::StorageConfig.new.use_policyfile_lock(policyfile_lock_path)
|
|
110
108
|
@policyfile_lock = ChefDK::PolicyfileLock.new(storage_config).build_from_archive(policy_data)
|
|
@@ -118,7 +116,6 @@ MESSAGE
|
|
|
118
116
|
"Missing cookbooks: '#{missing_cookbooks.keys.join('", "')}'."
|
|
119
117
|
raise InvalidPolicyArchive, message
|
|
120
118
|
end
|
|
121
|
-
|
|
122
119
|
end
|
|
123
120
|
|
|
124
121
|
def load_policy_data(policyfile_lock_path)
|
|
@@ -132,7 +129,6 @@ MESSAGE
|
|
|
132
129
|
unpack_to(staging_dir)
|
|
133
130
|
yield staging_dir
|
|
134
131
|
end
|
|
135
|
-
|
|
136
132
|
end
|
|
137
133
|
|
|
138
134
|
def unpack_to(staging_dir)
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
20
|
-
require
|
|
21
|
-
require
|
|
18
|
+
require "chef-dk/service_exceptions"
|
|
19
|
+
require "chef-dk/authenticated_http"
|
|
20
|
+
require "chef-dk/policyfile/undo_stack"
|
|
21
|
+
require "chef-dk/policyfile/undo_record"
|
|
22
22
|
|
|
23
23
|
module ChefDK
|
|
24
24
|
module PolicyfileServices
|
|
@@ -139,4 +139,3 @@ module ChefDK
|
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
141
|
end
|
|
142
|
-
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
20
|
-
require
|
|
21
|
-
require
|
|
18
|
+
require "chef-dk/service_exceptions"
|
|
19
|
+
require "chef-dk/authenticated_http"
|
|
20
|
+
require "chef-dk/policyfile/undo_stack"
|
|
21
|
+
require "chef-dk/policyfile/undo_record"
|
|
22
22
|
|
|
23
23
|
module ChefDK
|
|
24
24
|
module PolicyfileServices
|
|
@@ -83,4 +83,3 @@ module ChefDK
|
|
|
83
83
|
end
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
|
-
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
20
|
-
require
|
|
18
|
+
require "chef-dk/policyfile/comparison_base"
|
|
19
|
+
require "chef-dk/policyfile/lister"
|
|
20
|
+
require "chef-dk/pager"
|
|
21
21
|
|
|
22
22
|
module ChefDK
|
|
23
23
|
module PolicyfileServices
|
|
@@ -214,7 +214,7 @@ module ChefDK
|
|
|
214
214
|
end
|
|
215
215
|
|
|
216
216
|
def shorten_rev_id(revision_id)
|
|
217
|
-
revision_id[0,10]
|
|
217
|
+
revision_id[0, 10]
|
|
218
218
|
end
|
|
219
219
|
|
|
220
220
|
def http_client
|
|
@@ -227,11 +227,10 @@ module ChefDK
|
|
|
227
227
|
|
|
228
228
|
def format_rev_ids_for_report(rev_id_by_group)
|
|
229
229
|
rev_id_by_group.format_revision_ids do |rev_id|
|
|
230
|
-
rev_id ? rev_id[0,10] : "*NOT APPLIED*"
|
|
230
|
+
rev_id ? rev_id[0, 10] : "*NOT APPLIED*"
|
|
231
231
|
end
|
|
232
232
|
end
|
|
233
233
|
|
|
234
|
-
|
|
235
234
|
end
|
|
236
235
|
end
|
|
237
236
|
end
|
|
@@ -15,9 +15,9 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
20
|
-
require
|
|
18
|
+
require "chef-dk/authenticated_http"
|
|
19
|
+
require "chef-dk/service_exceptions"
|
|
20
|
+
require "chef-dk/policyfile/undo_stack"
|
|
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
|
|
19
|
-
require
|
|
20
|
-
require
|
|
21
|
-
require
|
|
18
|
+
require "chef-dk/helpers"
|
|
19
|
+
require "chef-dk/policyfile/storage_config"
|
|
20
|
+
require "chef-dk/service_exceptions"
|
|
21
|
+
require "chef-dk/policyfile_compiler"
|
|
22
22
|
|
|
23
23
|
module ChefDK
|
|
24
24
|
module PolicyfileServices
|
|
@@ -88,7 +88,6 @@ module ChefDK
|
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
|
|
91
|
-
|
|
92
91
|
def assert_policy_and_lock_present!
|
|
93
92
|
unless File.exist?(policyfile_expanded_path)
|
|
94
93
|
raise PolicyfileNotFound, "Policyfile not found at path #{policyfile_expanded_path}"
|
|
@@ -101,4 +100,3 @@ module ChefDK
|
|
|
101
100
|
end
|
|
102
101
|
end
|
|
103
102
|
end
|
|
104
|
-
|
|
@@ -15,11 +15,10 @@
|
|
|
15
15
|
# limitations under the License.
|
|
16
16
|
#
|
|
17
17
|
|
|
18
|
-
require
|
|
19
|
-
require
|
|
18
|
+
require "chef-dk/service_exception_inspectors/base"
|
|
19
|
+
require "chef-dk/service_exception_inspectors/http"
|
|
20
20
|
|
|
21
21
|
module ChefDK
|
|
22
22
|
module ServiceExceptionInspectors
|
|
23
23
|
end
|
|
24
24
|
end
|
|
25
|
-
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
# dependencies, so they are split into their own file here.
|
|
21
21
|
##
|
|
22
22
|
|
|
23
|
-
require
|
|
23
|
+
require "chef-dk/service_exception_inspectors"
|
|
24
24
|
|
|
25
25
|
module ChefDK
|
|
26
26
|
|
|
@@ -140,4 +140,3 @@ module ChefDK
|
|
|
140
140
|
class ChefConvergeError < ChefRunnerError; end
|
|
141
141
|
|
|
142
142
|
end
|
|
143
|
-
|
data/lib/chef-dk/shell_out.rb
CHANGED
|
@@ -8,14 +8,14 @@ provisioner:
|
|
|
8
8
|
name: chef_zero
|
|
9
9
|
encrypted_data_bag_secret_key_path: 'secrets/fakey-mcfakerton'
|
|
10
10
|
data_bags_path: './data_bags'
|
|
11
|
+
product_name: chefdk
|
|
11
12
|
|
|
12
13
|
platforms:
|
|
13
14
|
- name: ubuntu-16.04
|
|
14
|
-
- name: centos-7.
|
|
15
|
+
- name: centos-7.3
|
|
15
16
|
|
|
16
17
|
suites:
|
|
17
18
|
- name: default
|
|
18
19
|
run_list:
|
|
19
|
-
- recipe[delivery_build::default]
|
|
20
20
|
- recipe[test]
|
|
21
21
|
attributes:
|
|
@@ -47,9 +47,9 @@ The change we'll use for an example is to install the `zsh` package. Write a fai
|
|
|
47
47
|
require 'spec_helper'
|
|
48
48
|
|
|
49
49
|
describe 'godzilla::default' do
|
|
50
|
-
context 'When all attributes are default, on
|
|
50
|
+
context 'When all attributes are default, on Ubuntu 16.04' do
|
|
51
51
|
let(:chef_run) do
|
|
52
|
-
runner = ChefSpec::ServerRunner.new
|
|
52
|
+
runner = ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04')
|
|
53
53
|
runner.converge(described_recipe)
|
|
54
54
|
end
|
|
55
55
|
|
data/lib/chef-dk/skeletons/code_generator/files/default/repo/cookbooks/example/attributes/default.rb
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
# attributes to be applied to nodes that run this cookbook.
|
|
3
3
|
|
|
4
4
|
# Set a default name
|
|
5
|
-
default[
|
|
5
|
+
default['example']['name'] = 'Sam Doe'
|
|
6
6
|
|
|
7
7
|
# For further information, see the Chef documentation (https://docs.chef.io/essentials_cookbook_attribute_files.html).
|
|
@@ -56,7 +56,7 @@ cookbook_file "#{cookbook_dir}/Berksfile"
|
|
|
56
56
|
directory "#{cookbook_dir}/recipes"
|
|
57
57
|
|
|
58
58
|
template "#{cookbook_dir}/recipes/default.rb" do
|
|
59
|
-
source
|
|
59
|
+
source 'recipe.rb.erb'
|
|
60
60
|
helpers(ChefDK::Generator::TemplateHelper)
|
|
61
61
|
end
|
|
62
62
|
|
|
@@ -70,20 +70,20 @@ cookbook_file "#{cookbook_dir}/spec/spec_helper.rb" do
|
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
template "#{cookbook_dir}/spec/unit/recipes/default_spec.rb" do
|
|
73
|
-
source
|
|
73
|
+
source 'recipe_spec.rb.erb'
|
|
74
74
|
helpers(ChefDK::Generator::TemplateHelper)
|
|
75
75
|
action :create_if_missing
|
|
76
76
|
end
|
|
77
77
|
|
|
78
78
|
# git
|
|
79
79
|
if context.have_git
|
|
80
|
-
|
|
81
|
-
execute(
|
|
82
|
-
command(
|
|
80
|
+
unless context.skip_git_init
|
|
81
|
+
execute('initialize-git') do
|
|
82
|
+
command('git init .')
|
|
83
83
|
cwd app_dir
|
|
84
84
|
end
|
|
85
85
|
end
|
|
86
86
|
cookbook_file "#{app_dir}/.gitignore" do
|
|
87
|
-
source
|
|
87
|
+
source 'gitignore'
|
|
88
88
|
end
|
|
89
89
|
end
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
context = ChefDK::Generator.context
|
|
3
3
|
cookbook_dir = File.join(context.cookbook_root, context.cookbook_name)
|
|
4
|
-
attribute_dir = File.join(cookbook_dir,
|
|
5
|
-
attribute_path = File.join(cookbook_dir,
|
|
4
|
+
attribute_dir = File.join(cookbook_dir, 'attributes')
|
|
5
|
+
attribute_path = File.join(cookbook_dir, 'attributes', "#{context.new_file_basename}.rb")
|
|
6
6
|
|
|
7
7
|
directory attribute_dir
|
|
8
8
|
|
|
9
9
|
template attribute_path do
|
|
10
|
-
source
|
|
10
|
+
source 'attribute.rb.erb'
|
|
11
11
|
helpers(ChefDK::Generator::TemplateHelper)
|
|
12
12
|
end
|
|
@@ -2,38 +2,42 @@
|
|
|
2
2
|
context = ChefDK::Generator.context
|
|
3
3
|
delivery_project_dir = context.delivery_project_dir
|
|
4
4
|
pipeline = context.pipeline
|
|
5
|
-
dot_delivery_dir = File.join(delivery_project_dir,
|
|
5
|
+
dot_delivery_dir = File.join(delivery_project_dir, '.delivery')
|
|
6
|
+
config_json = File.join(dot_delivery_dir, 'config.json')
|
|
7
|
+
project_toml = File.join(dot_delivery_dir, 'project.toml')
|
|
6
8
|
|
|
7
|
-
generator_desc(
|
|
9
|
+
generator_desc('Ensuring delivery configuration')
|
|
8
10
|
|
|
9
11
|
directory dot_delivery_dir
|
|
10
12
|
|
|
11
|
-
cookbook_file
|
|
12
|
-
source
|
|
13
|
+
cookbook_file config_json do
|
|
14
|
+
source 'delivery-config.json'
|
|
15
|
+
not_if { File.exist?(config_json) }
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
# Adding a new prototype file for delivery-cli local commands
|
|
16
|
-
cookbook_file
|
|
17
|
-
source
|
|
19
|
+
cookbook_file project_toml do
|
|
20
|
+
source 'delivery-project.toml'
|
|
21
|
+
not_if { File.exist?(project_toml) }
|
|
18
22
|
end
|
|
19
23
|
|
|
20
|
-
generator_desc(
|
|
24
|
+
generator_desc('Ensuring correct delivery build cookbook content')
|
|
21
25
|
|
|
22
|
-
build_cookbook_dir = File.join(dot_delivery_dir,
|
|
26
|
+
build_cookbook_dir = File.join(dot_delivery_dir, 'build_cookbook')
|
|
23
27
|
|
|
24
28
|
# cookbook root dir
|
|
25
29
|
directory build_cookbook_dir
|
|
26
30
|
|
|
27
31
|
# metadata.rb
|
|
28
32
|
template "#{build_cookbook_dir}/metadata.rb" do
|
|
29
|
-
source
|
|
33
|
+
source 'build_cookbook/metadata.rb.erb'
|
|
30
34
|
helpers(ChefDK::Generator::TemplateHelper)
|
|
31
35
|
action :create_if_missing
|
|
32
36
|
end
|
|
33
37
|
|
|
34
38
|
# README
|
|
35
39
|
cookbook_file "#{build_cookbook_dir}/README.md" do
|
|
36
|
-
source
|
|
40
|
+
source 'build_cookbook/README.md'
|
|
37
41
|
action :create_if_missing
|
|
38
42
|
end
|
|
39
43
|
|
|
@@ -49,7 +53,7 @@ cookbook_file "#{build_cookbook_dir}/chefignore"
|
|
|
49
53
|
|
|
50
54
|
# Berksfile
|
|
51
55
|
template "#{build_cookbook_dir}/Berksfile" do
|
|
52
|
-
source
|
|
56
|
+
source 'build_cookbook/Berksfile.erb'
|
|
53
57
|
helpers(ChefDK::Generator::TemplateHelper)
|
|
54
58
|
action :create_if_missing
|
|
55
59
|
end
|
|
@@ -68,7 +72,7 @@ end
|
|
|
68
72
|
|
|
69
73
|
# Test Kitchen build node
|
|
70
74
|
cookbook_file "#{build_cookbook_dir}/.kitchen.yml" do
|
|
71
|
-
source
|
|
75
|
+
source 'build_cookbook/.kitchen.yml'
|
|
72
76
|
end
|
|
73
77
|
|
|
74
78
|
directory "#{build_cookbook_dir}/data_bags/keys" do
|
|
@@ -93,7 +97,7 @@ version '0.1.0')
|
|
|
93
97
|
end
|
|
94
98
|
|
|
95
99
|
cookbook_file "#{build_cookbook_dir}/test/fixtures/cookbooks/test/recipes/default.rb" do
|
|
96
|
-
source
|
|
100
|
+
source 'build_cookbook/test-fixture-recipe.rb'
|
|
97
101
|
end
|
|
98
102
|
|
|
99
103
|
# Construct git history as if we did all the work in a feature branch which we
|
|
@@ -111,52 +115,52 @@ end
|
|
|
111
115
|
#
|
|
112
116
|
if context.have_git && context.delivery_project_git_initialized && !context.skip_git_init
|
|
113
117
|
|
|
114
|
-
generator_desc(
|
|
118
|
+
generator_desc('Adding delivery configuration to feature branch')
|
|
115
119
|
|
|
116
|
-
execute(
|
|
117
|
-
command(
|
|
120
|
+
execute('git-create-feature-branch') do
|
|
121
|
+
command('git checkout -t -b add-delivery-configuration')
|
|
118
122
|
cwd delivery_project_dir
|
|
119
|
-
|
|
120
|
-
not_if
|
|
123
|
+
|
|
124
|
+
not_if 'git branch |grep "add-delivery-configuration"'
|
|
121
125
|
end
|
|
122
126
|
|
|
123
|
-
execute(
|
|
124
|
-
command(
|
|
127
|
+
execute('git-add-delivery-config-json') do
|
|
128
|
+
command('git add .delivery/config.json')
|
|
125
129
|
cwd delivery_project_dir
|
|
126
130
|
|
|
127
|
-
only_if
|
|
131
|
+
only_if 'git status -u --porcelain |grep ".delivery/config.json"'
|
|
128
132
|
end
|
|
129
133
|
|
|
130
134
|
# Adding the new prototype file to the feature branch
|
|
131
135
|
# so it gets checked in with the delivery config commit
|
|
132
|
-
execute(
|
|
133
|
-
command(
|
|
136
|
+
execute('git-add-delivery-project-toml') do
|
|
137
|
+
command('git add .delivery/project.toml')
|
|
134
138
|
cwd delivery_project_dir
|
|
135
139
|
|
|
136
|
-
only_if
|
|
140
|
+
only_if 'git status -u --porcelain |grep ".delivery/project.toml"'
|
|
137
141
|
end
|
|
138
142
|
|
|
139
|
-
execute(
|
|
140
|
-
command(
|
|
143
|
+
execute('git-commit-delivery-config') do
|
|
144
|
+
command('git commit -m "Add generated delivery configuration"')
|
|
141
145
|
cwd delivery_project_dir
|
|
142
146
|
|
|
143
|
-
only_if
|
|
147
|
+
only_if 'git status -u --porcelain | egrep "config.json|project.toml"'
|
|
144
148
|
end
|
|
145
149
|
|
|
146
|
-
generator_desc(
|
|
150
|
+
generator_desc('Adding build cookbook to feature branch')
|
|
147
151
|
|
|
148
|
-
execute(
|
|
149
|
-
command(
|
|
152
|
+
execute('git-add-delivery-build-cookbook-files') do
|
|
153
|
+
command('git add .delivery')
|
|
150
154
|
cwd delivery_project_dir
|
|
151
155
|
|
|
152
|
-
only_if
|
|
156
|
+
only_if 'git status -u --porcelain |grep ".delivery"'
|
|
153
157
|
end
|
|
154
158
|
|
|
155
|
-
execute(
|
|
156
|
-
command(
|
|
159
|
+
execute('git-commit-delivery-build-cookbook') do
|
|
160
|
+
command('git commit -m "Add generated delivery build cookbook"')
|
|
157
161
|
cwd delivery_project_dir
|
|
158
162
|
|
|
159
|
-
only_if
|
|
163
|
+
only_if 'git status -u --porcelain |grep ".delivery"'
|
|
160
164
|
end
|
|
161
165
|
|
|
162
166
|
execute("git-return-to-#{pipeline}-branch") do
|
|
@@ -164,15 +168,15 @@ if context.have_git && context.delivery_project_git_initialized && !context.skip
|
|
|
164
168
|
cwd delivery_project_dir
|
|
165
169
|
end
|
|
166
170
|
|
|
167
|
-
generator_desc(
|
|
171
|
+
generator_desc('Merging delivery content feature branch to master')
|
|
168
172
|
|
|
169
|
-
execute(
|
|
170
|
-
command(
|
|
173
|
+
execute('git-merge-delivery-config-branch') do
|
|
174
|
+
command('git merge --no-ff add-delivery-configuration')
|
|
171
175
|
cwd delivery_project_dir
|
|
172
176
|
end
|
|
173
177
|
|
|
174
|
-
execute(
|
|
175
|
-
command(
|
|
178
|
+
execute('git-remove-delivery-config-branch') do
|
|
179
|
+
command('git branch -D add-delivery-configuration')
|
|
176
180
|
cwd delivery_project_dir
|
|
177
181
|
end
|
|
178
182
|
end
|