Class: Installation::Services

Inherits:
Object
  • Object
show all
Extended by:
Yast::Logger
Defined in:
src/lib/installation/services.rb

Overview

Note:

For installed system use ServicesManagerServices from

Represents services manipulation in installation.

yast2-services-manager. But for installation it is not suitable as it expects list of all systemd services in advance and try to adapt all of it. On other hand goal of this module is to do just fine tuning of few single services and keep defaults for rest.

Class Method Summary collapse

Class Method Details

.enabledObject

gets array of services to enable



17
18
19
# File 'src/lib/installation/services.rb', line 17

def enabled
  @enabled ||= []
end

.enabled=(services) ⇒ Object

sets array of services to enable

Raises:

  • (ArgumentError)

    when argument is not Array



23
24
25
26
27
28
29
30
# File 'src/lib/installation/services.rb', line 23

def enabled=(services)
  if !services.is_a?(::Array)
    raise ArgumentError, "Services#enabled= allows only Array as " \
                         "argument, not #{services.inspect}"
  end

  @enabled = services
end

.writeObject

does real enablement of services previously set



33
34
35
36
37
38
39
# File 'src/lib/installation/services.rb', line 33

def write
  enabled.each do |service|
    log.info "Enabling service #{service}"
    s = Yast2::Systemd::Service.find!(service)
    s.enable
  end
end