class AutomateIt::AccountManager::NSCD

AccountManager::NSCD

AccountManager driver for invalidating records stored in the NSCD, Name Service Cache Daemon, found on Unix-like systems.

Public Instance Methods

database_for(query) click to toggle source

Returns the NSCD database for the specified shorthand query.

# File lib/automateit/account_manager/nscd.rb, line 16
def database_for(query)
  case query.to_sym
  when :user, :users, :passwd, :password
    :passwd
  when :group, :groups
    :group
  else
    raise ArgumentError.new("Unknown cache database: #{query}")
  end
end
invalidate(database) click to toggle source

Invalidates the NSCD database, thus forcing a cache reload.

# File lib/automateit/account_manager/nscd.rb, line 28
def invalidate(database)
  return false unless available?

  interpreter.sh("nscd -i #{database_for(database)}")
end