Class: Yast::SystemdUnit::InstallationProperties

Inherits:
OpenStruct
  • Object
show all
Includes:
Logger
Defined in:
library/systemd/src/lib/yast2/systemd_unit.rb

Overview

systemd command `systemctl show` is not available during installation and will return error “Running in chroot, ignoring request.” Therefore, we must avoid calling it in the installation workflow. To keep the API partially consistent, this class offers a replacement for the Properties above.

It has two goals:

  1. Checks for existence of the unit based on the stderr from the command `systemctl is-enabled`

  2. Retrieves the status enabled|disabled which is needed in the installation system. There are currently only 3 commands available for systemd in inst-sys/chroot: `systemctl enable|disable|is-enabled`. The rest will return the error message mentioned above in this comment.

Once the inst-sys has running dbus/systemd, this class definition can be removed together with the condition for Stage.initial in the SystemdUnit#show.

Instance Method Summary collapse

Constructor Details

#initialize(systemd_unit) ⇒ InstallationProperties

Returns a new instance of InstallationProperties



282
283
284
285
286
287
288
289
290
291
# File 'library/systemd/src/lib/yast2/systemd_unit.rb', line 282

def initialize(systemd_unit)
  super()
  self[:systemd_unit] = systemd_unit
  self[:status]       = read_status
  self[:raw]          = status.stdout
  self[:error]        = status.stderr
  self[:exit]         = status.exit
  self[:enabled?]     = status.exit.zero?
  self[:not_found?]   = service_missing?
end