Class: AutomateIt::AccountManager::NSCD

Inherits:
BaseDriver show all
Defined in:
lib/automateit/account_manager/nscd.rb

Overview

AccountManager::NSCD

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

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

Instance Method Summary collapse

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, 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

Instance Method Details

#database_for(query) ⇒ Object

Returns the NSCD database for the specified shorthand query.



16
17
18
19
20
21
22
23
24
25
# 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) ⇒ Object

Invalidates the NSCD database, thus forcing a cache reload.



28
29
30
31
32
# File 'lib/automateit/account_manager/nscd.rb', line 28

def invalidate(database)
  return false unless available?

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

#suitability(method, *args) ⇒ Object

:nodoc:



10
11
12
13
# File 'lib/automateit/account_manager/nscd.rb', line 10

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