Class | AutomateIt::AddressManager::Linux |
In: |
lib/automateit/address_manager/linux.rb
|
Parent: | AutomateIt::AddressManager::BaseDriver |
A Linux-specific driver for the AddressManager provides complete support for querying, adding and removing addresses on platforms that feature Linux-like tools.
See AddressManager#add
# File lib/automateit/address_manager/linux.rb, line 15 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#addresses
# File lib/automateit/address_manager/linux.rb, line 38 def addresses() _raise_unless_available return `ifconfig`.scan(/inet6? addr:\s*(.+?)\s+/).flatten end
See AddressManager#interfaces
# File lib/automateit/address_manager/linux.rb, line 32 def interfaces() _raise_unless_available return `ifconfig`.scan(/^(\w+?(?::\w+)?)\b\s+Link/).flatten end