Class: Yast2::Systemd::SocketFinder

Inherits:
Object
  • Object
show all
Defined in:
library/systemd/src/lib/yast2/systemd/socket_finder.rb

Overview

This class is responsible for finding out which sockets trigger a given service.

When systemd is working properly, the relationship between services and sockets is cached in order to reduce the amount of calls to systemctl show. However, during the installation, where systemd is not fully operational, this class just tries to find a socket named after the service.

Examples:

Finding a socket

finder = Yast2::SystemdSocketFinder.new
finder.for_service("cups").class # => Yast2::Systemd::Socket

Instance Method Summary collapse

Instance Method Details

#for_service(service_name) ⇒ Yast2::SystemdSocket?

Returns the socket for a given service

Parameters:

  • service_name (String)

    Service name (without the .service extension)

Returns:

  • (Yast2::SystemdSocket, nil)


43
44
45
46
47
48
# File 'library/systemd/src/lib/yast2/systemd/socket_finder.rb', line 43

def for_service(service_name)
  socket_name = socket_name_for(service_name)
  return nil unless socket_name

  Yast2::Systemd::Socket.find(socket_name)
end