Class | AutomateIt::AddressManager::OpenBSD |
In: |
lib/automateit/address_manager/openbsd.rb
|
Parent: | AutomateIt::AddressManager::BaseDriver |
A OpenBSD-specific driver for the AddressManager provides complete support for querying, adding and removing addresses.
See AddressManager#add
# File lib/automateit/address_manager/openbsd.rb, line 19 def add(opts) _add_helper(opts) do |opts| interpreter.sh(_openbsd_ifconfig_helper(:add, opts)) end end
See AddressManager#addresses
# File lib/automateit/address_manager/openbsd.rb, line 34 def addresses() _raise_unless_available # OpenBSD requires an "-A" to display aliases, not the usual "-a" return `ifconfig -A`.scan(/\s+inet\s+([^\s]+)\s+/).flatten end
See AddressManager#has?
# File lib/automateit/address_manager/openbsd.rb, line 41 def has?(opts) opts2 = opts.clone is_alias = opts2.delete(:label) return super(opts2) end
See AddressManager#remove
# File lib/automateit/address_manager/openbsd.rb, line 26 def remove(opts) _remove_helper(opts) do |opts| interpreter.sh(_openbsd_ifconfig_helper(:remove, opts)) true end end
ifconfig dc0 inet alias 192.168.0.3 netmask 255.255.255.255
# File lib/automateit/address_manager/openbsd.rb, line 50 def _openbsd_ifconfig_helper(action, opts) helper_opts = {:state => false, :prepend => %w(inet)} opts2 = opts.clone if opts2.delete(:label) helper_opts[:prepend] << \ case action when :add "alias" when :remove, :del "delete" else ArgumentError.new("Unknown action: #{action}") end end return _ifconfig_helper(action, opts2, helper_opts) end