module Landrush::Cap::Redhat::RestartDnsmasq

Constants

SED_COMMAND

Public Class Methods

restart_dnsmasq(_env) click to toggle source
# File lib/landrush/cap/host/redhat/restart_dnsmasq.rb, line 15
def restart_dnsmasq(_env)
  # TODO: At some stage we might want to make create_dnsmasq_config host specific and add the resolv.conf
  # changes there which seems more natural
  if Landrush::Util::Dnsmasq.nm_managed?
    system('sudo systemctl reload NetworkManager')
  else
    system(SED_COMMAND) unless system("cat /etc/resolv.conf | grep 'nameserver 127.0.0.1' > /dev/null 2>&1")
    system('sudo systemctl restart dnsmasq')
  end
end