Sha256: 372c21230bda78a254940cbd466d290b7a0edcc59747f0ef94b4e86b6438306a

Contents?: true

Size: 944 Bytes

Versions: 14

Compression:

Stored size: 944 Bytes

Contents

# == AddressManager::SunOS
#
# A SunOS-specific driver for the AddressManager provides complete support for
# querying, adding and removing addresses.
class AutomateIt::AddressManager::SunOS < AutomateIt::AddressManager::BaseDriver
  def self.token
    :sunos
  end

  depends_on :programs => %w(ifconfig uname),
    :callbacks => lambda{`uname -s 2>&1`.match(/sunos/i)}

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

  # See AddressManager#add
  def add(opts)
    _add_helper(opts) do |opts|
      interpreter.sh("ifconfig %s plumb" % _interface_and_label(opts))
      interpreter.sh(_ifconfig_helper(:add, opts))
    end
  end

  # See AddressManager#remove
  def remove(opts)
    _remove_helper(opts) do |opts|
      interpreter.sh(_ifconfig_helper(:remove, opts))
      interpreter.sh("ifconfig %s unplumb" % _interface_and_label(opts))
      true
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
automate-it-0.9.2 lib/automateit/address_manager/sunos.rb
automate-it-0.9.1 lib/automateit/address_manager/sunos.rb
automate-it-0.9.0 lib/automateit/address_manager/sunos.rb
automateit-0.71221 lib/automateit/address_manager/sunos.rb
automateit-0.71112 lib/automateit/address_manager/sunos.rb
automateit-0.71219 lib/automateit/address_manager/sunos.rb
automateit-0.71220 lib/automateit/address_manager/sunos.rb
automateit-0.71104 lib/automateit/address_manager/sunos.rb
automateit-0.71111 lib/automateit/address_manager/sunos.rb
automateit-0.71226.1 lib/automateit/address_manager/sunos.rb
automateit-0.71226 lib/automateit/address_manager/sunos.rb
automateit-0.80116 lib/automateit/address_manager/sunos.rb
automateit-0.71230 lib/automateit/address_manager/sunos.rb
automateit-0.80624 lib/automateit/address_manager/sunos.rb