Module: Landrush::Cap::Redhat::RestartDnsmasq

Defined in:
lib/landrush/cap/host/redhat/restart_dnsmasq.rb

Constant Summary collapse

SED_COMMAND =
<<-EOF.gsub(/^ +/, '')
sudo sed -i.orig '1 i\
# Added by landrush, a vagrant plugin \\
nameserver 127.0.0.1 \\
' /etc/resolv.conf
EOF

Class Method Summary collapse

Class Method Details

.restart_dnsmasq(_env) ⇒ Object



13
14
15
16
17
18
# File 'lib/landrush/cap/host/redhat/restart_dnsmasq.rb', line 13

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
  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