Sha256: 625087e29e75becf94b8785948748be13f562f8e1ddd6541153e3e5dea6eb30c

Contents?: true

Size: 548 Bytes

Versions: 151

Compression:

Stored size: 548 Bytes

Contents

module VMC::Micro::Switcher

  class Linux < Base
    def set_nameserver(domain, ip)
      VMC::Micro.run_command("sudo", "sed -i'.backup' '1 i nameserver #{ip}' /etc/resolv.conf")
      # lock resolv.conf so Network Manager doesn't clear out the file when offline
      VMC::Micro.run_command("sudo", "chattr +i /etc/resolv.conf")
    end

    def unset_nameserver(domain, ip)
      VMC::Micro.run_command("sudo", "chattr -i /etc/resolv.conf")
      VMC::Micro.run_command("sudo", "sed -i'.backup' '/#{ip}/d' /etc/resolv.conf")
    end
  end

end

Version data entries

151 entries across 151 versions & 9 rubygems

Version Path
af-0.3.18.4 lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.32 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.31 vmc/lib/vmc/micro/switcher/linux.rb
af-0.3.18.3 lib/vmc/micro/switcher/linux.rb
af-0.3.18.2 lib/vmc/micro/switcher/linux.rb
af-0.3.18.1 lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.30 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.29 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.28 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.27 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.26 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.25 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.24 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.23 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.22 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.21 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.20 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.19 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.18 vmc/lib/vmc/micro/switcher/linux.rb
vmc-0.4.0.beta.17 vmc/lib/vmc/micro/switcher/linux.rb