Class: AutomateIt::AddressManager::FreeBSD

Inherits:
BaseDriver show all
Defined in:
lib/automateit/address_manager/freebsd.rb

Overview

AddressManager::FreeBSD

A FreeBSD-specific driver for the AddressManager provides complete support for querying, adding and removing addresses.

Constant Summary

Constants inherited from Plugin::Driver

Plugin::Driver::BASE_DRIVER_NAME

Constants included from Constants

Constants::HELPERS_DIR, Constants::INSTALL_DIR, Constants::PERROR, Constants::PEXEC, Constants::PNOTE, Constants::WARNING_BOILERPLATE

Instance Attribute Summary

Attributes inherited from Plugin::Driver

#manager

Attributes inherited from Common

#interpreter

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseDriver

#hostnames, #hostnames_for

Methods inherited from Plugin::Driver

abstract_driver, #available?, base_driver, base_driver?, depends_on, inherited, manager_token, #setup

Methods inherited from Plugin::Base

#setup, #token

Methods inherited from Common

#initialize, #log, #nitpick, #noop, #noop=, #noop?, #preview, #preview=, #preview?, #preview_for, #setup, #superuser?, #writing, #writing=, #writing?

Constructor Details

This class inherits a constructor from AutomateIt::Common

Class Method Details

.tokenObject



6
7
8
# File 'lib/automateit/address_manager/freebsd.rb', line 6

def self.token
  :freebsd
end

Instance Method Details

#add(opts) ⇒ Object

See AddressManager#add



19
20
21
22
23
# 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

#has?(opts) ⇒ Boolean

See AddressManager#has?

Returns:

  • (Boolean)


34
35
36
37
38
# File 'lib/automateit/address_manager/freebsd.rb', line 34

def has?(opts)
  opts2 = opts.clone
  is_alias = opts2.delete(:label)
  return super(opts2)
end

#remove(opts) ⇒ Object

See AddressManager#remove



26
27
28
29
30
31
# 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

#suitability(method, *args) ⇒ Object

:nodoc:



13
14
15
16
# File 'lib/automateit/address_manager/freebsd.rb', line 13

def suitability(method, *args) # :nodoc:
  # Must be higher than AddressManager::BSD
  available? ? 3 : 0
end