Skip to content

Commit

Permalink
Merge ec8849c into 6d1a5c9
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jun 26, 2018
2 parents 6d1a5c9 + ec8849c commit 2249f39
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 7 deletions.
7 changes: 7 additions & 0 deletions package/yast2-services-manager.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
-------------------------------------------------------------------
Tue Jun 26 15:07:27 UTC 2018 - igonzalezsosa@suse.com

- Consider a service as enabled when its associated socket is
enabled (bsc#1080738)
- 4.0.4

-------------------------------------------------------------------
Mon Feb 12 09:45:41 UTC 2018 - knut.anderssen@suse.com

Expand Down
10 changes: 5 additions & 5 deletions package/yast2-services-manager.spec
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
######################################################################

Name: yast2-services-manager
Version: 4.0.3
Version: 4.0.4
Release: 0
BuildArch: noarch

BuildRoot: %{_tmppath}/%{name}-build
Source0: %{name}-%{version}.tar.bz2

Requires: ruby
# Firewalld interfaces helpers
Requires: yast2 >= 4.0.51
# Yast::SystemdServiceClass::Service#socket
Requires: yast2 >= 4.0.78
Requires: yast2-ruby-bindings >= 1.2.0
# need new enough installation for its inst clients
Conflicts: yast2-installation < 3.1.32
Expand All @@ -44,8 +44,8 @@ Conflicts: yast2-runlevel
BuildRequires: ruby
BuildRequires: update-desktop-files
BuildRequires: yast2-ruby-bindings >= 1.2.0
# Firewalld interfaces helpers
BuildRequires: yast2 >= 4.0.51
# Yast::SystemdServiceClass::Service#socket
BuildRequires: yast2 >= 4.0.78
# Support for 'data' directory in rake install task
BuildRequires: rubygem(yast-rake) >= 0.1.7
BuildRequires: rubygem(rspec)
Expand Down
2 changes: 1 addition & 1 deletion src/modules/services_manager_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ def extract_services
# Rest of settings
service_names.zip(ss).each do |name, s|
sh = services[name] # service hash
sh[:enabled] = s && s.enabled?
sh[:enabled] = s && (s.enabled? || !!(s.socket && s.socket.enabled?))
sh[:active] = s && s.active?
if !sh[:description] || sh[:description].empty?
sh[:description] = s ? s.description : ""
Expand Down
27 changes: 26 additions & 1 deletion test/services_manager_service_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def stub_services

all_services = {}
declare_service = lambda do |name, enabled|
d = double(description: "Stub #{name}", enabled?: enabled, active?: true)
d = double(description: "Stub #{name}", enabled?: enabled, active?: true, socket: nil)
all_services[name] = d
end

Expand Down Expand Up @@ -215,5 +215,30 @@ def stub_services
end
end

context "when a service is disabled" do
let(:dbus) do
double("dbus", enabled?: false, active?: true, description: "CUPS", socket: socket)
end

before do
allow(SystemdService).to receive(:find_many).and_return([dbus])
end

context "but its socket is enabled" do
let(:socket) { double("dbus_socket", enabled?: true) }

it "considers the system as enabled" do
expect(service.all["dbus"][:enabled]).to eq(true)
end
end

context "and its socket is disabled" do
let(:socket) { double("dbus_socket", enabled?: false) }

it "considers the system as enabled" do
expect(service.all["dbus"][:enabled]).to eq(false)
end
end
end
end
end

0 comments on commit 2249f39

Please sign in to comment.