diff options
author | Lance Albertson <lance@osuosl.org> | 2021-05-01 21:32:14 -0700 |
---|---|---|
committer | John McCrae <john.mccrae@progress.com> | 2021-05-14 08:53:48 -0700 |
commit | aba82006de9c7c8689348da8b7c3cc5c31674da5 (patch) | |
tree | 01ed984e0bc7d984fb7e5878937f7bc50d2df641 | |
parent | a51129630bdddf2f52ad02ebbc737854432f3ef9 (diff) | |
download | chef-aba82006de9c7c8689348da8b7c3cc5c31674da5.tar.gz |
Fix systemd service state detection
Resolves #11496
This adds a missing double splat which is required when using Ruby 3.0.
Signed-off-by: Lance Albertson <lance@osuosl.org>
-rw-r--r-- | lib/chef/provider/service/systemd.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/service/systemd_service_spec.rb | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/provider/service/systemd.rb b/lib/chef/provider/service/systemd.rb index 13c2d7b53c..8f785875cc 100644 --- a/lib/chef/provider/service/systemd.rb +++ b/lib/chef/provider/service/systemd.rb @@ -80,7 +80,7 @@ class Chef::Provider::Service::Systemd < Chef::Provider::Service::Simple @systemd_service_status ||= begin # Collect all the status information for a service and returns it at once options, args = get_systemctl_options_args - s = shell_out!(systemctl_path, args, "show", "-p", "UnitFileState", "-p", "ActiveState", new_resource.service_name, options) + s = shell_out!(systemctl_path, args, "show", "-p", "UnitFileState", "-p", "ActiveState", new_resource.service_name, **options) # e.g. /bin/systemctl --system show -p UnitFileState -p ActiveState sshd.service # Returns something like: # ActiveState=active diff --git a/spec/unit/provider/service/systemd_service_spec.rb b/spec/unit/provider/service/systemd_service_spec.rb index ed6e3f989e..4f38ed5465 100644 --- a/spec/unit/provider/service/systemd_service_spec.rb +++ b/spec/unit/provider/service/systemd_service_spec.rb @@ -313,7 +313,7 @@ describe Chef::Provider::Service::Systemd do def with_systemctl_show(systemctl_path, stdout) systemctl_show = [systemctl_path, "--system", "show", "-p", "UnitFileState", "-p", "ActiveState", service_name] - expect(provider).to receive(:shell_out!).with(*systemctl_show, {}).and_return(double(stdout: stdout, exitstatus: 0, error?: false)) + expect(provider).to receive(:shell_out!).with(*systemctl_show).and_return(double(stdout: stdout, exitstatus: 0, error?: false)) end describe "systemd_service_status" do @@ -341,7 +341,7 @@ describe Chef::Provider::Service::Systemd do it "should error if '#{systemctl_path} --system show -p UnitFileState -p ActiveState service_name' returns non 0" do systemctl_show = [systemctl_path, "--system", "show", "-p", "UnitFileState", "-p", "ActiveState", service_name] - allow(provider).to receive(:shell_out!).with(*systemctl_show, {}).and_return(shell_out_failure) + allow(provider).to receive(:shell_out!).with(*systemctl_show).and_return(shell_out_failure) expect { provider.systemd_service_status }.to raise_error(Chef::Exceptions::Service) end end |