Class: Yast::SystemdTargetClass::Target

Inherits:
Yast::SystemdUnit show all
Defined in:
library/systemd/src/modules/systemd_target.rb

Constant Summary

Constants inherited from Yast::SystemdUnit

Yast::SystemdUnit::ACTIVE_STATES, Yast::SystemdUnit::DEFAULT_PROPMAP, Yast::SystemdUnit::SUPPORTED_STATES, Yast::SystemdUnit::SUPPORTED_TYPES

Instance Attribute Summary

Attributes inherited from Yast::SystemdUnit

#error, #name, #properties, #propmap, #unit_name, #unit_type

Instance Method Summary collapse

Methods inherited from Yast::SystemdUnit

#command, #disable, #enable, #initialize, #refresh!, #reload, #reload_or_restart, #reload_or_try_restart, #restart, #show, #start, #status, #stop, #try_restart

Constructor Details

This class inherits a constructor from Yast::SystemdUnit

Instance Method Details

#allow_isolate?Boolean

Returns:

  • (Boolean)


99
100
101
102
103
104
# File 'library/systemd/src/modules/systemd_target.rb', line 99

def allow_isolate?
  # We cannot find out a target properties from /mnt in inst-sys
  # systemctl doesn't return any properties in chroot
  # See bnc#889323
  ["yes", nil].include?(properties.allow_isolate)
end

#set_defaultObject



106
107
108
109
110
111
112
113
114
115
116
117
# File 'library/systemd/src/modules/systemd_target.rb', line 106

def set_default
  unless allow_isolate?
    log.error "Cannot set #{id.inspect} as default target: Cannot be isolated (#{properties.allow_isolate})"
    return false
  end

  # Constructing a fallback target ID if we can't get it from systemctl
  target_name = id ? id : "#{name}.target"

  result = Systemctl.execute("set-default --force #{target_name}")
  result.exit.zero?
end