chef-dk 4.1.7 → 4.2.0
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 +4 -2
- data/Gemfile.lock +113 -17
- data/lib/chef-dk/builtin_commands.rb +3 -0
- data/lib/chef-dk/cli.rb +3 -1
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +1 -0
- data/lib/chef-dk/command/clean_policy_revisions.rb +1 -0
- data/lib/chef-dk/command/delete_policy.rb +1 -0
- data/lib/chef-dk/command/delete_policy_group.rb +1 -0
- data/lib/chef-dk/command/describe_cookbook.rb +1 -0
- data/lib/chef-dk/command/diff.rb +5 -3
- data/lib/chef-dk/command/env.rb +6 -6
- data/lib/chef-dk/command/export.rb +1 -0
- data/lib/chef-dk/command/generate.rb +1 -0
- data/lib/chef-dk/command/generator_commands/chef_exts/quieter_doc_formatter.rb +2 -4
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +1 -0
- data/lib/chef-dk/command/install.rb +1 -0
- data/lib/chef-dk/command/push.rb +1 -0
- data/lib/chef-dk/command/push_archive.rb +1 -1
- data/lib/chef-dk/command/shell_init.rb +3 -2
- data/lib/chef-dk/command/show_policy.rb +1 -0
- data/lib/chef-dk/command/undelete.rb +1 -0
- data/lib/chef-dk/command/update.rb +1 -0
- data/lib/chef-dk/command/verify.rb +1 -1
- data/lib/chef-dk/component_test.rb +2 -1
- data/lib/chef-dk/configurable.rb +3 -2
- data/lib/chef-dk/cookbook_profiler/null_scm.rb +1 -2
- data/lib/chef-dk/generator.rb +1 -1
- data/lib/chef-dk/helpers.rb +2 -1
- data/lib/chef-dk/policyfile/artifactory_cookbook_source.rb +1 -1
- data/lib/chef-dk/policyfile/attribute_merge_checker.rb +1 -1
- data/lib/chef-dk/policyfile/chef_repo_cookbook_source.rb +1 -1
- data/lib/chef-dk/policyfile/chef_server_cookbook_source.rb +3 -3
- data/lib/chef-dk/policyfile/chef_server_lock_fetcher.rb +5 -5
- data/lib/chef-dk/policyfile/community_cookbook_source.rb +1 -1
- data/lib/chef-dk/policyfile/comparison_base.rb +1 -0
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +4 -4
- data/lib/chef-dk/policyfile/cookbook_locks.rb +8 -5
- data/lib/chef-dk/policyfile/delivery_supermarket_source.rb +1 -1
- data/lib/chef-dk/policyfile/differ.rb +6 -2
- data/lib/chef-dk/policyfile/dsl.rb +4 -2
- data/lib/chef-dk/policyfile/git_lock_fetcher.rb +2 -2
- data/lib/chef-dk/policyfile/included_policies_cookbook_source.rb +1 -1
- data/lib/chef-dk/policyfile/lister.rb +2 -2
- data/lib/chef-dk/policyfile/local_lock_fetcher.rb +7 -5
- data/lib/chef-dk/policyfile/lock_applier.rb +1 -1
- data/lib/chef-dk/policyfile/null_cookbook_source.rb +1 -2
- data/lib/chef-dk/policyfile/policyfile_location_specification.rb +3 -3
- data/lib/chef-dk/policyfile/remote_lock_fetcher.rb +1 -1
- data/lib/chef-dk/policyfile/solution_dependencies.rb +13 -11
- data/lib/chef-dk/policyfile/storage_config.rb +1 -0
- data/lib/chef-dk/policyfile/undo_record.rb +10 -8
- data/lib/chef-dk/policyfile/uploader.rb +3 -1
- data/lib/chef-dk/policyfile_compiler.rb +17 -13
- data/lib/chef-dk/policyfile_lock.rb +17 -15
- data/lib/chef-dk/policyfile_services/clean_policies.rb +3 -3
- data/lib/chef-dk/policyfile_services/clean_policy_cookbooks.rb +2 -2
- data/lib/chef-dk/policyfile_services/export_repo.rb +4 -2
- data/lib/chef-dk/policyfile_services/install.rb +3 -1
- data/lib/chef-dk/policyfile_services/push.rb +6 -5
- data/lib/chef-dk/policyfile_services/push_archive.rb +6 -5
- data/lib/chef-dk/policyfile_services/rm_policy.rb +6 -2
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +2 -2
- data/lib/chef-dk/policyfile_services/show_policy.rb +2 -2
- data/lib/chef-dk/policyfile_services/undelete.rb +2 -2
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +3 -6
- data/spec/unit/cli_spec.rb +6 -6
- data/spec/unit/command/base_spec.rb +1 -1
- data/spec/unit/command/env_spec.rb +1 -1
- data/spec/unit/command/exec_spec.rb +1 -1
- data/spec/unit/command/export_spec.rb +1 -1
- data/spec/unit/command/generator_commands/recipe_spec.rb +2 -1
- data/spec/unit/command/generator_commands/repo_spec.rb +6 -6
- data/spec/unit/command/verify_spec.rb +1 -1
- data/spec/unit/policyfile/attribute_merge_checker_spec.rb +10 -8
- data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +4 -2
- data/spec/unit/policyfile/cookbook_locks_spec.rb +9 -9
- data/spec/unit/policyfile/git_lock_fetcher_spec.rb +5 -5
- data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +5 -3
- data/spec/unit/policyfile/lister_spec.rb +5 -5
- data/spec/unit/policyfile/local_lock_fetcher_spec.rb +1 -1
- data/spec/unit/policyfile/lock_applier_spec.rb +2 -2
- data/spec/unit/policyfile/reports/install_spec.rb +14 -14
- data/spec/unit/policyfile/reports/upload_spec.rb +3 -3
- data/spec/unit/policyfile/uploader_spec.rb +13 -12
- data/spec/unit/policyfile_demands_spec.rb +4 -4
- data/spec/unit/policyfile_includes_spec.rb +14 -7
- data/spec/unit/policyfile_install_with_includes_spec.rb +8 -7
- data/spec/unit/policyfile_lock_build_spec.rb +17 -18
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +5 -5
- data/spec/unit/policyfile_services/push_archive_spec.rb +6 -6
- data/spec/unit/policyfile_services/push_spec.rb +8 -8
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +5 -5
- data/spec/unit/policyfile_services/rm_policy_spec.rb +5 -5
- data/spec/unit/policyfile_services/update_attributes_spec.rb +2 -1
- data/spec/unit/service_exception_inspectors/http_spec.rb +7 -7
- metadata +2 -2
|
@@ -45,7 +45,7 @@ module ChefDK
|
|
|
45
45
|
[ remove_policy(policy), policy ]
|
|
46
46
|
end
|
|
47
47
|
|
|
48
|
-
failures = results.select { |result, _policy| result.
|
|
48
|
+
failures = results.select { |result, _policy| result.is_a?(Exception) }
|
|
49
49
|
|
|
50
50
|
unless failures.empty?
|
|
51
51
|
details = failures.map do |result, policy|
|
|
@@ -76,8 +76,8 @@ module ChefDK
|
|
|
76
76
|
|
|
77
77
|
def http_client
|
|
78
78
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
signing_key_filename: chef_config.client_key,
|
|
80
|
+
client_name: chef_config.node_name)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
private
|
|
@@ -115,8 +115,8 @@ module ChefDK
|
|
|
115
115
|
# server URL and credentials.
|
|
116
116
|
def http_client
|
|
117
117
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
118
|
-
|
|
119
|
-
|
|
118
|
+
signing_key_filename: chef_config.client_key,
|
|
119
|
+
client_name: chef_config.node_name)
|
|
120
120
|
end
|
|
121
121
|
end
|
|
122
122
|
end
|
|
@@ -90,6 +90,7 @@ module ChefDK
|
|
|
90
90
|
|
|
91
91
|
def archive_file_location
|
|
92
92
|
return nil unless archive?
|
|
93
|
+
|
|
93
94
|
filename = "#{policyfile_lock.name}-#{policyfile_lock.revision_id}.tgz"
|
|
94
95
|
File.join(export_dir, filename)
|
|
95
96
|
end
|
|
@@ -158,7 +159,7 @@ module ChefDK
|
|
|
158
159
|
dirname = "#{lock.name}-#{lock.identifier}"
|
|
159
160
|
export_path = File.join(staging_dir, "cookbook_artifacts", dirname)
|
|
160
161
|
metadata_rb_path = File.join(export_path, "metadata.rb")
|
|
161
|
-
FileUtils.mkdir(export_path)
|
|
162
|
+
FileUtils.mkdir(export_path) unless File.directory?(export_path)
|
|
162
163
|
copy_unignored_cookbook_files(lock, export_path)
|
|
163
164
|
FileUtils.rm_f(metadata_rb_path)
|
|
164
165
|
metadata = lock.cookbook_version.metadata
|
|
@@ -320,6 +321,7 @@ module ChefDK
|
|
|
320
321
|
|
|
321
322
|
def validate_lockfile
|
|
322
323
|
return @policyfile_lock if @policyfile_lock
|
|
324
|
+
|
|
323
325
|
@policyfile_lock = ChefDK::PolicyfileLock.new(storage_config).build_from_lock_data(policy_data)
|
|
324
326
|
# TODO: enumerate any cookbook that have been updated
|
|
325
327
|
@policyfile_lock.validate_cookbooks!
|
|
@@ -344,7 +346,7 @@ module ChefDK
|
|
|
344
346
|
|
|
345
347
|
def assert_export_dir_clean!
|
|
346
348
|
if !force_export? && !conflicting_fs_entries.empty? && !archive?
|
|
347
|
-
msg = "Export dir (#{export_dir}) not clean. Refusing to export. (Conflicting files: #{conflicting_fs_entries.join(
|
|
349
|
+
msg = "Export dir (#{export_dir}) not clean. Refusing to export. (Conflicting files: #{conflicting_fs_entries.join(", ")})"
|
|
348
350
|
raise ExportDirNotEmpty, msg
|
|
349
351
|
end
|
|
350
352
|
end
|
|
@@ -84,6 +84,7 @@ module ChefDK
|
|
|
84
84
|
|
|
85
85
|
def policyfile_lock
|
|
86
86
|
return nil if policyfile_lock_content.nil?
|
|
87
|
+
|
|
87
88
|
@policyfile_lock ||= begin
|
|
88
89
|
lock_data = FFI_Yajl::Parser.new.parse(policyfile_lock_content)
|
|
89
90
|
PolicyfileLock.new(storage_config, ui: ui).build_from_lock_data(lock_data)
|
|
@@ -115,7 +116,7 @@ module ChefDK
|
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
def update_lock_and_install(cookbooks_to_update, exclude_deps)
|
|
118
|
-
ui.msg "Updating #{cookbooks_to_update.join(
|
|
119
|
+
ui.msg "Updating #{cookbooks_to_update.join(",")} cookbooks #{exclude_deps ? "(excluding dependencies)" : ""}"
|
|
119
120
|
to_update = if exclude_deps
|
|
120
121
|
cookbooks_to_update
|
|
121
122
|
else
|
|
@@ -134,6 +135,7 @@ module ChefDK
|
|
|
134
135
|
|
|
135
136
|
policyfile_lock.cookbook_locks.each do |ck_name, location_spec|
|
|
136
137
|
next if to_update.include?(ck_name)
|
|
138
|
+
|
|
137
139
|
# we need to feed policyfile_compiler.cookbook_location_spec_for with a CookbookLocationSpecification
|
|
138
140
|
policyfile_compiler.dsl.cookbook_location_specs[ck_name] = Policyfile::CookbookLocationSpecification.new(
|
|
139
141
|
ck_name,
|
|
@@ -52,8 +52,8 @@ module ChefDK
|
|
|
52
52
|
|
|
53
53
|
def http_client
|
|
54
54
|
@http_client ||= Chef::ServerAPI.new(config.chef_server_url,
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
signing_key_filename: config.client_key,
|
|
56
|
+
client_name: config.node_name)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
def policy_data
|
|
@@ -64,9 +64,9 @@ module ChefDK
|
|
|
64
64
|
|
|
65
65
|
def uploader
|
|
66
66
|
ChefDK::Policyfile::Uploader.new(policyfile_lock, policy_group,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
ui: ui,
|
|
68
|
+
http_client: http_client,
|
|
69
|
+
policy_document_native_api: config.policy_document_native_api)
|
|
70
70
|
end
|
|
71
71
|
|
|
72
72
|
def run
|
|
@@ -99,6 +99,7 @@ module ChefDK
|
|
|
99
99
|
|
|
100
100
|
def validate_lockfile
|
|
101
101
|
return @policyfile_lock if @policyfile_lock
|
|
102
|
+
|
|
102
103
|
@policyfile_lock = ChefDK::PolicyfileLock.new(storage_config).build_from_lock_data(policy_data)
|
|
103
104
|
# TODO: enumerate any cookbook that have been updated
|
|
104
105
|
@policyfile_lock.validate_cookbooks!
|
|
@@ -56,6 +56,7 @@ module ChefDK
|
|
|
56
56
|
unless File.exist?(archive_file_path)
|
|
57
57
|
raise InvalidPolicyArchive, "Archive file #{archive_file_path} not found"
|
|
58
58
|
end
|
|
59
|
+
|
|
59
60
|
stage_unpacked_archive do |staging_dir|
|
|
60
61
|
read_policyfile_lock(staging_dir)
|
|
61
62
|
|
|
@@ -69,16 +70,16 @@ module ChefDK
|
|
|
69
70
|
# @api private
|
|
70
71
|
def uploader
|
|
71
72
|
ChefDK::Policyfile::Uploader.new(policyfile_lock, policy_group,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
ui: ui,
|
|
74
|
+
http_client: http_client,
|
|
75
|
+
policy_document_native_api: config.policy_document_native_api)
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
# @api private
|
|
78
79
|
def http_client
|
|
79
80
|
@http_client ||= Chef::ServerAPI.new(config.chef_server_url,
|
|
80
|
-
|
|
81
|
-
|
|
81
|
+
signing_key_filename: config.client_key,
|
|
82
|
+
client_name: config.node_name)
|
|
82
83
|
end
|
|
83
84
|
|
|
84
85
|
private
|
|
@@ -76,8 +76,8 @@ module ChefDK
|
|
|
76
76
|
# server URL and credentials.
|
|
77
77
|
def http_client
|
|
78
78
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
signing_key_filename: chef_config.client_key,
|
|
80
|
+
client_name: chef_config.node_name)
|
|
81
81
|
end
|
|
82
82
|
|
|
83
83
|
private
|
|
@@ -108,6 +108,7 @@ module ChefDK
|
|
|
108
108
|
next unless group_info.key?("policies") && !group_info["policies"].empty?
|
|
109
109
|
next unless group_info["policies"].key?(policy_name)
|
|
110
110
|
next unless group_info["policies"][policy_name]["revision_id"] == revision_id
|
|
111
|
+
|
|
111
112
|
groups << group_name if group_info
|
|
112
113
|
end
|
|
113
114
|
groups
|
|
@@ -119,12 +120,14 @@ module ChefDK
|
|
|
119
120
|
|
|
120
121
|
def policy_exists?
|
|
121
122
|
return true if @policy_exists
|
|
123
|
+
|
|
122
124
|
fetch_policy_revision_data
|
|
123
125
|
@policy_exists
|
|
124
126
|
end
|
|
125
127
|
|
|
126
128
|
def policy_revision_data
|
|
127
129
|
return @policy_revision_data if @policy_exists
|
|
130
|
+
|
|
128
131
|
fetch_policy_revision_data
|
|
129
132
|
end
|
|
130
133
|
|
|
@@ -133,6 +136,7 @@ module ChefDK
|
|
|
133
136
|
@policy_exists = true
|
|
134
137
|
rescue Net::HTTPServerException => e
|
|
135
138
|
raise unless e.response.code == "404"
|
|
139
|
+
|
|
136
140
|
@policy_exists = false
|
|
137
141
|
end
|
|
138
142
|
|
|
@@ -77,8 +77,8 @@ module ChefDK
|
|
|
77
77
|
# server URL and credentials.
|
|
78
78
|
def http_client
|
|
79
79
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
signing_key_filename: chef_config.client_key,
|
|
81
|
+
client_name: chef_config.node_name)
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
end
|
|
@@ -217,8 +217,8 @@ module ChefDK
|
|
|
217
217
|
|
|
218
218
|
def http_client
|
|
219
219
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
signing_key_filename: chef_config.client_key,
|
|
221
|
+
client_name: chef_config.node_name)
|
|
222
222
|
end
|
|
223
223
|
|
|
224
224
|
private
|
|
@@ -72,8 +72,8 @@ module ChefDK
|
|
|
72
72
|
|
|
73
73
|
def http_client
|
|
74
74
|
@http_client ||= Chef::ServerAPI.new(chef_config.chef_server_url,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
signing_key_filename: chef_config.client_key,
|
|
76
|
+
client_name: chef_config.node_name)
|
|
77
77
|
end
|
|
78
78
|
|
|
79
79
|
private
|
data/lib/chef-dk/version.rb
CHANGED
|
@@ -45,8 +45,7 @@ module Kitchen
|
|
|
45
45
|
# issues since berks is not yet using Solve 2.x. See also
|
|
46
46
|
# PolicyfileZero#load_needed_dependencies! which is stubbed to prevent
|
|
47
47
|
# berks from loading.
|
|
48
|
-
def prepare_cookbooks
|
|
49
|
-
end
|
|
48
|
+
def prepare_cookbooks; end
|
|
50
49
|
|
|
51
50
|
end
|
|
52
51
|
|
|
@@ -125,8 +124,7 @@ module Kitchen
|
|
|
125
124
|
|
|
126
125
|
# We don't want to load Berkshelf or Librarian; Policyfile is managing
|
|
127
126
|
# dependencies, so these can only cause trouble.
|
|
128
|
-
def load_needed_dependencies
|
|
129
|
-
end
|
|
127
|
+
def load_needed_dependencies!; end
|
|
130
128
|
|
|
131
129
|
private
|
|
132
130
|
|
|
@@ -134,8 +132,7 @@ module Kitchen
|
|
|
134
132
|
# don't need it.
|
|
135
133
|
#
|
|
136
134
|
# @api private
|
|
137
|
-
def prepare_json
|
|
138
|
-
end
|
|
135
|
+
def prepare_json; end
|
|
139
136
|
|
|
140
137
|
# Copies the policyfile's cookbooks to the sandbox.
|
|
141
138
|
#
|
data/spec/unit/cli_spec.rb
CHANGED
|
@@ -354,12 +354,12 @@ describe ChefDK::CLI do
|
|
|
354
354
|
before do
|
|
355
355
|
allow(File).to receive(:exist?).with(chefdk_embedded_path).and_return(false)
|
|
356
356
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
357
|
+
%i{
|
|
358
|
+
omnibus_root
|
|
359
|
+
omnibus_apps_dir
|
|
360
|
+
omnibus_bin_dir
|
|
361
|
+
omnibus_embedded_bin_dir
|
|
362
|
+
}.each do |method_name|
|
|
363
363
|
allow(cli).to receive(method_name).and_raise(ChefDK::OmnibusInstallNotFound.new)
|
|
364
364
|
end
|
|
365
365
|
end
|
|
@@ -186,7 +186,7 @@ describe ChefDK::Command::GeneratorCommands::Repo do
|
|
|
186
186
|
let(:file) { "chefignore" }
|
|
187
187
|
|
|
188
188
|
it "has the preamble" do
|
|
189
|
-
expect(file_contents).to match(
|
|
189
|
+
expect(file_contents).to match(%r{Put files/directories that should be ignored in this file when uploading})
|
|
190
190
|
end
|
|
191
191
|
end
|
|
192
192
|
|
|
@@ -195,17 +195,17 @@ describe ChefDK::Command::GeneratorCommands::Repo do
|
|
|
195
195
|
|
|
196
196
|
it "has the right contents" do
|
|
197
197
|
expect(file_contents).to match(/\.rake_test_cache/)
|
|
198
|
-
expect(file_contents).to match(
|
|
199
|
-
expect(file_contents).to match(
|
|
200
|
-
expect(file_contents).to_not match(
|
|
198
|
+
expect(file_contents).to match(%r{\.chef/\*\.pem})
|
|
199
|
+
expect(file_contents).to match(%r{\.chef/encrypted_data_bag_secret})
|
|
200
|
+
expect(file_contents).to_not match(%r{cookbooks/\*\*})
|
|
201
201
|
end
|
|
202
202
|
|
|
203
203
|
context "with --policy-only" do
|
|
204
204
|
let(:argv) { ["new_repo", "--policy-only" ] }
|
|
205
205
|
|
|
206
206
|
it "blocks cookbooks" do
|
|
207
|
-
expect(file_contents).to match(
|
|
208
|
-
expect(file_contents).to match(/
|
|
207
|
+
expect(file_contents).to match(%r{cookbooks/\*\*})
|
|
208
|
+
expect(file_contents).to match(%r{cookbooks/README\.md})
|
|
209
209
|
end
|
|
210
210
|
end
|
|
211
211
|
end
|
|
@@ -54,10 +54,11 @@ describe ChefDK::Policyfile::AttributeMergeChecker do
|
|
|
54
54
|
|
|
55
55
|
it "raises an error" do
|
|
56
56
|
expect { checker.check! }.to raise_error(
|
|
57
|
-
ChefDK::Policyfile::AttributeMergeChecker::ConflictError
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
57
|
+
ChefDK::Policyfile::AttributeMergeChecker::ConflictError
|
|
58
|
+
) do |e|
|
|
59
|
+
expect(e.attribute_path).to eq("[a]")
|
|
60
|
+
expect(e.provided_by).to include("foo", "bar")
|
|
61
|
+
end
|
|
61
62
|
end
|
|
62
63
|
end
|
|
63
64
|
|
|
@@ -69,10 +70,11 @@ describe ChefDK::Policyfile::AttributeMergeChecker do
|
|
|
69
70
|
|
|
70
71
|
it "raises an error" do
|
|
71
72
|
expect { checker.check! }.to raise_error(
|
|
72
|
-
ChefDK::Policyfile::AttributeMergeChecker::ConflictError
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
ChefDK::Policyfile::AttributeMergeChecker::ConflictError
|
|
74
|
+
) do |e|
|
|
75
|
+
expect(e.attribute_path).to eq("[a][b]")
|
|
76
|
+
expect(e.provided_by).to include("foo", "bar")
|
|
77
|
+
end
|
|
76
78
|
end
|
|
77
79
|
end
|
|
78
80
|
end
|
|
@@ -146,7 +146,8 @@ describe ChefDK::Policyfile::ChefServerLockFetcher do
|
|
|
146
146
|
|
|
147
147
|
it "includes the revision id in the source_options_for_lock" do
|
|
148
148
|
allow(http_client).to receive(:get).with(
|
|
149
|
-
"policy_groups/#{policy_group}/policies/#{policy_name}"
|
|
149
|
+
"policy_groups/#{policy_group}/policies/#{policy_name}"
|
|
150
|
+
).and_return(minimal_lockfile)
|
|
150
151
|
|
|
151
152
|
expect(fetcher.source_options_for_lock).to eq(source_options_for_lock)
|
|
152
153
|
end
|
|
@@ -154,7 +155,8 @@ describe ChefDK::Policyfile::ChefServerLockFetcher do
|
|
|
154
155
|
it "correctly applies source_options that were included in the lock" do
|
|
155
156
|
fetcher.apply_locked_source_options(source_options_for_lock)
|
|
156
157
|
expect(http_client).to receive(:get).with(
|
|
157
|
-
"policies/#{policy_name}/revisions/#{revision_id}"
|
|
158
|
+
"policies/#{policy_name}/revisions/#{revision_id}"
|
|
159
|
+
).and_return(minimal_lockfile)
|
|
158
160
|
fetcher.lock_data
|
|
159
161
|
end
|
|
160
162
|
end
|
|
@@ -221,9 +221,9 @@ describe ChefDK::Policyfile::LocalCookbook do
|
|
|
221
221
|
describe "gathering identifier info" do
|
|
222
222
|
let(:identifiers) do
|
|
223
223
|
instance_double("ChefDK::CookbookProfiler::Identifiers",
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
224
|
+
content_identifier: "abc123",
|
|
225
|
+
dotted_decimal_identifier: "111.222.333",
|
|
226
|
+
semver_version: "1.2.3")
|
|
227
227
|
end
|
|
228
228
|
|
|
229
229
|
before do
|
|
@@ -364,9 +364,9 @@ describe ChefDK::Policyfile::LocalCookbook do
|
|
|
364
364
|
|
|
365
365
|
let(:identifiers) do
|
|
366
366
|
instance_double("ChefDK::CookbookProfiler::Identifiers",
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
367
|
+
content_identifier: "abc123",
|
|
368
|
+
dotted_decimal_identifier: "111.222.333",
|
|
369
|
+
semver_version: "1.2.3")
|
|
370
370
|
end
|
|
371
371
|
|
|
372
372
|
it "has the correct identifier" do
|
|
@@ -399,9 +399,9 @@ describe ChefDK::Policyfile::LocalCookbook do
|
|
|
399
399
|
# represents the updated state of the cookbook
|
|
400
400
|
let(:identifiers) do
|
|
401
401
|
instance_double("ChefDK::CookbookProfiler::Identifiers",
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
content_identifier: "def456",
|
|
403
|
+
dotted_decimal_identifier: "777.888.999",
|
|
404
|
+
semver_version: "7.8.9")
|
|
405
405
|
end
|
|
406
406
|
|
|
407
407
|
it "sets the content identifier to the new identifier" do
|