Sha256: bd60f4b319f8a3a92859fed5a595203ef2e06b41d91324bc8cea6a1c2884a34c
Contents?: true
Size: 1.2 KB
Versions: 26
Compression:
Stored size: 1.2 KB
Contents
# == AddressManager::Linux # # A Linux-specific driver for the AddressManager provides complete support for # querying, adding and removing addresses on platforms that feature Linux-like # tools. class AutomateIt::AddressManager::Linux < AutomateIt::AddressManager::BaseDriver depends_on :programs => "ifconfig", :callbacks => lambda{`ifconfig --version 2>&1`.match(/net-tools/)} def suitability(method, *args) # :nodoc: available? ? 2 : 0 end # See AddressManager#add def add(opts) _add_helper(opts) do |opts| interpreter.sh(_ifconfig_helper(:add, opts)) if interpreter.which("arping") interpreter.sh("arping -q -c #{opts[:announcements]} -w #{opts[:announcements]} -I #{opts[:device]} #{opts[:address]}") end end end # See AddressManager#remove def remove(opts) _remove_helper(opts) do |opts| interpreter.sh(_ifconfig_helper(:remove, opts)) end end # See AddressManager#interfaces def interfaces() _raise_unless_available return `ifconfig`.scan(/^(\w+?(?::\w+)?)\b\s+Link/).flatten end # See AddressManager#addresses def addresses() _raise_unless_available return `ifconfig`.scan(/inet6? addr:\s*(.+?)\s+/).flatten end end
Version data entries
26 entries across 26 versions & 2 rubygems