Class | AutomateIt::AddressManager::FreeBSD |
In: |
lib/automateit/address_manager/freebsd.rb
|
Parent: | AutomateIt::AddressManager::BaseDriver |
A FreeBSD-specific driver for the AddressManager provides complete support for querying, adding and removing addresses.
See AddressManager#add
# File lib/automateit/address_manager/freebsd.rb, line 19 def add(opts) _add_helper(opts) do |opts| interpreter.sh(_freebsd_ifconfig_helper(:add, opts)) end end
See AddressManager#has?
# File lib/automateit/address_manager/freebsd.rb, line 34 def has?(opts) opts2 = opts.clone is_alias = opts2.delete(:label) return super(opts2) end
See AddressManager#remove
# File lib/automateit/address_manager/freebsd.rb, line 26 def remove(opts) _remove_helper(opts) do |opts| interpreter.sh(_freebsd_ifconfig_helper(:remove, opts)) true end end
ifconfig fxp0 inet 172.16.1.3 netmask 255.255.255.255 alias
# File lib/automateit/address_manager/freebsd.rb, line 43 def _freebsd_ifconfig_helper(action, opts) helper_opts = {:state => false, :prepend => %w(inet)} opts2 = opts.clone if opts2.delete(:label) helper_opts[:append] = \ case action when :add %w(alias) when :remove, :del %w(-alias) else ArgumentError.new("Unknown action: #{action}") end end return _ifconfig_helper(action, opts2, helper_opts) end