Class: Yast2::Systemd::UnitInstallationProperties
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Yast2::Systemd::UnitInstallationProperties
- Includes:
- Yast::Logger
- Defined in:
- library/systemd/src/lib/yast2/systemd/unit_installation_properties.rb
Overview
Once the inst-sys has running dbus/systemd, this class definition
A replacement for UnitProperties during installation
Systemd show
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, reason
why exist this class that helps to keep the API partially consistent.
It has two goals:
- Checks for existence of the unit based on the stderr from the
command
systemctl is-enabled
- 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.
can be removed together with the condition for Stage.initial in the Yast2::Systemd::Unit#show
Instance Method Summary collapse
-
#initialize(systemd_unit) ⇒ UnitInstallationProperties
constructor
A new instance of UnitInstallationProperties.
Constructor Details
#initialize(systemd_unit) ⇒ UnitInstallationProperties
Returns a new instance of UnitInstallationProperties.
29 30 31 32 33 34 35 36 37 38 |
# File 'library/systemd/src/lib/yast2/systemd/unit_installation_properties.rb', line 29 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 |