Skip to content

Commit

Permalink
When a systemd socket is stopped stop also its associated service
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Apr 23, 2018
1 parent ca77575 commit c076e3f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib/y2remote/modes/socket_based.rb
Expand Up @@ -16,6 +16,11 @@ def socket_name
raise "Not implemented yet"
end

# Name of the associated service that will be started
def service_name
raise "Not implemented yet"
end

# Obtain the systemd socket itself
#
# @return [Yast::SystemdSocket, nil]
Expand Down Expand Up @@ -82,6 +87,10 @@ def stop!
return false
end

if !Yast::Service.Stop(service_name)
Yast::Report.Error(Yast::Message.CannotStopService(service_name))
end

true
end

Expand Down
4 changes: 4 additions & 0 deletions src/lib/y2remote/modes/vnc.rb
Expand Up @@ -20,6 +20,10 @@ def required_packages
def socket_name
SOCKET
end

def service_name
"#{socket_name}@*"
end
end
end
end
7 changes: 7 additions & 0 deletions src/lib/y2remote/modes/web.rb
Expand Up @@ -25,6 +25,13 @@ def required_packages
def socket_name
SOCKET
end

# Name of the associated service
#
# @return [String] service name
def service_name
socket_name
end
end
end
end

0 comments on commit c076e3f

Please sign in to comment.