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
|
@@ -141,11 +141,11 @@ describe ChefDK::Policyfile::GitLockFetcher do
|
|
|
141
141
|
expect(
|
|
142
142
|
relative_path_fetcher.lock_data["cookbook_locks"][cookbook_name]["source_options"]
|
|
143
143
|
).to match(
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
144
|
+
{
|
|
145
|
+
"git" => repo,
|
|
146
|
+
"revision" => git_revision,
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
149
|
expect(
|
|
150
150
|
relative_path_fetcher.lock_data["cookbook_locks"][cookbook_name]["source_options"]
|
|
151
151
|
).not_to match(source_options_rel)
|
|
@@ -69,7 +69,7 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
|
|
|
69
69
|
"cache_key" => "#{cookbook_info[:name]}-#{cookbook_info[:version]}",
|
|
70
70
|
"origin" => "uri",
|
|
71
71
|
"source_options" => { "version" => cookbook_info[:version] }.tap do |so|
|
|
72
|
-
so["nonce"] = nonce
|
|
72
|
+
so["nonce"] = nonce unless nonce.nil?
|
|
73
73
|
end,
|
|
74
74
|
}
|
|
75
75
|
acc
|
|
@@ -222,7 +222,8 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
|
|
|
222
222
|
|
|
223
223
|
it "raises an error when check_for_conflicts! is called" do
|
|
224
224
|
expect { cookbook_source.check_for_conflicts! }.to raise_error(
|
|
225
|
-
ChefDK::Policyfile::IncludedPoliciesCookbookSource::ConflictingCookbookSources
|
|
225
|
+
ChefDK::Policyfile::IncludedPoliciesCookbookSource::ConflictingCookbookSources
|
|
226
|
+
)
|
|
226
227
|
end
|
|
227
228
|
end
|
|
228
229
|
|
|
@@ -231,7 +232,8 @@ describe ChefDK::Policyfile::IncludedPoliciesCookbookSource do
|
|
|
231
232
|
|
|
232
233
|
it "raises an error when check_for_conflicts! is called" do
|
|
233
234
|
expect { cookbook_source.check_for_conflicts! }.to raise_error(
|
|
234
|
-
ChefDK::Policyfile::IncludedPoliciesCookbookSource::ConflictingCookbookVersions
|
|
235
|
+
ChefDK::Policyfile::IncludedPoliciesCookbookSource::ConflictingCookbookVersions
|
|
236
|
+
)
|
|
235
237
|
end
|
|
236
238
|
end
|
|
237
239
|
|
|
@@ -26,9 +26,9 @@ describe ChefDK::Policyfile::Lister do
|
|
|
26
26
|
|
|
27
27
|
let(:config) do
|
|
28
28
|
double("Chef::Config",
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
chef_server_url: "https://localhost:10443",
|
|
30
|
+
client_key: "/path/to/client/key.pem",
|
|
31
|
+
node_name: "deuce")
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
let(:http_client) { instance_double(Chef::ServerAPI) }
|
|
@@ -39,8 +39,8 @@ describe ChefDK::Policyfile::Lister do
|
|
|
39
39
|
|
|
40
40
|
it "configures an HTTP client" do
|
|
41
41
|
expect(Chef::ServerAPI).to receive(:new).with("https://localhost:10443",
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
signing_key_filename: "/path/to/client/key.pem",
|
|
43
|
+
client_name: "deuce")
|
|
44
44
|
info_fetcher.http_client
|
|
45
45
|
end
|
|
46
46
|
|
|
@@ -70,7 +70,7 @@ describe ChefDK::Policyfile::LocalLockFetcher do
|
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
%i{relative absolute}.each do |mode|
|
|
74
74
|
context "When path is #{mode}" do
|
|
75
75
|
let(:path) { "foo/bar/baz/foo.lock.json" }
|
|
76
76
|
let(:lock_file_path_abs) { "#{tempdir}/#{path}" }
|
|
@@ -27,12 +27,12 @@ describe ChefDK::Policyfile::LockApplier do
|
|
|
27
27
|
|
|
28
28
|
let(:included_policy_1) do
|
|
29
29
|
instance_double("ChefDK::Policyfile::PolicyfileLocationSpec",
|
|
30
|
-
|
|
30
|
+
name: "policy1")
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
let(:included_policy_2) do
|
|
34
34
|
instance_double("ChefDK::Policyfile::PolicyfileLocationSpec",
|
|
35
|
-
|
|
35
|
+
name: "policy2")
|
|
36
36
|
end
|
|
37
37
|
|
|
38
38
|
let(:included_policy_lock_1) do
|
|
@@ -42,18 +42,18 @@ describe ChefDK::Policyfile::Reports::Install do
|
|
|
42
42
|
|
|
43
43
|
let(:fixed_version_cookbook_one) do
|
|
44
44
|
instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
installed?: false,
|
|
46
|
+
name: "short-name",
|
|
47
|
+
version_constraint: ">= 0.0.0",
|
|
48
|
+
source_type: :git)
|
|
49
49
|
end
|
|
50
50
|
|
|
51
51
|
let(:fixed_version_cookbook_two) do
|
|
52
52
|
instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
installed?: true,
|
|
54
|
+
name: "this-name-is-longer",
|
|
55
|
+
version_constraint: "~> 10.0.0",
|
|
56
|
+
source_type: :path)
|
|
57
57
|
end
|
|
58
58
|
|
|
59
59
|
let(:fixed_version_cookbooks) do
|
|
@@ -80,16 +80,16 @@ describe ChefDK::Policyfile::Reports::Install do
|
|
|
80
80
|
|
|
81
81
|
let(:cookbook_one) do
|
|
82
82
|
instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
installed?: false,
|
|
84
|
+
name: "short-name",
|
|
85
|
+
version_constraint: Semverse::Constraint.new("= 10.0.4"))
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
let(:cookbook_two) do
|
|
89
89
|
instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
installed?: true,
|
|
91
|
+
name: "this-name-is-longer",
|
|
92
|
+
version_constraint: Semverse::Constraint.new("= 1.2.3"))
|
|
93
93
|
end
|
|
94
94
|
|
|
95
95
|
let(:graph_solution_cookbooks) do
|
|
@@ -50,9 +50,9 @@ describe ChefDK::Policyfile::Reports::Upload do
|
|
|
50
50
|
|
|
51
51
|
def cb_with_lock(name, version, identifier)
|
|
52
52
|
lock = instance_double("ChefDK::Policyfile::CookbookLock",
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
name: name,
|
|
54
|
+
version: version,
|
|
55
|
+
identifier: identifier)
|
|
56
56
|
|
|
57
57
|
ChefDK::Policyfile::Uploader::LockedCookbookForUpload.new(nil, lock)
|
|
58
58
|
end
|
|
@@ -48,7 +48,8 @@ describe ChefDK::Policyfile::Uploader do
|
|
|
48
48
|
|
|
49
49
|
let(:policyfile_lock) do
|
|
50
50
|
instance_double("ChefDK::PolicyfileLock", name: "example",
|
|
51
|
-
to_lock: policyfile_lock_data)
|
|
51
|
+
to_lock: policyfile_lock_data)
|
|
52
|
+
end
|
|
52
53
|
|
|
53
54
|
let(:policy_group) { "unit-test" }
|
|
54
55
|
|
|
@@ -58,9 +59,9 @@ describe ChefDK::Policyfile::Uploader do
|
|
|
58
59
|
|
|
59
60
|
let(:uploader) do
|
|
60
61
|
described_class.new(policyfile_lock,
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
policy_group,
|
|
63
|
+
http_client: http_client,
|
|
64
|
+
policy_document_native_api: policy_document_native_api)
|
|
64
65
|
end
|
|
65
66
|
|
|
66
67
|
let(:policyfile_as_data_bag_item) do
|
|
@@ -101,16 +102,16 @@ describe ChefDK::Policyfile::Uploader do
|
|
|
101
102
|
cache_path = "/home/user/cache_path/#{name}"
|
|
102
103
|
|
|
103
104
|
lock = instance_double("ChefDK::Policyfile::CookbookLock",
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
105
|
+
name: name,
|
|
106
|
+
version: "1.0.0",
|
|
107
|
+
identifier: identifier,
|
|
108
|
+
dotted_decimal_identifier: dotted_decimal_id,
|
|
109
|
+
cookbook_path: cache_path)
|
|
109
110
|
|
|
110
111
|
cookbook_version = instance_double("Chef::CookbookVersion",
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
name: name,
|
|
113
|
+
identifier: lock.identifier,
|
|
114
|
+
version: dotted_decimal_id)
|
|
114
115
|
|
|
115
116
|
allow(cookbook_version).to receive(:identifier=).with(lock.identifier)
|
|
116
117
|
|
|
@@ -208,10 +208,10 @@ describe ChefDK::PolicyfileCompiler, "when expressing the Policyfile graph deman
|
|
|
208
208
|
s << " #{remote_cb_source_opts}"
|
|
209
209
|
|
|
210
210
|
instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
211
|
+
name: "remote-cb",
|
|
212
|
+
version_constraint: Semverse::Constraint.new("= 1.1.1"),
|
|
213
|
+
ensure_cached: nil,
|
|
214
|
+
to_s: s)
|
|
215
215
|
end
|
|
216
216
|
|
|
217
217
|
before do
|
|
@@ -247,7 +247,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
247
247
|
|
|
248
248
|
it "emits a lockfile where cookbooks pulled from the upstream are at identical versions" do
|
|
249
249
|
expect(policyfile_lock.to_lock["solution_dependencies"]["dependencies"]).to(
|
|
250
|
-
have_key("cookbookC (2.0.0)")
|
|
250
|
+
have_key("cookbookC (2.0.0)")
|
|
251
|
+
)
|
|
251
252
|
end
|
|
252
253
|
end
|
|
253
254
|
|
|
@@ -266,7 +267,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
266
267
|
let(:run_list) { [] }
|
|
267
268
|
it "it defaults to those provided in the included policy lock" do
|
|
268
269
|
expect(policyfile_lock.to_lock["solution_dependencies"]["dependencies"]).to(
|
|
269
|
-
have_key("cookbookC (2.0.0)")
|
|
270
|
+
have_key("cookbookC (2.0.0)")
|
|
271
|
+
)
|
|
270
272
|
end
|
|
271
273
|
end
|
|
272
274
|
|
|
@@ -309,7 +311,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
309
311
|
|
|
310
312
|
it "solves the dependencies added by the top-level policyfile and emits them in the lockfile" do
|
|
311
313
|
expect(policyfile_lock.to_lock["solution_dependencies"]["dependencies"]).to(
|
|
312
|
-
have_key("cookbookC (2.0.0)")
|
|
314
|
+
have_key("cookbookC (2.0.0)")
|
|
315
|
+
)
|
|
313
316
|
end
|
|
314
317
|
|
|
315
318
|
end
|
|
@@ -375,7 +378,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
375
378
|
it "raises an error describing all attribute conflicts" do
|
|
376
379
|
expect { policyfile_lock.to_lock }.to raise_error(
|
|
377
380
|
ChefDK::Policyfile::AttributeMergeChecker::ConflictError,
|
|
378
|
-
"Attribute '[shared][foo]' provided conflicting values by the following sources [\"user-specified\", \"included\"]"
|
|
381
|
+
"Attribute '[shared][foo]' provided conflicting values by the following sources [\"user-specified\", \"included\"]"
|
|
382
|
+
)
|
|
379
383
|
end
|
|
380
384
|
end
|
|
381
385
|
end
|
|
@@ -425,7 +429,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
425
429
|
it "raises an error describing all attribute conflicts" do
|
|
426
430
|
expect { policyfile_lock.to_lock }.to raise_error(
|
|
427
431
|
ChefDK::Policyfile::AttributeMergeChecker::ConflictError,
|
|
428
|
-
"Attribute '[shared][foo]' provided conflicting values by the following sources [\"user-specified\", \"included\"]"
|
|
432
|
+
"Attribute '[shared][foo]' provided conflicting values by the following sources [\"user-specified\", \"included\"]"
|
|
433
|
+
)
|
|
429
434
|
end
|
|
430
435
|
end
|
|
431
436
|
end
|
|
@@ -652,7 +657,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
652
657
|
it "raises an error describing the conflict" do
|
|
653
658
|
expect { policyfile_lock }.to raise_error(
|
|
654
659
|
ChefDK::Policyfile::AttributeMergeChecker::ConflictError,
|
|
655
|
-
"Attribute '[conflict][foo]' provided conflicting values by the following sources [\"included\", \"included2\"]"
|
|
660
|
+
"Attribute '[conflict][foo]' provided conflicting values by the following sources [\"included\", \"included2\"]"
|
|
661
|
+
)
|
|
656
662
|
end
|
|
657
663
|
end
|
|
658
664
|
end
|
|
@@ -711,7 +717,8 @@ describe ChefDK::PolicyfileCompiler, "including upstream policy locks" do
|
|
|
711
717
|
it "raises an error describing the conflict" do
|
|
712
718
|
expect { policyfile_lock }.to raise_error(
|
|
713
719
|
ChefDK::Policyfile::AttributeMergeChecker::ConflictError,
|
|
714
|
-
"Attribute '[conflict][foo]' provided conflicting values by the following sources [\"included\", \"included2\"]"
|
|
720
|
+
"Attribute '[conflict][foo]' provided conflicting values by the following sources [\"included\", \"included2\"]"
|
|
721
|
+
)
|
|
715
722
|
end
|
|
716
723
|
end
|
|
717
724
|
end
|
|
@@ -162,10 +162,10 @@ describe ChefDK::PolicyfileLock, "installing cookbooks from included policies" d
|
|
|
162
162
|
|
|
163
163
|
allow(ChefDK::Policyfile::CookbookLocationSpecification).to receive(:new) do |cookbook_name, version_constraint, source_opts, storage_config|
|
|
164
164
|
double = instance_double("ChefDK::Policyfile::CookbookLocationSpecification",
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
name: cookbook_name,
|
|
166
|
+
version_constraint: Semverse::Constraint.new(version_constraint),
|
|
167
|
+
ensure_cached: nil,
|
|
168
|
+
to_s: "#{cookbook_name} #{version_constraint}")
|
|
169
169
|
allow(double).to receive(:cookbook_has_recipe?).and_return(true)
|
|
170
170
|
allow(double).to receive(:installed?).and_return(true)
|
|
171
171
|
allow(double).to receive(:mirrors_canonical_upstream?).and_return(true)
|
|
@@ -207,8 +207,8 @@ describe ChefDK::PolicyfileLock, "installing cookbooks from included policies" d
|
|
|
207
207
|
allow(mock).to receive(:validate!)
|
|
208
208
|
allow(mock).to receive(:cookbook_version) do
|
|
209
209
|
instance_double("Chef::CookbookVersion",
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
version: mock.source_options[:version],
|
|
211
|
+
manifest_records_by_path: [])
|
|
212
212
|
end
|
|
213
213
|
mock
|
|
214
214
|
end
|
|
@@ -226,7 +226,8 @@ describe ChefDK::PolicyfileLock, "installing cookbooks from included policies" d
|
|
|
226
226
|
"revision_id" => "myrevisionid",
|
|
227
227
|
"source_options" => lock_source_options,
|
|
228
228
|
},
|
|
229
|
-
]
|
|
229
|
+
]
|
|
230
|
+
)
|
|
230
231
|
end
|
|
231
232
|
end
|
|
232
233
|
end
|
|
@@ -30,7 +30,7 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
|
|
|
30
30
|
def expect_hash_equal(actual, expected)
|
|
31
31
|
expected.each do |key, expected_value|
|
|
32
32
|
expect(actual).to have_key(key)
|
|
33
|
-
if expected_value.
|
|
33
|
+
if expected_value.is_a?(Hash)
|
|
34
34
|
expect_hash_equal(actual[key], expected_value)
|
|
35
35
|
else
|
|
36
36
|
expect(actual[key]).to eq(expected_value)
|
|
@@ -876,18 +876,18 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
|
|
|
876
876
|
|
|
877
877
|
let(:cached_location_spec) do
|
|
878
878
|
double( "ChefDK::Policyfile::CookbookLocationSpecification",
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
879
|
+
mirrors_canonical_upstream?: true,
|
|
880
|
+
cache_key: "foo-1.0.0",
|
|
881
|
+
uri: cached_cookbook_uri,
|
|
882
|
+
source_options_for_lock: { "artifactserver" => cached_cookbook_uri, "version" => "1.0.0" })
|
|
883
883
|
end
|
|
884
884
|
|
|
885
885
|
let(:local_location_spec) do
|
|
886
886
|
double( "ChefDK::Policyfile::CookbookLocationSpecification",
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
887
|
+
mirrors_canonical_upstream?: false,
|
|
888
|
+
relative_paths_root: relative_paths_root,
|
|
889
|
+
relative_path: "bar",
|
|
890
|
+
source_options_for_lock: { "path" => "bar" })
|
|
891
891
|
end
|
|
892
892
|
|
|
893
893
|
let(:policyfile_solution_dependencies) do
|
|
@@ -933,15 +933,14 @@ describe ChefDK::PolicyfileLock, "building a lockfile" do
|
|
|
933
933
|
|
|
934
934
|
let(:policyfile_compiler) do
|
|
935
935
|
double( "ChefDK::PolicyfileCompiler",
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
)
|
|
936
|
+
name: "my-policyfile",
|
|
937
|
+
normalized_run_list: %w{recipe[foo::default] recipe[bar::default]},
|
|
938
|
+
normalized_named_run_lists: { "rl2" => %w{recipe[bar::default]} },
|
|
939
|
+
all_cookbook_location_specs: { "foo" => cached_location_spec, "bar" => local_location_spec },
|
|
940
|
+
solution_dependencies: policyfile_solution_dependencies,
|
|
941
|
+
default_attributes: policyfile_default_attrs,
|
|
942
|
+
override_attributes: policyfile_override_attrs,
|
|
943
|
+
included_policies: [])
|
|
945
944
|
end
|
|
946
945
|
|
|
947
946
|
let(:policyfile_lock) do
|
|
@@ -78,9 +78,9 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
|
|
|
78
78
|
|
|
79
79
|
let(:chef_config) do
|
|
80
80
|
double("Chef::Config",
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
chef_server_url: "https://localhost:10443",
|
|
82
|
+
client_key: "/path/to/client/key.pem",
|
|
83
|
+
node_name: "deuce")
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
subject(:clean_policy_cookbooks_service) do
|
|
@@ -89,8 +89,8 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
|
|
|
89
89
|
|
|
90
90
|
it "configures an HTTP client with the user's credentials" do
|
|
91
91
|
expect(Chef::ServerAPI).to receive(:new).with("https://localhost:10443",
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
signing_key_filename: "/path/to/client/key.pem",
|
|
93
|
+
client_name: "deuce")
|
|
94
94
|
clean_policy_cookbooks_service.http_client
|
|
95
95
|
end
|
|
96
96
|
|
|
@@ -98,10 +98,10 @@ describe ChefDK::PolicyfileServices::PushArchive do
|
|
|
98
98
|
|
|
99
99
|
let(:config) do
|
|
100
100
|
double("Chef::Config",
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
chef_server_url: "https://localhost:10443",
|
|
102
|
+
client_key: "/path/to/client/key.pem",
|
|
103
|
+
node_name: "deuce",
|
|
104
|
+
policy_document_native_api: true)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
let(:ui) { TestHelpers::TestUI.new }
|
|
@@ -121,8 +121,8 @@ describe ChefDK::PolicyfileServices::PushArchive do
|
|
|
121
121
|
|
|
122
122
|
it "configures an HTTP client" do
|
|
123
123
|
expect(Chef::ServerAPI).to receive(:new).with("https://localhost:10443",
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
signing_key_filename: "/path/to/client/key.pem",
|
|
125
|
+
client_name: "deuce")
|
|
126
126
|
push_archive_service.http_client
|
|
127
127
|
end
|
|
128
128
|
|
|
@@ -48,10 +48,10 @@ describe ChefDK::PolicyfileServices::Push do
|
|
|
48
48
|
|
|
49
49
|
let(:config) do
|
|
50
50
|
double("Chef::Config",
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
chef_server_url: "https://localhost:10443",
|
|
52
|
+
client_key: "/path/to/client/key.pem",
|
|
53
|
+
node_name: "deuce",
|
|
54
|
+
policy_document_native_api: policy_document_native_api)
|
|
55
55
|
end
|
|
56
56
|
|
|
57
57
|
let(:ui) { TestHelpers::TestUI.new }
|
|
@@ -60,8 +60,8 @@ describe ChefDK::PolicyfileServices::Push do
|
|
|
60
60
|
|
|
61
61
|
it "configures an HTTP client" do
|
|
62
62
|
expect(Chef::ServerAPI).to receive(:new).with("https://localhost:10443",
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
signing_key_filename: "/path/to/client/key.pem",
|
|
64
|
+
client_name: "deuce")
|
|
65
65
|
push_service.http_client
|
|
66
66
|
end
|
|
67
67
|
|
|
@@ -190,8 +190,8 @@ describe ChefDK::PolicyfileServices::Push do
|
|
|
190
190
|
expect(push_service).to receive(:http_client).and_return(http_client)
|
|
191
191
|
|
|
192
192
|
expect(ChefDK::Policyfile::Uploader).to receive(:new)
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
.with(push_service.policyfile_lock, policy_group, http_client: http_client, ui: ui, policy_document_native_api: policy_document_native_api)
|
|
194
|
+
.and_return(uploader)
|
|
195
195
|
end
|
|
196
196
|
|
|
197
197
|
context "when the policy document native API is disabled" do
|