chef 13.2.20-universal-mingw32 → 13.3.42-universal-mingw32
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/CONTRIBUTING.md +1 -1
- data/Gemfile +2 -8
- data/README.md +6 -2
- data/Rakefile +0 -11
- data/VERSION +1 -1
- data/acceptance/Gemfile.lock +1 -1
- data/acceptance/data-collector/.acceptance/data-collector-test/files/default/api.rb +34 -18
- data/acceptance/data-collector/.acceptance/data-collector-test/recipes/default.rb +6 -0
- data/lib/chef/cookbook/metadata.rb +2 -2
- data/lib/chef/deprecation/warnings.rb +3 -1
- data/lib/chef/exceptions.rb +1 -1
- data/lib/chef/http.rb +9 -10
- data/lib/chef/http/api_versions.rb +2 -0
- data/lib/chef/http/http_request.rb +3 -0
- data/lib/chef/knife/core/bootstrap_context.rb +1 -0
- data/lib/chef/knife/core/status_presenter.rb +1 -1
- data/lib/chef/knife/ssh.rb +4 -0
- data/lib/chef/provider/apt_preference.rb +99 -0
- data/lib/chef/provider/execute.rb +3 -2
- data/lib/chef/provider/http_request.rb +14 -0
- data/lib/chef/provider/mount/aix.rb +49 -8
- data/lib/chef/provider/package/windows/registry_uninstall_entry.rb +1 -1
- data/lib/chef/provider/package/zypper.rb +5 -5
- data/lib/chef/provider/service/systemd.rb +12 -11
- data/lib/chef/provider/support/zypper_repo.erb +17 -0
- data/lib/chef/provider/systemd_unit.rb +3 -2
- data/lib/chef/provider/windows_task.rb +92 -71
- data/lib/chef/provider/zypper_repository.rb +81 -0
- data/lib/chef/providers.rb +2 -0
- data/lib/chef/resource/apt_preference.rb +36 -0
- data/lib/chef/resource/execute.rb +12 -2
- data/lib/chef/resource/http_request.rb +1 -1
- data/lib/chef/resource/zypper_repository.rb +51 -0
- data/lib/chef/resources.rb +2 -0
- data/lib/chef/search/query.rb +6 -1
- data/lib/chef/server_api_versions.rb +21 -2
- data/lib/chef/version.rb +3 -4
- data/lib/chef/win32/api/file.rb +1 -0
- data/lib/chef/win32/file.rb +2 -0
- data/lib/chef/win32/version.rb +6 -0
- data/spec/functional/knife/ssh_spec.rb +1 -1
- data/spec/functional/resource/execute_spec.rb +2 -2
- data/spec/spec_helper.rb +8 -1
- data/spec/unit/cookbook/metadata_spec.rb +3 -3
- data/spec/unit/http/api_versions_spec.rb +6 -3
- data/spec/unit/knife/bootstrap_spec.rb +4 -0
- data/spec/unit/knife/cookbook_show_spec.rb +3 -3
- data/spec/unit/knife/ssh_spec.rb +7 -1
- data/spec/unit/knife/status_spec.rb +2 -0
- data/spec/unit/provider/apt_preference_spec.rb +87 -0
- data/spec/unit/provider/apt_update_spec.rb +7 -7
- data/spec/unit/provider/dsc_resource_spec.rb +2 -2
- data/spec/unit/provider/execute_spec.rb +32 -14
- data/spec/unit/provider/mount/aix_spec.rb +33 -1
- data/spec/unit/provider/package/rubygems_spec.rb +1 -1
- data/spec/unit/provider/package/windows/registry_uninstall_entry_spec.rb +56 -3
- data/spec/unit/provider/package/windows_spec.rb +1 -1
- data/spec/unit/provider/package/zypper_spec.rb +43 -0
- data/spec/unit/provider/script_spec.rb +1 -1
- data/spec/unit/provider/service/systemd_service_spec.rb +23 -21
- data/spec/unit/provider/systemd_unit_spec.rb +42 -41
- data/spec/unit/provider/windows_task_spec.rb +40 -0
- data/spec/unit/resource/apt_preference_spec.rb +41 -0
- data/spec/unit/resource/execute_spec.rb +21 -1
- data/spec/unit/resource/powershell_script_spec.rb +2 -2
- data/spec/unit/resource/zypper_repository_spec.rb +65 -0
- data/spec/unit/search/query_spec.rb +13 -18
- data/spec/unit/server_api_spec.rb +75 -1
- data/spec/unit/server_api_versions_spec.rb +22 -0
- data/spec/unit/win32/link_spec.rb +73 -0
- data/tasks/dependencies.rb +0 -1
- metadata +14 -81
- data/acceptance/.bundle/config +0 -2
- data/acceptance/bin/aws.rb +0 -17
- data/acceptance/bin/berks +0 -17
- data/acceptance/bin/bundler +0 -17
- data/acceptance/bin/chef-acceptance +0 -17
- data/acceptance/bin/coderay +0 -17
- data/acceptance/bin/erubis +0 -17
- data/acceptance/bin/htmldiff +0 -17
- data/acceptance/bin/httpclient +0 -17
- data/acceptance/bin/inspec +0 -17
- data/acceptance/bin/kitchen +0 -17
- data/acceptance/bin/ldiff +0 -17
- data/acceptance/bin/nokogiri +0 -17
- data/acceptance/bin/pry +0 -17
- data/acceptance/bin/rake +0 -17
- data/acceptance/bin/rspec +0 -17
- data/acceptance/bin/rwinrm +0 -17
- data/acceptance/bin/rwinrmcp +0 -17
- data/acceptance/bin/safe_yaml +0 -17
- data/acceptance/bin/thor +0 -17
- data/acceptance/fips/.kitchen/fips-unit-functional-centos-6.yml +0 -7
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/action_set_name +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/creator_uid +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/id +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/index_uuid +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/private_key +0 -27
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/.vagrant/machines/default/virtualbox/synced_folders +0 -1
- data/acceptance/fips/.kitchen/kitchen-vagrant/kitchen-fips-fips-unit-functional-centos-6/Vagrantfile +0 -11
- data/acceptance/fips/.kitchen/logs/fips-integration-centos-6.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-integration-windows-2012r2.log +0 -0
- data/acceptance/fips/.kitchen/logs/fips-unit-functional-centos-6.log +0 -80
- data/acceptance/fips/.kitchen/logs/kitchen.log +0 -4
- data/tasks/changelog.rb +0 -37
- data/tasks/version.rb +0 -41
@@ -539,7 +539,7 @@ describe Chef::Provider::Package::Rubygems do
|
|
539
539
|
end
|
540
540
|
end
|
541
541
|
|
542
|
-
context "when the source is from the
|
542
|
+
context "when the source is from the rubygems_url" do
|
543
543
|
it "determines the candidate version by querying the remote gem servers" do
|
544
544
|
Chef::Config[:rubygems_url] = "https://mirror1/"
|
545
545
|
expect(provider.gem_env).to receive(:candidate_version_from_remote)
|
@@ -9,7 +9,7 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
|
|
9
9
|
describe "when QuietUninstallString key not present" do
|
10
10
|
let(:quiet_uninstall_string) { nil }
|
11
11
|
let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
|
12
|
-
it "
|
12
|
+
it "returns UninstallString key value" do
|
13
13
|
expect(quiet_uninstall_string_key).to eql "UninstallStringPath"
|
14
14
|
end
|
15
15
|
end
|
@@ -17,9 +17,62 @@ describe Chef::Provider::Package::Windows::RegistryUninstallEntry do
|
|
17
17
|
describe "when QuietUninstallString key present" do
|
18
18
|
let(:quiet_uninstall_string) { "QuietUninstallString" }
|
19
19
|
let (:quiet_uninstall_string_key) { Chef::Provider::Package::Windows::RegistryUninstallEntry.quiet_uninstall_string_key?(quiet_uninstall_string, hkey, key, entry).uninstall_string }
|
20
|
-
|
21
|
-
it "should return QuietUninstallString key value" do
|
20
|
+
it "returns QuietUninstallString key value" do
|
22
21
|
expect(quiet_uninstall_string_key).to eql "QuietUninstallStringPath"
|
23
22
|
end
|
24
23
|
end
|
24
|
+
|
25
|
+
describe ".find_entries", :windows_only do
|
26
|
+
let (:registry_uninstall_entry) { Chef::Provider::Package::Windows::RegistryUninstallEntry }
|
27
|
+
before(:each) do
|
28
|
+
allow_any_instance_of(::Win32::Registry).to receive(:open).and_return("::Win32::Registry::HKEY_CURRENT_USER")
|
29
|
+
end
|
30
|
+
|
31
|
+
context "when passing nil" do
|
32
|
+
let(:package_name) { nil }
|
33
|
+
it "returns empty entries array" do
|
34
|
+
allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(nil)
|
35
|
+
entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
|
36
|
+
expect(entries.size).to eql 0
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
context "when passing empty string" do
|
41
|
+
let(:package_name) { " " }
|
42
|
+
it "returns no entries" do
|
43
|
+
allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(nil)
|
44
|
+
entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
|
45
|
+
expect(entries.size).to eql 0
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
context "when package is not found" do
|
50
|
+
let(:package_name) { "hive" }
|
51
|
+
it "returns no entries" do
|
52
|
+
allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return("Chef Client")
|
53
|
+
entries = Chef::Provider::Package::Windows::RegistryUninstallEntry.find_entries(package_name)
|
54
|
+
expect(entries).to eql []
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
context "when trailing spaces are given in display name" do
|
59
|
+
let(:package_name) { "Chef" }
|
60
|
+
let(:display_name_with_space) { "Chef " }
|
61
|
+
it "removes the trailing spaces" do
|
62
|
+
allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(display_name_with_space)
|
63
|
+
entries = registry_uninstall_entry.find_entries(package_name).first
|
64
|
+
expect(entries.display_name.rstrip).to eql package_name
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
context "When package found successfully" do
|
69
|
+
let(:package_name) { "Chef Client" }
|
70
|
+
let(:display_name) { "Chef Client" }
|
71
|
+
it "returns 'Chef Client' entries" do
|
72
|
+
allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:read_registry_property).and_return(display_name)
|
73
|
+
entries = registry_uninstall_entry.find_entries(package_name).first
|
74
|
+
expect(entries.display_name.rstrip).to eql package_name
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
25
78
|
end
|
@@ -224,7 +224,7 @@ describe Chef::Provider::Package::Windows, :windows_only do
|
|
224
224
|
end
|
225
225
|
end
|
226
226
|
|
227
|
-
context "
|
227
|
+
context "uninstall entries is empty" do
|
228
228
|
before { allow(Chef::Provider::Package::Windows::RegistryUninstallEntry).to receive(:find_entries).and_return([]) }
|
229
229
|
|
230
230
|
it "returns nil" do
|
@@ -139,6 +139,14 @@ describe Chef::Provider::Package::Zypper do
|
|
139
139
|
)
|
140
140
|
provider.install_package(["emacs"], ["1.0"])
|
141
141
|
end
|
142
|
+
|
143
|
+
it "should add user provided options to the command" do
|
144
|
+
new_resource.options "--user-provided"
|
145
|
+
shell_out_expectation!(
|
146
|
+
"zypper", "--non-interactive", "install", "--user-provided", "--auto-agree-with-licenses", "emacs=1.0"
|
147
|
+
)
|
148
|
+
provider.install_package(["emacs"], ["1.0"])
|
149
|
+
end
|
142
150
|
end
|
143
151
|
|
144
152
|
describe "upgrade_package" do
|
@@ -162,6 +170,13 @@ describe Chef::Provider::Package::Zypper do
|
|
162
170
|
)
|
163
171
|
provider.upgrade_package(["emacs"], ["1.0"])
|
164
172
|
end
|
173
|
+
it "should add user provided options to the command" do
|
174
|
+
new_resource.options "--user-provided"
|
175
|
+
shell_out_expectation!(
|
176
|
+
"zypper", "--non-interactive", "install", "--user-provided", "--auto-agree-with-licenses", "emacs=1.0"
|
177
|
+
)
|
178
|
+
provider.upgrade_package(["emacs"], ["1.0"])
|
179
|
+
end
|
165
180
|
end
|
166
181
|
|
167
182
|
describe "remove_package" do
|
@@ -196,6 +211,13 @@ describe Chef::Provider::Package::Zypper do
|
|
196
211
|
)
|
197
212
|
provider.remove_package(["emacs"], ["1.0"])
|
198
213
|
end
|
214
|
+
it "should add user provided options to the command" do
|
215
|
+
new_resource.options "--user-provided"
|
216
|
+
shell_out_expectation!(
|
217
|
+
"zypper", "--non-interactive", "remove", "--user-provided", "emacs=1.0"
|
218
|
+
)
|
219
|
+
provider.remove_package(["emacs"], ["1.0"])
|
220
|
+
end
|
199
221
|
end
|
200
222
|
end
|
201
223
|
|
@@ -220,6 +242,13 @@ describe Chef::Provider::Package::Zypper do
|
|
220
242
|
)
|
221
243
|
provider.purge_package(["emacs"], ["1.0"])
|
222
244
|
end
|
245
|
+
it "should add user provided options to the command" do
|
246
|
+
new_resource.options "--user-provided"
|
247
|
+
shell_out_expectation!(
|
248
|
+
"zypper", "--non-interactive", "remove", "--user-provided", "--clean-deps", "emacs=1.0"
|
249
|
+
)
|
250
|
+
provider.purge_package(["emacs"], ["1.0"])
|
251
|
+
end
|
223
252
|
end
|
224
253
|
|
225
254
|
describe "lock_package" do
|
@@ -236,6 +265,13 @@ describe Chef::Provider::Package::Zypper do
|
|
236
265
|
)
|
237
266
|
provider.lock_package(["emacs"], [nil])
|
238
267
|
end
|
268
|
+
it "should add user provided options to the command" do
|
269
|
+
new_resource.options "--user-provided"
|
270
|
+
shell_out_expectation!(
|
271
|
+
"zypper", "--non-interactive", "addlock", "--user-provided", "emacs"
|
272
|
+
)
|
273
|
+
provider.lock_package(["emacs"], [nil])
|
274
|
+
end
|
239
275
|
end
|
240
276
|
|
241
277
|
describe "unlock_package" do
|
@@ -252,6 +288,13 @@ describe Chef::Provider::Package::Zypper do
|
|
252
288
|
)
|
253
289
|
provider.unlock_package(["emacs"], [nil])
|
254
290
|
end
|
291
|
+
it "should add user provided options to the command" do
|
292
|
+
new_resource.options "--user-provided"
|
293
|
+
shell_out_expectation!(
|
294
|
+
"zypper", "--non-interactive", "removelock", "--user-provided", "emacs"
|
295
|
+
)
|
296
|
+
provider.unlock_package(["emacs"], [nil])
|
297
|
+
end
|
255
298
|
end
|
256
299
|
|
257
300
|
describe "on an older zypper" do
|
@@ -143,7 +143,7 @@ describe Chef::Provider::Script, "action_run" do
|
|
143
143
|
end
|
144
144
|
|
145
145
|
it "should call shell_out! with the command" do
|
146
|
-
expect(provider).to receive(:
|
146
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with(provider.command, default_opts).and_return(true)
|
147
147
|
provider.action_run
|
148
148
|
end
|
149
149
|
|
@@ -36,7 +36,9 @@ describe Chef::Provider::Service::Systemd do
|
|
36
36
|
|
37
37
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
38
38
|
|
39
|
-
let(:service_name) { "rsyslog.service" }
|
39
|
+
let(:service_name) { "rsyslog\\x2d.service" }
|
40
|
+
|
41
|
+
let(:service_name_escaped) { "rsyslog\\\\x2d.service" }
|
40
42
|
|
41
43
|
let(:new_resource) { Chef::Resource::Service.new(service_name) }
|
42
44
|
|
@@ -182,13 +184,13 @@ describe Chef::Provider::Service::Systemd do
|
|
182
184
|
|
183
185
|
context "when a user is not specified" do
|
184
186
|
it "should call '#{systemctl_path} --system start service_name' if no start command is specified" do
|
185
|
-
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{
|
187
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name_escaped}", {}).and_return(shell_out_success)
|
186
188
|
provider.start_service
|
187
189
|
end
|
188
190
|
|
189
191
|
it "should not call '#{systemctl_path} --system start service_name' if it is already running" do
|
190
192
|
current_resource.running(true)
|
191
|
-
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{
|
193
|
+
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system start #{service_name_escaped}", {})
|
192
194
|
provider.start_service
|
193
195
|
end
|
194
196
|
end
|
@@ -196,14 +198,14 @@ describe Chef::Provider::Service::Systemd do
|
|
196
198
|
context "when a user is specified" do
|
197
199
|
it "should call '#{systemctl_path} --user start service_name' if no start command is specified" do
|
198
200
|
current_resource.user("joe")
|
199
|
-
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{
|
201
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" }).and_return(shell_out_success)
|
200
202
|
provider.start_service
|
201
203
|
end
|
202
204
|
|
203
205
|
it "should not call '#{systemctl_path} --user start service_name' if it is already running" do
|
204
206
|
current_resource.running(true)
|
205
207
|
current_resource.user("joe")
|
206
|
-
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{
|
208
|
+
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --user start #{service_name_escaped}", { :environment => { "DBUS_SESSION_BUS_ADDRESS" => "unix:path=/run/user/10000/bus" }, :user => "joe" })
|
207
209
|
provider.start_service
|
208
210
|
end
|
209
211
|
end
|
@@ -217,7 +219,7 @@ describe Chef::Provider::Service::Systemd do
|
|
217
219
|
|
218
220
|
it "should call '#{systemctl_path} --system restart service_name' if no restart command is specified" do
|
219
221
|
current_resource.running(true)
|
220
|
-
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system restart #{
|
222
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system restart #{service_name_escaped}", {}).and_return(shell_out_success)
|
221
223
|
provider.restart_service
|
222
224
|
end
|
223
225
|
|
@@ -234,7 +236,7 @@ describe Chef::Provider::Service::Systemd do
|
|
234
236
|
context "when a reload command is not specified" do
|
235
237
|
it "should call '#{systemctl_path} --system reload service_name' if the service is running" do
|
236
238
|
current_resource.running(true)
|
237
|
-
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system reload #{
|
239
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system reload #{service_name_escaped}", {}).and_return(shell_out_success)
|
238
240
|
provider.reload_service
|
239
241
|
end
|
240
242
|
|
@@ -255,13 +257,13 @@ describe Chef::Provider::Service::Systemd do
|
|
255
257
|
|
256
258
|
it "should call '#{systemctl_path} --system stop service_name' if no stop command is specified" do
|
257
259
|
current_resource.running(true)
|
258
|
-
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{
|
260
|
+
expect(provider).to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name_escaped}", {}).and_return(shell_out_success)
|
259
261
|
provider.stop_service
|
260
262
|
end
|
261
263
|
|
262
264
|
it "should not call '#{systemctl_path} --system stop service_name' if it is already stopped" do
|
263
265
|
current_resource.running(false)
|
264
|
-
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{
|
266
|
+
expect(provider).not_to receive(:shell_out_with_systems_locale!).with("#{systemctl_path} --system stop #{service_name_escaped}", {})
|
265
267
|
provider.stop_service
|
266
268
|
end
|
267
269
|
end
|
@@ -274,12 +276,12 @@ describe Chef::Provider::Service::Systemd do
|
|
274
276
|
end
|
275
277
|
|
276
278
|
it "should call '#{systemctl_path} --system enable service_name' to enable the service" do
|
277
|
-
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system enable #{
|
279
|
+
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system enable #{service_name_escaped}", {}).and_return(shell_out_success)
|
278
280
|
provider.enable_service
|
279
281
|
end
|
280
282
|
|
281
283
|
it "should call '#{systemctl_path} --system disable service_name' to disable the service" do
|
282
|
-
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system disable #{
|
284
|
+
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system disable #{service_name_escaped}", {}).and_return(shell_out_success)
|
283
285
|
provider.disable_service
|
284
286
|
end
|
285
287
|
end
|
@@ -292,12 +294,12 @@ describe Chef::Provider::Service::Systemd do
|
|
292
294
|
end
|
293
295
|
|
294
296
|
it "should call '#{systemctl_path} --system mask service_name' to mask the service" do
|
295
|
-
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system mask #{
|
297
|
+
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system mask #{service_name_escaped}", {}).and_return(shell_out_success)
|
296
298
|
provider.mask_service
|
297
299
|
end
|
298
300
|
|
299
301
|
it "should call '#{systemctl_path} --system unmask service_name' to unmask the service" do
|
300
|
-
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system unmask #{
|
302
|
+
expect(provider).to receive(:shell_out!).with("#{systemctl_path} --system unmask #{service_name_escaped}", {}).and_return(shell_out_success)
|
301
303
|
provider.unmask_service
|
302
304
|
end
|
303
305
|
end
|
@@ -310,12 +312,12 @@ describe Chef::Provider::Service::Systemd do
|
|
310
312
|
end
|
311
313
|
|
312
314
|
it "should return true if '#{systemctl_path} --system is-active service_name' returns 0" do
|
313
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{
|
315
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name_escaped} --quiet", {}).and_return(shell_out_success)
|
314
316
|
expect(provider.is_active?).to be true
|
315
317
|
end
|
316
318
|
|
317
319
|
it "should return false if '#{systemctl_path} --system is-active service_name' returns anything except 0" do
|
318
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{
|
320
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-active #{service_name_escaped} --quiet", {}).and_return(shell_out_failure)
|
319
321
|
expect(provider.is_active?).to be false
|
320
322
|
end
|
321
323
|
end
|
@@ -328,12 +330,12 @@ describe Chef::Provider::Service::Systemd do
|
|
328
330
|
end
|
329
331
|
|
330
332
|
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 0" do
|
331
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
333
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped} --quiet", {}).and_return(shell_out_success)
|
332
334
|
expect(provider.is_enabled?).to be true
|
333
335
|
end
|
334
336
|
|
335
337
|
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns anything except 0" do
|
336
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
338
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped} --quiet", {}).and_return(shell_out_failure)
|
337
339
|
expect(provider.is_enabled?).to be false
|
338
340
|
end
|
339
341
|
end
|
@@ -346,22 +348,22 @@ describe Chef::Provider::Service::Systemd do
|
|
346
348
|
end
|
347
349
|
|
348
350
|
it "should return true if '#{systemctl_path} --system is-enabled service_name' returns 'masked' and returns anything except 0" do
|
349
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
351
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked", :exitstatus => shell_out_failure))
|
350
352
|
expect(provider.is_masked?).to be true
|
351
353
|
end
|
352
354
|
|
353
355
|
it "should return true if '#{systemctl_path} --system is-enabled service_name' outputs 'masked-runtime' and returns anything except 0" do
|
354
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
356
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "masked-runtime", :exitstatus => shell_out_failure))
|
355
357
|
expect(provider.is_masked?).to be true
|
356
358
|
end
|
357
359
|
|
358
360
|
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns 0" do
|
359
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
361
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "enabled", :exitstatus => shell_out_success))
|
360
362
|
expect(provider.is_masked?).to be false
|
361
363
|
end
|
362
364
|
|
363
365
|
it "should return false if '#{systemctl_path} --system is-enabled service_name' returns anything except 0 and outputs an error'" do
|
364
|
-
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{
|
366
|
+
expect(provider).to receive(:shell_out).with("#{systemctl_path} --system is-enabled #{service_name_escaped}", {}).and_return(double(:stdout => "Failed to get unit file state for #{service_name}: No such file or directory", :exitstatus => shell_out_failure))
|
365
367
|
expect(provider.is_masked?).to be false
|
366
368
|
end
|
367
369
|
end
|
@@ -32,13 +32,14 @@ describe Chef::Provider::SystemdUnit do
|
|
32
32
|
|
33
33
|
let(:events) { Chef::EventDispatch::Dispatcher.new }
|
34
34
|
let(:run_context) { Chef::RunContext.new(node, {}, events) }
|
35
|
-
let(:unit_name) { "sysstat-collect.timer" }
|
35
|
+
let(:unit_name) { "sysstat-collect\\x2d.timer" }
|
36
|
+
let(:unit_name_escaped) { "sysstat-collect\\\\x2d.timer" }
|
36
37
|
let(:user_name) { "joe" }
|
37
38
|
let(:current_resource) { Chef::Resource::SystemdUnit.new(unit_name) }
|
38
39
|
let(:new_resource) { Chef::Resource::SystemdUnit.new(unit_name) }
|
39
40
|
let(:provider) { Chef::Provider::SystemdUnit.new(new_resource, run_context) }
|
40
|
-
let(:unit_path_system) { "/etc/systemd/system/sysstat-collect.timer" }
|
41
|
-
let(:unit_path_user) { "/etc/systemd/user/sysstat-collect.timer" }
|
41
|
+
let(:unit_path_system) { "/etc/systemd/system/sysstat-collect\\x2d.timer" }
|
42
|
+
let(:unit_path_user) { "/etc/systemd/user/sysstat-collect\\x2d.timer" }
|
42
43
|
let(:unit_content_string) { "[Unit]\nDescription = Run system activity accounting tool every 10 minutes\n\n[Timer]\nOnCalendar = *:00/10\n\n[Install]\nWantedBy = sysstat.service\n" }
|
43
44
|
let(:malformed_content_string) { "derp" }
|
44
45
|
|
@@ -384,7 +385,7 @@ describe Chef::Provider::SystemdUnit do
|
|
384
385
|
current_resource.user(user_name)
|
385
386
|
current_resource.enabled(false)
|
386
387
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
387
|
-
.with("#{systemctl_path} --user enable #{
|
388
|
+
.with("#{systemctl_path} --user enable #{unit_name_escaped}", user_cmd_opts)
|
388
389
|
.and_return(shell_out_success)
|
389
390
|
provider.action_enable
|
390
391
|
end
|
@@ -407,7 +408,7 @@ describe Chef::Provider::SystemdUnit do
|
|
407
408
|
current_resource.user(user_name)
|
408
409
|
current_resource.enabled(true)
|
409
410
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
410
|
-
.with("#{systemctl_path} --user disable #{
|
411
|
+
.with("#{systemctl_path} --user disable #{unit_name_escaped}", user_cmd_opts)
|
411
412
|
.and_return(shell_out_success)
|
412
413
|
provider.action_disable
|
413
414
|
end
|
@@ -431,7 +432,7 @@ describe Chef::Provider::SystemdUnit do
|
|
431
432
|
it "enables the unit when it is disabled" do
|
432
433
|
current_resource.enabled(false)
|
433
434
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
434
|
-
.with("#{systemctl_path} --system enable #{
|
435
|
+
.with("#{systemctl_path} --system enable #{unit_name_escaped}", {})
|
435
436
|
.and_return(shell_out_success)
|
436
437
|
provider.action_enable
|
437
438
|
end
|
@@ -451,7 +452,7 @@ describe Chef::Provider::SystemdUnit do
|
|
451
452
|
it "disables the unit when it is enabled" do
|
452
453
|
current_resource.enabled(true)
|
453
454
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
454
|
-
.with("#{systemctl_path} --system disable #{
|
455
|
+
.with("#{systemctl_path} --system disable #{unit_name_escaped}", {})
|
455
456
|
.and_return(shell_out_success)
|
456
457
|
provider.action_disable
|
457
458
|
end
|
@@ -477,7 +478,7 @@ describe Chef::Provider::SystemdUnit do
|
|
477
478
|
current_resource.user(user_name)
|
478
479
|
current_resource.masked(false)
|
479
480
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
480
|
-
.with("#{systemctl_path} --user mask #{
|
481
|
+
.with("#{systemctl_path} --user mask #{unit_name_escaped}", user_cmd_opts)
|
481
482
|
.and_return(shell_out_success)
|
482
483
|
provider.action_mask
|
483
484
|
end
|
@@ -493,7 +494,7 @@ describe Chef::Provider::SystemdUnit do
|
|
493
494
|
current_resource.user(user_name)
|
494
495
|
current_resource.masked(true)
|
495
496
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
496
|
-
.with("#{systemctl_path} --user unmask #{
|
497
|
+
.with("#{systemctl_path} --user unmask #{unit_name_escaped}", user_cmd_opts)
|
497
498
|
.and_return(shell_out_success)
|
498
499
|
provider.action_unmask
|
499
500
|
end
|
@@ -510,7 +511,7 @@ describe Chef::Provider::SystemdUnit do
|
|
510
511
|
it "masks the unit when it is unmasked" do
|
511
512
|
current_resource.masked(false)
|
512
513
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
513
|
-
.with("#{systemctl_path} --system mask #{
|
514
|
+
.with("#{systemctl_path} --system mask #{unit_name_escaped}", {})
|
514
515
|
.and_return(shell_out_success)
|
515
516
|
provider.action_mask
|
516
517
|
end
|
@@ -524,7 +525,7 @@ describe Chef::Provider::SystemdUnit do
|
|
524
525
|
it "unmasks the unit when it is masked" do
|
525
526
|
current_resource.masked(true)
|
526
527
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
527
|
-
.with("#{systemctl_path} --system unmask #{
|
528
|
+
.with("#{systemctl_path} --system unmask #{unit_name_escaped}", {})
|
528
529
|
.and_return(shell_out_success)
|
529
530
|
provider.action_unmask
|
530
531
|
end
|
@@ -543,7 +544,7 @@ describe Chef::Provider::SystemdUnit do
|
|
543
544
|
current_resource.user(user_name)
|
544
545
|
current_resource.active(false)
|
545
546
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
546
|
-
.with("#{systemctl_path} --user start #{
|
547
|
+
.with("#{systemctl_path} --user start #{unit_name_escaped}", user_cmd_opts)
|
547
548
|
.and_return(shell_out_success)
|
548
549
|
provider.action_start
|
549
550
|
end
|
@@ -559,7 +560,7 @@ describe Chef::Provider::SystemdUnit do
|
|
559
560
|
current_resource.user(user_name)
|
560
561
|
current_resource.active(true)
|
561
562
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
562
|
-
.with("#{systemctl_path} --user stop #{
|
563
|
+
.with("#{systemctl_path} --user stop #{unit_name_escaped}", user_cmd_opts)
|
563
564
|
.and_return(shell_out_success)
|
564
565
|
provider.action_stop
|
565
566
|
end
|
@@ -576,7 +577,7 @@ describe Chef::Provider::SystemdUnit do
|
|
576
577
|
it "starts the unit when it is inactive" do
|
577
578
|
current_resource.active(false)
|
578
579
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
579
|
-
.with("#{systemctl_path} --system start #{
|
580
|
+
.with("#{systemctl_path} --system start #{unit_name_escaped}", {})
|
580
581
|
.and_return(shell_out_success)
|
581
582
|
provider.action_start
|
582
583
|
end
|
@@ -590,7 +591,7 @@ describe Chef::Provider::SystemdUnit do
|
|
590
591
|
it "stops the unit when it is active" do
|
591
592
|
current_resource.active(true)
|
592
593
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
593
|
-
.with("#{systemctl_path} --system stop #{
|
594
|
+
.with("#{systemctl_path} --system stop #{unit_name_escaped}", {})
|
594
595
|
.and_return(shell_out_success)
|
595
596
|
provider.action_stop
|
596
597
|
end
|
@@ -608,7 +609,7 @@ describe Chef::Provider::SystemdUnit do
|
|
608
609
|
it "restarts the unit" do
|
609
610
|
current_resource.user(user_name)
|
610
611
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
611
|
-
.with("#{systemctl_path} --user restart #{
|
612
|
+
.with("#{systemctl_path} --user restart #{unit_name_escaped}", user_cmd_opts)
|
612
613
|
.and_return(shell_out_success)
|
613
614
|
provider.action_restart
|
614
615
|
end
|
@@ -617,7 +618,7 @@ describe Chef::Provider::SystemdUnit do
|
|
617
618
|
current_resource.user(user_name)
|
618
619
|
current_resource.active(true)
|
619
620
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
620
|
-
.with("#{systemctl_path} --user reload #{
|
621
|
+
.with("#{systemctl_path} --user reload #{unit_name_escaped}", user_cmd_opts)
|
621
622
|
.and_return(shell_out_success)
|
622
623
|
provider.action_reload
|
623
624
|
end
|
@@ -633,7 +634,7 @@ describe Chef::Provider::SystemdUnit do
|
|
633
634
|
context "when no user is specified" do
|
634
635
|
it "restarts the unit" do
|
635
636
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
636
|
-
.with("#{systemctl_path} --system restart #{
|
637
|
+
.with("#{systemctl_path} --system restart #{unit_name_escaped}", {})
|
637
638
|
.and_return(shell_out_success)
|
638
639
|
provider.action_restart
|
639
640
|
end
|
@@ -641,7 +642,7 @@ describe Chef::Provider::SystemdUnit do
|
|
641
642
|
it "reloads the unit if active" do
|
642
643
|
current_resource.active(true)
|
643
644
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
644
|
-
.with("#{systemctl_path} --system reload #{
|
645
|
+
.with("#{systemctl_path} --system reload #{unit_name_escaped}", {})
|
645
646
|
.and_return(shell_out_success)
|
646
647
|
provider.action_reload
|
647
648
|
end
|
@@ -659,7 +660,7 @@ describe Chef::Provider::SystemdUnit do
|
|
659
660
|
it "try-restarts the unit" do
|
660
661
|
current_resource.user(user_name)
|
661
662
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
662
|
-
.with("#{systemctl_path} --user try-restart #{
|
663
|
+
.with("#{systemctl_path} --user try-restart #{unit_name_escaped}", user_cmd_opts)
|
663
664
|
.and_return(shell_out_success)
|
664
665
|
provider.action_try_restart
|
665
666
|
end
|
@@ -668,7 +669,7 @@ describe Chef::Provider::SystemdUnit do
|
|
668
669
|
context "when no user is specified" do
|
669
670
|
it "try-restarts the unit" do
|
670
671
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
671
|
-
.with("#{systemctl_path} --system try-restart #{
|
672
|
+
.with("#{systemctl_path} --system try-restart #{unit_name_escaped}", {})
|
672
673
|
.and_return(shell_out_success)
|
673
674
|
provider.action_try_restart
|
674
675
|
end
|
@@ -680,7 +681,7 @@ describe Chef::Provider::SystemdUnit do
|
|
680
681
|
it "reload-or-restarts the unit" do
|
681
682
|
current_resource.user(user_name)
|
682
683
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
683
|
-
.with("#{systemctl_path} --user reload-or-restart #{
|
684
|
+
.with("#{systemctl_path} --user reload-or-restart #{unit_name_escaped}", user_cmd_opts)
|
684
685
|
.and_return(shell_out_success)
|
685
686
|
provider.action_reload_or_restart
|
686
687
|
end
|
@@ -689,7 +690,7 @@ describe Chef::Provider::SystemdUnit do
|
|
689
690
|
context "when no user is specified" do
|
690
691
|
it "reload-or-restarts the unit" do
|
691
692
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
692
|
-
.with("#{systemctl_path} --system reload-or-restart #{
|
693
|
+
.with("#{systemctl_path} --system reload-or-restart #{unit_name_escaped}", {})
|
693
694
|
.and_return(shell_out_success)
|
694
695
|
provider.action_reload_or_restart
|
695
696
|
end
|
@@ -701,7 +702,7 @@ describe Chef::Provider::SystemdUnit do
|
|
701
702
|
it "reload-or-try-restarts the unit" do
|
702
703
|
current_resource.user(user_name)
|
703
704
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
704
|
-
.with("#{systemctl_path} --user reload-or-try-restart #{
|
705
|
+
.with("#{systemctl_path} --user reload-or-try-restart #{unit_name_escaped}", user_cmd_opts)
|
705
706
|
.and_return(shell_out_success)
|
706
707
|
provider.action_reload_or_try_restart
|
707
708
|
end
|
@@ -710,7 +711,7 @@ describe Chef::Provider::SystemdUnit do
|
|
710
711
|
context "when no user is specified" do
|
711
712
|
it "reload-or-try-restarts the unit" do
|
712
713
|
expect(provider).to receive(:shell_out_with_systems_locale!)
|
713
|
-
.with("#{systemctl_path} --system reload-or-try-restart #{
|
714
|
+
.with("#{systemctl_path} --system reload-or-try-restart #{unit_name_escaped}", {})
|
714
715
|
.and_return(shell_out_success)
|
715
716
|
provider.action_reload_or_try_restart
|
716
717
|
end
|
@@ -727,7 +728,7 @@ describe Chef::Provider::SystemdUnit do
|
|
727
728
|
it "returns true when unit is active" do
|
728
729
|
current_resource.user(user_name)
|
729
730
|
expect(provider).to receive(:shell_out)
|
730
|
-
.with("#{systemctl_path} --user is-active #{
|
731
|
+
.with("#{systemctl_path} --user is-active #{unit_name_escaped}", user_cmd_opts)
|
731
732
|
.and_return(shell_out_success)
|
732
733
|
expect(provider.active?).to be true
|
733
734
|
end
|
@@ -735,7 +736,7 @@ describe Chef::Provider::SystemdUnit do
|
|
735
736
|
it "returns false when unit is inactive" do
|
736
737
|
current_resource.user(user_name)
|
737
738
|
expect(provider).to receive(:shell_out)
|
738
|
-
.with("#{systemctl_path} --user is-active #{
|
739
|
+
.with("#{systemctl_path} --user is-active #{unit_name_escaped}", user_cmd_opts)
|
739
740
|
.and_return(shell_out_failure)
|
740
741
|
expect(provider.active?).to be false
|
741
742
|
end
|
@@ -744,14 +745,14 @@ describe Chef::Provider::SystemdUnit do
|
|
744
745
|
context "when no user is specified" do
|
745
746
|
it "returns true when unit is active" do
|
746
747
|
expect(provider).to receive(:shell_out)
|
747
|
-
.with("#{systemctl_path} --system is-active #{
|
748
|
+
.with("#{systemctl_path} --system is-active #{unit_name_escaped}", {})
|
748
749
|
.and_return(shell_out_success)
|
749
750
|
expect(provider.active?).to be true
|
750
751
|
end
|
751
752
|
|
752
753
|
it "returns false when unit is not active" do
|
753
754
|
expect(provider).to receive(:shell_out)
|
754
|
-
.with("#{systemctl_path} --system is-active #{
|
755
|
+
.with("#{systemctl_path} --system is-active #{unit_name_escaped}", {})
|
755
756
|
.and_return(shell_out_failure)
|
756
757
|
expect(provider.active?).to be false
|
757
758
|
end
|
@@ -768,7 +769,7 @@ describe Chef::Provider::SystemdUnit do
|
|
768
769
|
it "returns true when unit is enabled" do
|
769
770
|
current_resource.user(user_name)
|
770
771
|
expect(provider).to receive(:shell_out)
|
771
|
-
.with("#{systemctl_path} --user is-enabled #{
|
772
|
+
.with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
|
772
773
|
.and_return(shell_out_success)
|
773
774
|
expect(provider.enabled?).to be true
|
774
775
|
end
|
@@ -776,7 +777,7 @@ describe Chef::Provider::SystemdUnit do
|
|
776
777
|
it "returns false when unit is not enabled" do
|
777
778
|
current_resource.user(user_name)
|
778
779
|
expect(provider).to receive(:shell_out)
|
779
|
-
.with("#{systemctl_path} --user is-enabled #{
|
780
|
+
.with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
|
780
781
|
.and_return(shell_out_failure)
|
781
782
|
expect(provider.enabled?).to be false
|
782
783
|
end
|
@@ -785,14 +786,14 @@ describe Chef::Provider::SystemdUnit do
|
|
785
786
|
context "when no user is specified" do
|
786
787
|
it "returns true when unit is enabled" do
|
787
788
|
expect(provider).to receive(:shell_out)
|
788
|
-
.with("#{systemctl_path} --system is-enabled #{
|
789
|
+
.with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
|
789
790
|
.and_return(shell_out_success)
|
790
791
|
expect(provider.enabled?).to be true
|
791
792
|
end
|
792
793
|
|
793
794
|
it "returns false when unit is not enabled" do
|
794
795
|
expect(provider).to receive(:shell_out)
|
795
|
-
.with("#{systemctl_path} --system is-enabled #{
|
796
|
+
.with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
|
796
797
|
.and_return(shell_out_failure)
|
797
798
|
expect(provider.enabled?).to be false
|
798
799
|
end
|
@@ -809,7 +810,7 @@ describe Chef::Provider::SystemdUnit do
|
|
809
810
|
it "returns true when the unit is masked" do
|
810
811
|
current_resource.user(user_name)
|
811
812
|
expect(provider).to receive(:shell_out)
|
812
|
-
.with("#{systemctl_path} --user status #{
|
813
|
+
.with("#{systemctl_path} --user status #{unit_name_escaped}", user_cmd_opts)
|
813
814
|
.and_return(shell_out_masked)
|
814
815
|
expect(provider.masked?).to be true
|
815
816
|
end
|
@@ -817,7 +818,7 @@ describe Chef::Provider::SystemdUnit do
|
|
817
818
|
it "returns false when the unit is not masked" do
|
818
819
|
current_resource.user(user_name)
|
819
820
|
expect(provider).to receive(:shell_out)
|
820
|
-
.with("#{systemctl_path} --user status #{
|
821
|
+
.with("#{systemctl_path} --user status #{unit_name_escaped}", user_cmd_opts)
|
821
822
|
.and_return(shell_out_static)
|
822
823
|
expect(provider.masked?).to be false
|
823
824
|
end
|
@@ -826,14 +827,14 @@ describe Chef::Provider::SystemdUnit do
|
|
826
827
|
context "when no user is specified" do
|
827
828
|
it "returns true when the unit is masked" do
|
828
829
|
expect(provider).to receive(:shell_out)
|
829
|
-
.with("#{systemctl_path} --system status #{
|
830
|
+
.with("#{systemctl_path} --system status #{unit_name_escaped}", {})
|
830
831
|
.and_return(shell_out_masked)
|
831
832
|
expect(provider.masked?).to be true
|
832
833
|
end
|
833
834
|
|
834
835
|
it "returns false when the unit is not masked" do
|
835
836
|
expect(provider).to receive(:shell_out)
|
836
|
-
.with("#{systemctl_path} --system status #{
|
837
|
+
.with("#{systemctl_path} --system status #{unit_name_escaped}", {})
|
837
838
|
.and_return(shell_out_static)
|
838
839
|
expect(provider.masked?).to be false
|
839
840
|
end
|
@@ -850,7 +851,7 @@ describe Chef::Provider::SystemdUnit do
|
|
850
851
|
it "returns true when the unit is static" do
|
851
852
|
current_resource.user(user_name)
|
852
853
|
expect(provider).to receive(:shell_out)
|
853
|
-
.with("#{systemctl_path} --user is-enabled #{
|
854
|
+
.with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
|
854
855
|
.and_return(shell_out_static)
|
855
856
|
expect(provider.static?).to be true
|
856
857
|
end
|
@@ -858,7 +859,7 @@ describe Chef::Provider::SystemdUnit do
|
|
858
859
|
it "returns false when the unit is not static" do
|
859
860
|
current_resource.user(user_name)
|
860
861
|
expect(provider).to receive(:shell_out)
|
861
|
-
.with("#{systemctl_path} --user is-enabled #{
|
862
|
+
.with("#{systemctl_path} --user is-enabled #{unit_name_escaped}", user_cmd_opts)
|
862
863
|
.and_return(shell_out_masked)
|
863
864
|
expect(provider.static?).to be false
|
864
865
|
end
|
@@ -867,14 +868,14 @@ describe Chef::Provider::SystemdUnit do
|
|
867
868
|
context "when no user is specified" do
|
868
869
|
it "returns true when the unit is static" do
|
869
870
|
expect(provider).to receive(:shell_out)
|
870
|
-
.with("#{systemctl_path} --system is-enabled #{
|
871
|
+
.with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
|
871
872
|
.and_return(shell_out_static)
|
872
873
|
expect(provider.static?).to be true
|
873
874
|
end
|
874
875
|
|
875
876
|
it "returns false when the unit is not static" do
|
876
877
|
expect(provider).to receive(:shell_out)
|
877
|
-
.with("#{systemctl_path} --system is-enabled #{
|
878
|
+
.with("#{systemctl_path} --system is-enabled #{unit_name_escaped}", {})
|
878
879
|
.and_return(shell_out_masked)
|
879
880
|
expect(provider.static?).to be false
|
880
881
|
end
|