chef-dk 3.3.23 → 3.4.38
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -7
- data/Gemfile.lock +91 -82
- data/lib/chef-dk/cli.rb +13 -13
- data/lib/chef-dk/command/base.rb +8 -8
- data/lib/chef-dk/command/clean_policy_cookbooks.rb +10 -10
- data/lib/chef-dk/command/clean_policy_revisions.rb +9 -9
- data/lib/chef-dk/command/delete_policy.rb +9 -9
- data/lib/chef-dk/command/delete_policy_group.rb +9 -9
- data/lib/chef-dk/command/diff.rb +35 -35
- data/lib/chef-dk/command/export.rb +11 -11
- data/lib/chef-dk/command/generate.rb +3 -3
- data/lib/chef-dk/command/generator_commands.rb +24 -24
- data/lib/chef-dk/command/generator_commands/build_cookbook.rb +3 -3
- data/lib/chef-dk/command/generator_commands/chef_exts/generator_desc_resource.rb +1 -1
- data/lib/chef-dk/command/generator_commands/cookbook.rb +3 -3
- data/lib/chef-dk/command/generator_commands/cookbook_file.rb +3 -3
- data/lib/chef-dk/command/generator_commands/generator_generator.rb +5 -5
- data/lib/chef-dk/command/generator_commands/template.rb +3 -3
- data/lib/chef-dk/command/install.rb +11 -11
- data/lib/chef-dk/command/provision.rb +32 -32
- data/lib/chef-dk/command/push.rb +9 -9
- data/lib/chef-dk/command/push_archive.rb +9 -9
- data/lib/chef-dk/command/shell_init.rb +21 -21
- data/lib/chef-dk/command/show_policy.rb +11 -11
- data/lib/chef-dk/command/undelete.rb +17 -17
- data/lib/chef-dk/command/update.rb +12 -12
- data/lib/chef-dk/command/verify.rb +63 -63
- data/lib/chef-dk/component_test.rb +3 -3
- data/lib/chef-dk/exceptions.rb +5 -5
- data/lib/chef-dk/generator.rb +61 -61
- data/lib/chef-dk/helpers.rb +1 -1
- data/lib/chef-dk/policyfile/cookbook_location_specification.rb +1 -1
- data/lib/chef-dk/policyfile/cookbook_locks.rb +1 -1
- data/lib/chef-dk/policyfile/git_lock_fetcher.rb +7 -7
- data/lib/chef-dk/policyfile/policyfile_location_specification.rb +1 -1
- data/lib/chef-dk/policyfile/uploader.rb +4 -4
- data/lib/chef-dk/policyfile_compiler.rb +1 -1
- data/lib/chef-dk/policyfile_services/export_repo.rb +49 -49
- data/lib/chef-dk/policyfile_services/install.rb +3 -3
- data/lib/chef-dk/policyfile_services/push_archive.rb +5 -5
- data/lib/chef-dk/policyfile_services/rm_policy_group.rb +1 -1
- data/lib/chef-dk/policyfile_services/update_attributes.rb +2 -2
- data/lib/chef-dk/service_exception_inspectors/http.rb +9 -9
- data/lib/chef-dk/skeletons/code_generator/recipes/recipe.rb +6 -6
- data/lib/chef-dk/version.rb +1 -1
- data/lib/kitchen/provisioner/policyfile_zero.rb +9 -9
- data/omnibus_overrides.rb +1 -1
- data/spec/spec_helper.rb +3 -3
- data/spec/unit/cli_spec.rb +9 -9
- data/spec/unit/command/base_spec.rb +25 -25
- data/spec/unit/command/clean_policy_cookbooks_spec.rb +6 -6
- data/spec/unit/command/clean_policy_revisions_spec.rb +6 -6
- data/spec/unit/command/delete_policy_group_spec.rb +6 -6
- data/spec/unit/command/delete_policy_spec.rb +6 -6
- data/spec/unit/command/export_spec.rb +10 -10
- data/spec/unit/command/generate_spec.rb +5 -5
- data/spec/unit/command/generator_commands/build_cookbook_spec.rb +15 -15
- data/spec/unit/command/generator_commands/cookbook_spec.rb +174 -174
- data/spec/unit/command/generator_commands/generator_generator_spec.rb +5 -5
- data/spec/unit/command/generator_commands/policyfile_spec.rb +15 -15
- data/spec/unit/command/generator_commands/repo_spec.rb +16 -16
- data/spec/unit/command/install_spec.rb +15 -15
- data/spec/unit/command/provision_spec.rb +25 -25
- data/spec/unit/command/push_spec.rb +12 -12
- data/spec/unit/command/shell_init_spec.rb +59 -59
- data/spec/unit/command/show_policy_spec.rb +6 -6
- data/spec/unit/command/undelete_spec.rb +6 -6
- data/spec/unit/command/update_spec.rb +30 -30
- data/spec/unit/fixtures/command/cli_test_command.rb +1 -1
- data/spec/unit/policyfile/chef_server_lock_fetcher_spec.rb +41 -41
- data/spec/unit/policyfile/comparison_base_spec.rb +38 -38
- data/spec/unit/policyfile/cookbook_locks_spec.rb +3 -3
- data/spec/unit/policyfile/differ_spec.rb +361 -361
- data/spec/unit/policyfile/git_lock_fetcher_spec.rb +34 -34
- data/spec/unit/policyfile/included_policies_cookbook_source_spec.rb +6 -6
- data/spec/unit/policyfile/local_lock_fetcher_spec.rb +35 -35
- data/spec/unit/policyfile/lock_applier_spec.rb +6 -6
- data/spec/unit/policyfile/reports/upload_spec.rb +5 -5
- data/spec/unit/policyfile/uploader_spec.rb +27 -27
- data/spec/unit/policyfile_demands_spec.rb +84 -84
- data/spec/unit/policyfile_evaluation_spec.rb +14 -14
- data/spec/unit/policyfile_includes_spec.rb +1 -1
- data/spec/unit/policyfile_install_with_includes_spec.rb +3 -3
- data/spec/unit/policyfile_lock_build_spec.rb +58 -58
- data/spec/unit/policyfile_lock_validation_spec.rb +108 -108
- data/spec/unit/policyfile_services/clean_policies_spec.rb +12 -12
- data/spec/unit/policyfile_services/clean_policy_cookbooks_spec.rb +9 -9
- data/spec/unit/policyfile_services/export_repo_spec.rb +64 -64
- data/spec/unit/policyfile_services/install_spec.rb +4 -4
- data/spec/unit/policyfile_services/push_archive_spec.rb +41 -41
- data/spec/unit/policyfile_services/push_spec.rb +38 -38
- data/spec/unit/policyfile_services/rm_policy_group_spec.rb +12 -12
- data/spec/unit/policyfile_services/rm_policy_spec.rb +6 -6
- data/spec/unit/policyfile_services/show_policy_spec.rb +161 -161
- data/spec/unit/policyfile_services/undelete_spec.rb +13 -13
- data/spec/unit/policyfile_services/update_attributes_spec.rb +6 -6
- data/spec/unit/policyfile_services/update_spec.rb +7 -7
- data/spec/unit/service_exception_inspectors/http_spec.rb +12 -12
- metadata +2 -2
@@ -177,9 +177,9 @@ describe ChefDK::PolicyfileServices::CleanPolicies do
|
|
177
177
|
|
178
178
|
it "deletes the orphaned policies" do
|
179
179
|
clean_policies_service.run
|
180
|
-
expected_message =
|
181
|
-
DELETE appserver 4444444444444444444444444444444444444444444444444444444444444444
|
182
|
-
DELETE load-balancer 7777777777777777777777777777777777777777777777777777777777777777
|
180
|
+
expected_message = <<~MESSAGE
|
181
|
+
DELETE appserver 4444444444444444444444444444444444444444444444444444444444444444
|
182
|
+
DELETE load-balancer 7777777777777777777777777777777777777777777777777777777777777777
|
183
183
|
MESSAGE
|
184
184
|
expect(ui.output).to eq(expected_message)
|
185
185
|
end
|
@@ -204,24 +204,24 @@ MESSAGE
|
|
204
204
|
end
|
205
205
|
|
206
206
|
before do
|
207
|
-
expect(http_client).to receive(:delete)
|
208
|
-
with("/policies/appserver/revisions/4444444444444444444444444444444444444444444444444444444444444444")
|
209
|
-
and_raise(http_exception)
|
207
|
+
expect(http_client).to receive(:delete)
|
208
|
+
.with("/policies/appserver/revisions/4444444444444444444444444444444444444444444444444444444444444444")
|
209
|
+
.and_raise(http_exception)
|
210
210
|
expect(http_client).to receive(:delete).with("/policies/load-balancer/revisions/7777777777777777777777777777777777777777777777777777777777777777")
|
211
211
|
end
|
212
212
|
|
213
213
|
it "deletes what it can, then raises an error" do
|
214
|
-
expected_message =
|
215
|
-
Failed to delete some policy revisions:
|
216
|
-
- appserver (4444444444444444444444444444444444444444444444444444444444444444): Net::HTTPServerException 403 \"Unauthorized\"
|
214
|
+
expected_message = <<~ERROR
|
215
|
+
Failed to delete some policy revisions:
|
216
|
+
- appserver (4444444444444444444444444444444444444444444444444444444444444444): Net::HTTPServerException 403 \"Unauthorized\"
|
217
217
|
ERROR
|
218
218
|
|
219
219
|
expect { clean_policies_service.run }.to raise_error do |error|
|
220
220
|
expect(error.message).to eq(expected_message)
|
221
221
|
end
|
222
|
-
expected_message =
|
223
|
-
DELETE appserver 4444444444444444444444444444444444444444444444444444444444444444
|
224
|
-
DELETE load-balancer 7777777777777777777777777777777777777777777777777777777777777777
|
222
|
+
expected_message = <<~MESSAGE
|
223
|
+
DELETE appserver 4444444444444444444444444444444444444444444444444444444444444444
|
224
|
+
DELETE load-balancer 7777777777777777777777777777777777777777777777777777777777777777
|
225
225
|
MESSAGE
|
226
226
|
expect(ui.output).to eq(expected_message)
|
227
227
|
end
|
@@ -183,15 +183,15 @@ describe ChefDK::PolicyfileServices::CleanPolicyCookbooks do
|
|
183
183
|
end
|
184
184
|
|
185
185
|
before do
|
186
|
-
allow(http_client).to receive(:get)
|
187
|
-
with("/policies/aar/revisions/37f9b658cdd1d9319bac8920581723efcc2014304b5f3827ee0779e10ffbdcc9")
|
188
|
-
and_return(policy_aar_37f9b65)
|
189
|
-
allow(http_client).to receive(:get)
|
190
|
-
with("/policies/jenkins/revisions/613f803bdd035d574df7fa6da525b38df45a74ca82b38b79655efed8a189e073")
|
191
|
-
and_return(policy_jenkins_613f803)
|
192
|
-
allow(http_client).to receive(:get)
|
193
|
-
with("/policies/jenkins/revisions/6fe753184c8946052d3231bb4212116df28d89a3a5f7ae52832ad408419dd5eb")
|
194
|
-
and_return(policy_jenkins_6fe7531)
|
186
|
+
allow(http_client).to receive(:get)
|
187
|
+
.with("/policies/aar/revisions/37f9b658cdd1d9319bac8920581723efcc2014304b5f3827ee0779e10ffbdcc9")
|
188
|
+
.and_return(policy_aar_37f9b65)
|
189
|
+
allow(http_client).to receive(:get)
|
190
|
+
.with("/policies/jenkins/revisions/613f803bdd035d574df7fa6da525b38df45a74ca82b38b79655efed8a189e073")
|
191
|
+
.and_return(policy_jenkins_613f803)
|
192
|
+
allow(http_client).to receive(:get)
|
193
|
+
.with("/policies/jenkins/revisions/6fe753184c8946052d3231bb4212116df28d89a3a5f7ae52832ad408419dd5eb")
|
194
|
+
.and_return(policy_jenkins_6fe7531)
|
195
195
|
end
|
196
196
|
|
197
197
|
context "and all cookbooks are active" do
|
@@ -109,42 +109,42 @@ describe ChefDK::PolicyfileServices::ExportRepo do
|
|
109
109
|
let(:revision_id) { "7da81d2c7bb97f904637f97e7f8b487fa4bb1ed682edea7087743dec84c254ec" }
|
110
110
|
|
111
111
|
let(:lockfile_content) do
|
112
|
-
|
113
|
-
{
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
}
|
112
|
+
<<~E
|
113
|
+
{
|
114
|
+
"revision_id": "#{revision_id}",
|
115
|
+
"name": "install-example",
|
116
|
+
"run_list": [
|
117
|
+
"recipe[local-cookbook::default]"
|
118
|
+
],
|
119
|
+
"cookbook_locks": {
|
120
|
+
"local-cookbook": {
|
121
|
+
"version": "2.3.4",
|
122
|
+
"identifier": "1e9dfd1134735385b425c056cb5decef9081b92c",
|
123
|
+
"dotted_decimal_identifier": "42704157235437826.6970356709321892.63549625984142",
|
124
|
+
"source": "#{local_cookbook_path}",
|
125
|
+
"cache_key": null,
|
126
|
+
"scm_info": null,
|
127
|
+
"source_options": {
|
128
|
+
"path": "#{local_cookbook_path}"
|
129
|
+
}
|
130
|
+
}
|
131
|
+
},
|
132
|
+
"default_attributes": {},
|
133
|
+
"override_attributes": {},
|
134
|
+
"solution_dependencies": {
|
135
|
+
"Policyfile": [
|
136
|
+
[
|
137
|
+
"local-cookbook",
|
138
|
+
">= 0.0.0"
|
139
|
+
]
|
140
|
+
],
|
141
|
+
"dependencies": {
|
142
|
+
"local-cookbook (2.3.4)": [
|
143
|
+
|
144
|
+
]
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
148
|
E
|
149
149
|
end
|
150
150
|
|
@@ -268,32 +268,32 @@ E
|
|
268
268
|
end
|
269
269
|
|
270
270
|
it "creates a working local mode configuration file" do
|
271
|
-
expected_config_text =
|
272
|
-
### Chef Client Configuration ###
|
273
|
-
# The settings in this file will configure chef to apply the exported policy in
|
274
|
-
# this directory. To use it, run:
|
275
|
-
#
|
276
|
-
# chef-client -z
|
277
|
-
#
|
278
|
-
|
279
|
-
policy_name 'install-example'
|
280
|
-
policy_group 'local'
|
281
|
-
|
282
|
-
use_policyfile true
|
283
|
-
policy_document_native_api true
|
284
|
-
|
285
|
-
# In order to use this repo, you need a version of Chef Client and Chef Zero
|
286
|
-
# that supports policyfile "native mode" APIs:
|
287
|
-
current_version = Gem::Version.new(Chef::VERSION)
|
288
|
-
unless Gem::Requirement.new(">= 12.7").satisfied_by?(current_version)
|
289
|
-
|
290
|
-
|
291
|
-
This Chef Repo requires features introduced in Chef 12.7, but you are using
|
292
|
-
Chef \#{Chef::VERSION}. Please upgrade to Chef 12.7 or later.
|
293
|
-
MESSAGE
|
294
|
-
|
295
|
-
|
296
|
-
end
|
271
|
+
expected_config_text = <<~CONFIG
|
272
|
+
### Chef Client Configuration ###
|
273
|
+
# The settings in this file will configure chef to apply the exported policy in
|
274
|
+
# this directory. To use it, run:
|
275
|
+
#
|
276
|
+
# chef-client -z
|
277
|
+
#
|
278
|
+
|
279
|
+
policy_name 'install-example'
|
280
|
+
policy_group 'local'
|
281
|
+
|
282
|
+
use_policyfile true
|
283
|
+
policy_document_native_api true
|
284
|
+
|
285
|
+
# In order to use this repo, you need a version of Chef Client and Chef Zero
|
286
|
+
# that supports policyfile "native mode" APIs:
|
287
|
+
current_version = Gem::Version.new(Chef::VERSION)
|
288
|
+
unless Gem::Requirement.new(">= 12.7").satisfied_by?(current_version)
|
289
|
+
puts("!" * 80)
|
290
|
+
puts(<<-MESSAGE)
|
291
|
+
This Chef Repo requires features introduced in Chef 12.7, but you are using
|
292
|
+
Chef \#{Chef::VERSION}. Please upgrade to Chef 12.7 or later.
|
293
|
+
MESSAGE
|
294
|
+
puts("!" * 80)
|
295
|
+
exit!(1)
|
296
|
+
end
|
297
297
|
|
298
298
|
CONFIG
|
299
299
|
config_path = File.join(export_dir, ".chef", "config.rb")
|
@@ -317,8 +317,8 @@ CONFIG
|
|
317
317
|
|
318
318
|
before do
|
319
319
|
allow(export_service.policyfile_lock).to receive(:validate_cookbooks!).and_return(true)
|
320
|
-
expect(export_service).to receive(:create_repo_structure)
|
321
|
-
and_raise(Errno::EACCES.new("Permission denied @ rb_sysopen - /etc/foobarbaz.txt"))
|
320
|
+
expect(export_service).to receive(:create_repo_structure)
|
321
|
+
.and_raise(Errno::EACCES.new("Permission denied @ rb_sysopen - /etc/foobarbaz.txt"))
|
322
322
|
end
|
323
323
|
|
324
324
|
it "wraps the error in a custom error class" do
|
@@ -43,12 +43,12 @@ describe ChefDK::PolicyfileServices::Install do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
let(:policyfile_content) do
|
46
|
-
|
47
|
-
name 'install-example'
|
46
|
+
<<~E
|
47
|
+
name 'install-example'
|
48
48
|
|
49
|
-
run_list 'local-cookbook'
|
49
|
+
run_list 'local-cookbook'
|
50
50
|
|
51
|
-
cookbook 'local-cookbook', path: '#{local_cookbooks_root}/local-cookbook'
|
51
|
+
cookbook 'local-cookbook', path: '#{local_cookbooks_root}/local-cookbook'
|
52
52
|
E
|
53
53
|
end
|
54
54
|
|
@@ -42,41 +42,41 @@ describe ChefDK::PolicyfileServices::PushArchive do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
let(:valid_lockfile) do
|
45
|
-
|
46
|
-
{
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
45
|
+
<<~E
|
46
|
+
{
|
47
|
+
"name": "install-example",
|
48
|
+
"run_list": [
|
49
|
+
"recipe[local-cookbook::default]"
|
50
|
+
],
|
51
|
+
"cookbook_locks": {
|
52
|
+
"local-cookbook": {
|
53
|
+
"version": "2.3.4",
|
54
|
+
"identifier": "fab501cfaf747901bd82c1bc706beae7dc3a350c",
|
55
|
+
"dotted_decimal_identifier": "70567763561641081.489844270461035.258281553147148",
|
56
|
+
"source": "project-cookbooks/local-cookbook",
|
57
|
+
"cache_key": null,
|
58
|
+
"scm_info": null,
|
59
|
+
"source_options": {
|
60
|
+
"path": "project-cookbooks/local-cookbook"
|
61
|
+
}
|
62
|
+
}
|
63
|
+
},
|
64
|
+
"default_attributes": {},
|
65
|
+
"override_attributes": {},
|
66
|
+
"solution_dependencies": {
|
67
|
+
"Policyfile": [
|
68
|
+
[
|
69
|
+
"local-cookbook",
|
70
|
+
">= 0.0.0"
|
71
|
+
]
|
72
|
+
],
|
73
|
+
"dependencies": {
|
74
|
+
"local-cookbook (2.3.4)": [
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
}
|
76
|
+
]
|
77
|
+
}
|
78
|
+
}
|
79
|
+
}
|
80
80
|
E
|
81
81
|
end
|
82
82
|
|
@@ -283,12 +283,12 @@ E
|
|
283
283
|
expect(exception.message).to eq("Failed to publish archived policy")
|
284
284
|
expect(exception_cause).to be_a(ChefDK::InvalidPolicyArchive)
|
285
285
|
|
286
|
-
msg =
|
287
|
-
This archive is in an unsupported format.
|
286
|
+
msg = <<~MESSAGE
|
287
|
+
This archive is in an unsupported format.
|
288
288
|
|
289
|
-
This archive was created with an older version of ChefDK. This version of
|
290
|
-
ChefDK does not support archives in the older format. Re-create the archive
|
291
|
-
with a newer version of ChefDK or downgrade ChefDK.
|
289
|
+
This archive was created with an older version of ChefDK. This version of
|
290
|
+
ChefDK does not support archives in the older format. Re-create the archive
|
291
|
+
with a newer version of ChefDK or downgrade ChefDK.
|
292
292
|
MESSAGE
|
293
293
|
expect(exception_cause.message).to eq(msg)
|
294
294
|
end
|
@@ -330,8 +330,8 @@ MESSAGE
|
|
330
330
|
|
331
331
|
expect(ChefDK::Policyfile::Uploader).to receive(:new).
|
332
332
|
# TODO: need more verification that the policyfile.lock is right (?)
|
333
|
-
with(an_instance_of(ChefDK::PolicyfileLock), policy_group, http_client: http_client, ui: ui, policy_document_native_api: true)
|
334
|
-
and_return(uploader)
|
333
|
+
with(an_instance_of(ChefDK::PolicyfileLock), policy_group, http_client: http_client, ui: ui, policy_document_native_api: true)
|
334
|
+
.and_return(uploader)
|
335
335
|
|
336
336
|
create_archive
|
337
337
|
end
|
@@ -142,41 +142,41 @@ describe ChefDK::PolicyfileServices::Push do
|
|
142
142
|
let(:local_cookbook_path) { File.join(fixtures_path, "local_path_cookbooks/local-cookbook") }
|
143
143
|
|
144
144
|
let(:lockfile_content) do
|
145
|
-
|
146
|
-
{
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
}
|
145
|
+
<<~E
|
146
|
+
{
|
147
|
+
"name": "install-example",
|
148
|
+
"run_list": [
|
149
|
+
"recipe[local-cookbook::default]"
|
150
|
+
],
|
151
|
+
"cookbook_locks": {
|
152
|
+
"local-cookbook": {
|
153
|
+
"version": "2.3.4",
|
154
|
+
"identifier": "fab501cfaf747901bd82c1bc706beae7dc3a350c",
|
155
|
+
"dotted_decimal_identifier": "70567763561641081.489844270461035.258281553147148",
|
156
|
+
"source": "#{local_cookbook_path}",
|
157
|
+
"cache_key": null,
|
158
|
+
"scm_info": null,
|
159
|
+
"source_options": {
|
160
|
+
"path": "#{local_cookbook_path}"
|
161
|
+
}
|
162
|
+
}
|
163
|
+
},
|
164
|
+
"default_attributes": {},
|
165
|
+
"override_attributes": {},
|
166
|
+
"solution_dependencies": {
|
167
|
+
"Policyfile": [
|
168
|
+
[
|
169
|
+
"local-cookbook",
|
170
|
+
">= 0.0.0"
|
171
|
+
]
|
172
|
+
],
|
173
|
+
"dependencies": {
|
174
|
+
"local-cookbook (2.3.4)": [
|
175
|
+
|
176
|
+
]
|
177
|
+
}
|
178
|
+
}
|
179
|
+
}
|
180
180
|
E
|
181
181
|
end
|
182
182
|
|
@@ -189,9 +189,9 @@ E
|
|
189
189
|
before do
|
190
190
|
expect(push_service).to receive(:http_client).and_return(http_client)
|
191
191
|
|
192
|
-
expect(ChefDK::Policyfile::Uploader).to receive(:new)
|
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)
|
192
|
+
expect(ChefDK::Policyfile::Uploader).to receive(:new)
|
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
|
@@ -120,9 +120,9 @@ describe ChefDK::PolicyfileServices::RmPolicyGroup do
|
|
120
120
|
|
121
121
|
before do
|
122
122
|
expect(http_client).to receive(:get).with("/policy_groups").and_return(non_empty_policy_groups)
|
123
|
-
expect(http_client).to receive(:get)
|
124
|
-
with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
|
125
|
-
and_raise(http_exception)
|
123
|
+
expect(http_client).to receive(:get)
|
124
|
+
.with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
|
125
|
+
.and_raise(http_exception)
|
126
126
|
end
|
127
127
|
|
128
128
|
it "re-raises the error with a standardized exception class" do
|
@@ -198,15 +198,15 @@ describe ChefDK::PolicyfileServices::RmPolicyGroup do
|
|
198
198
|
before do
|
199
199
|
allow(rm_policy_group_service).to receive(:http_client).and_return(http_client)
|
200
200
|
expect(http_client).to receive(:get).with("/policy_groups").and_return(non_empty_policy_groups)
|
201
|
-
expect(http_client).to receive(:get)
|
202
|
-
with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
|
203
|
-
and_return(policy_appserver_2)
|
204
|
-
expect(http_client).to receive(:get)
|
205
|
-
with("/policies/load-balancer/revisions/5555555555555555555555555555555555555555555555555555555555555555")
|
206
|
-
and_return(policy_load_balancer_5)
|
207
|
-
expect(http_client).to receive(:get)
|
208
|
-
with("/policies/db/revisions/9999999999999999999999999999999999999999999999999999999999999999")
|
209
|
-
and_return(policy_db_9)
|
201
|
+
expect(http_client).to receive(:get)
|
202
|
+
.with("/policies/appserver/revisions/2222222222222222222222222222222222222222222222222222222222222222")
|
203
|
+
.and_return(policy_appserver_2)
|
204
|
+
expect(http_client).to receive(:get)
|
205
|
+
.with("/policies/load-balancer/revisions/5555555555555555555555555555555555555555555555555555555555555555")
|
206
|
+
.and_return(policy_load_balancer_5)
|
207
|
+
expect(http_client).to receive(:get)
|
208
|
+
.with("/policies/db/revisions/9999999999999999999999999999999999999999999999999999999999999999")
|
209
|
+
.and_return(policy_db_9)
|
210
210
|
|
211
211
|
expect(http_client).to receive(:delete).with("/policy_groups/preprod")
|
212
212
|
expect(undo_stack).to receive(:push).with(undo_record)
|