Module: LoomExt::CoreMods::SystemdCommon

Included in:
Systemd, SystemdSockets, SystemdTimers, SystemdUnits
Defined in:
lib/loomext/coremods/systemd/systemd.rb

Instance Method Summary collapse

Instance Method Details

#do_systemctl(action, unit = nil, *args, flags: []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/loomext/coremods/systemd/systemd.rb', line 4

def do_systemctl(action, unit=nil, *args, flags: [])
  flags << "--no-pager"
  flags << "--no-legend"
  flags << "--no-ask-password"

  exec_args = [
    "systemctl",
    flags,
    action,
    unit
  ].flatten.compact
  args = exec_args.concat args
  shell.execute(*args)
end