Class: ConfigOMat::Op::GenerateSystemdConfig

Inherits:
LifecycleVM::OpBase
  • Object
show all
Defined in:
lib/config_o_mat/meta_configurator/op/generate_systemd_config.rb

Constant Summary collapse

DROPIN_FILE_NAME =
'99_teak_configurator.conf'

Instance Method Summary collapse

Instance Method Details

#callObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/config_o_mat/meta_configurator/op/generate_systemd_config.rb', line 28

def call
  grouped_restart_modes = service_defs.values.group_by(&:restart_mode)
  restarts = grouped_restart_modes.fetch(:restart, []) + grouped_restart_modes.fetch(:restart_all, [])
  flip_flops = grouped_restart_modes[:flip_flop]
  nones = grouped_restart_modes[:none]

  enable_restarts(restarts) if !restarts.empty?
  enable_flip_flops(flip_flops) if flip_flops
  enable_nones(nones) if nones

  systemd_interface.daemon_reload
end