Sha256: af42e6fff359e07df0cb2ee28442eee4706437fd263653b1b909e3a3ff4bdc5f

Contents?: true

Size: 799 Bytes

Versions: 8

Compression:

Stored size: 799 Bytes

Contents

# == AccountManager::NSCD
#
# AccountManager driver for invalidating records stored in the NSCD, Name
# Service Cache Daemon, found on Unix-like systems.
class ::AutomateIt::AccountManager::NSCD < ::AutomateIt::AccountManager::BaseDriver
  depends_on :programs => %w(nscd ps), 
    :callbacks => [lambda{`ps -ef`.match(%r{/usr/sbin/nscd$})}]

  def suitability(method, *args) # :nodoc:
    # Level must be higher than Portable
    return available? ? 5 : 0
  end

  def invalidate(database)
    return false unless available?

    name = \
      case database.to_sym
      when :user, :users, :passwd
        :passwd
      when :group, :groups
        :group
      else
        raise ArgumentError.new("Unknown cache database: #{database}")
      end
    interpreter.sh("nscd -i #{name}")
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
automateit-0.71031.2 lib/automateit/account_manager/nscd.rb
automateit-0.71031.1 lib/automateit/account_manager/nscd.rb
automateit-0.71030 lib/automateit/account_manager/nscd.rb
automateit-0.71101.1 lib/automateit/account_manager/nscd.rb
automateit-0.71101.2 lib/automateit/account_manager/nscd.rb
automateit-0.71102 lib/automateit/account_manager/nscd.rb
automateit-0.71031 lib/automateit/account_manager/nscd.rb
automateit-0.71101 lib/automateit/account_manager/nscd.rb